better editor

This commit is contained in:
hiddify-com
2024-07-30 21:20:48 +02:00
parent 7decb991a7
commit 5e6005fc57
4 changed files with 33 additions and 25 deletions

View File

@@ -965,7 +965,7 @@ class _ReplaceTextWithFieldState extends State<_ReplaceTextWithField> {
Widget wrapWithColoredBox(String keyName) {
if (widget.isHighlighted) {
return ColoredBox(
color: Colors.amber,
color: Theme.of(context).colorScheme.errorContainer,
child: Text(keyName, style: _textStyle),
);
}
@@ -993,7 +993,7 @@ class _ReplaceTextWithFieldState extends State<_ReplaceTextWithField> {
} else if (widget.initialValue is num) {
_constraints = const BoxConstraints(minWidth: 20, maxWidth: 80);
} else {
_constraints = const BoxConstraints(minWidth: 20, maxWidth: 200);
_constraints = const BoxConstraints(minWidth: 20, maxWidth: 400);
}
_focusNode.addListener(handleChange);
@@ -1059,8 +1059,8 @@ class _ReplaceTextWithFieldState extends State<_ReplaceTextWithField> {
});
_focusNode.requestFocus();
},
mouseCursor: MaterialStateMouseCursor.textable,
child: widget.initialValue is String && _text.isEmpty ? const SizedBox(width: 200, height: 18) : wrapWithColoredBox(_text),
mouseCursor: WidgetStateMouseCursor.textable,
child: widget.initialValue is String && _text.isEmpty ? const SizedBox(width: 400, height: 18) : wrapWithColoredBox(_text),
);
}
}
@@ -1229,6 +1229,7 @@ class _SearchField extends StatelessWidget {
TextField(
onChanged: onChanged,
autocorrect: false,
autofocus: true,
cursorWidth: 1,
// style: _textStyle,
cursorHeight: 12,

View File

@@ -86,6 +86,10 @@ class ProfileDetailsNotifier extends _$ProfileDetailsNotifier with AppLogger {
String? configContent,
}) {
if (state case AsyncData(:final value)) {
final configContentChanged = value.configContentChanged || value.configContent != configContent;
// if (!configContentChanged) {
// return;
// }
state = AsyncData(
value.copyWith(
profile: value.profile.map(
@@ -103,7 +107,7 @@ class ProfileDetailsNotifier extends _$ProfileDetailsNotifier with AppLogger {
),
local: (lp) => lp.copyWith(name: name ?? lp.name),
),
configContentChanged: value.configContentChanged || value.configContent != configContent,
configContentChanged: configContentChanged,
configContent: configContent ?? value.configContent,
),
);