Move editor UI into the app and release verified Core dependencies (#14)
Gitea CI / Assemble and validate CI artifacts (push) Successful in 1m47s
Gitea CI / Check code and tests (push) Successful in 7m15s
Gitea CI / Build Android APK (push) Successful in 4m6s
Gitea CI / Build Windows x64 app (push) Successful in 3m34s
Gitea CI / Audit and package Windows x64 (push) Successful in 1m29s
Gitea CI / Gitea CI passed (push) Successful in 1s
Gitea Release / Prepare draft Release (push) Failing after 8s
Gitea Release / Upload Android to draft Release (push) Skipped
Gitea Release / Upload Windows to draft Release (push) Skipped
Gitea Release / Verify and publish Release (push) Skipped

This commit was merged in pull request #14.
This commit is contained in:
lingjhf committed 2026-10-11 19:59:40 +00:00
1 parent abc1868550
commit 06f1c26681
452 files changed
+43806 -2329

No files matched your search

@@ -19,6 +19,8 @@ class PropertyNumberInput extends StatefulWidget {
this.inlineLabel = false,
this.prefix,
this.prefixIcon,
this.prefixQuarterTurns = 0,
this.valueText,
this.labelActions = const [],
this.decimalPlaces = 2,
this.onScrubStart,
@@ -33,6 +35,8 @@ class PropertyNumberInput extends StatefulWidget {
final bool inlineLabel;
final String? prefix;
final IconData? prefixIcon;
final int prefixQuarterTurns;
final String? valueText;
final List<Widget> labelActions;
final int decimalPlaces;
final bool Function()? onScrubStart;
@@ -50,11 +54,12 @@ class PropertyNumberInput extends StatefulWidget {
}
class _PropertyNumberInputState extends State<PropertyNumberInput> {
late final _text = TextEditingController(text: _format(widget.value));
late final _text = TextEditingController(text: _displayValue);
final _focus = FocusNode();
bool _dirty = false;
late final _operations = OperationScope<Object>(widget.editContext);
String? _error;
String get _displayValue => widget.valueText ?? _format(widget.value);
String _format(double value) {
var text = value.toStringAsFixed(widget.decimalPlaces);
if (text.contains('.')) text = text.replaceFirst(RegExp(r'\.?0+$'), '');
@@ -84,7 +89,7 @@ class _PropertyNumberInputState extends State<PropertyNumberInput> {
if (!mounted || !isCurrent()) return;
setState(() {
_error = accepted ? null : context.l10n.notApplied;
_text.text = _format(widget.value);
_text.text = _displayValue;
});
}
@@ -98,7 +103,7 @@ class _PropertyNumberInputState extends State<PropertyNumberInput> {
_dirty = false;
_error = null;
}
final text = _format(widget.value);
final text = _displayValue;
// A no-op assignment still resets selection and asks EditableText to
// reveal its caret, competing with the user's scroll on preview updates.
if (!_dirty && _text.text != text) _text.text = text;
@@ -115,8 +120,8 @@ class _PropertyNumberInputState extends State<PropertyNumberInput> {
@override
Widget build(BuildContext context) {
final labelAbove =
AppTheme.isCompactInspector(context) && !widget.inlineLabel;
final compact = AppTheme.isCompactInspector(context);
final labelAbove = compact && !widget.inlineLabel;
final label = widget.onScrubStart == null
? Text(widget.label ?? '', style: AppTheme.propertyLabelStyle(context))
: AppScrubLabel(
@@ -126,7 +131,7 @@ class _PropertyNumberInputState extends State<PropertyNumberInput> {
? AppTheme.propertySectionTitleStyle(context)
: null,
alignment: labelAbove ? Alignment.centerLeft : Alignment.center,
padding: labelAbove
padding: labelAbove || compact
? EdgeInsets.zero
: const EdgeInsets.symmetric(horizontal: AppSpacing.small),
enabled: widget.enabled && (!widget.readOnly || widget.scrubbing),
@@ -134,7 +139,7 @@ class _PropertyNumberInputState extends State<PropertyNumberInput> {
_operations.invalidate();
_dirty = false;
_error = null;
_text.text = _format(widget.value);
_text.text = _displayValue;
return widget.onScrubStart!();
},
onUpdate: widget.onScrubUpdate,
@@ -154,7 +159,17 @@ class _PropertyNumberInputState extends State<PropertyNumberInput> {
label: widget.label,
labelAbove: labelAbove,
labelActions: widget.labelActions,
leading: widget.onScrubStart == null ? null : label,
leading: widget.onScrubStart == null
? null
: compact && !labelAbove
? SizedBox(
width: AppInspectorMetrics.action,
child: RotatedBox(
quarterTurns: widget.prefixQuarterTurns,
child: label,
),
)
: label,
unit: widget.unit,
errorText: _error,
onChanged: (_) {
@@ -173,7 +188,7 @@ class _PropertyNumberInputState extends State<PropertyNumberInput> {
_operations.invalidate();
_dirty = false;
_error = null;
_text.text = _format(widget.value);
_text.text = _displayValue;
});
_focus.unfocus();
return KeyEventResult.handled;