mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-07-22 22:20:43 -04:00
attempt to deal with focus problem in developer page
This commit is contained in:
parent
db61908d09
commit
933a22122a
1 changed files with 17 additions and 12 deletions
|
@ -21,7 +21,7 @@ import '../../tools/tools.dart';
|
||||||
import 'history_text_editing_controller.dart';
|
import 'history_text_editing_controller.dart';
|
||||||
|
|
||||||
final globalDebugTerminal = Terminal(
|
final globalDebugTerminal = Terminal(
|
||||||
maxLines: 50000,
|
maxLines: 10000,
|
||||||
);
|
);
|
||||||
|
|
||||||
const kDefaultTerminalStyle = TerminalStyle(
|
const kDefaultTerminalStyle = TerminalStyle(
|
||||||
|
@ -187,6 +187,15 @@ class _DeveloperPageState extends State<DeveloperPage> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> _onSubmitCommand(String debugCommand) async {
|
||||||
|
final ok = await _sendDebugCommand(debugCommand);
|
||||||
|
if (ok) {
|
||||||
|
setState(() {
|
||||||
|
_historyController.submit(debugCommand);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final theme = Theme.of(context);
|
final theme = Theme.of(context);
|
||||||
|
@ -282,16 +291,17 @@ class _DeveloperPageState extends State<DeveloperPage> {
|
||||||
textStyle: kDefaultTerminalStyle,
|
textStyle: kDefaultTerminalStyle,
|
||||||
controller: _terminalController,
|
controller: _terminalController,
|
||||||
keyboardType: TextInputType.none,
|
keyboardType: TextInputType.none,
|
||||||
//autofocus: true,
|
|
||||||
backgroundOpacity: _showEllet ? 0.75 : 1.0,
|
backgroundOpacity: _showEllet ? 0.75 : 1.0,
|
||||||
onSecondaryTapDown: (details, offset) async {
|
onSecondaryTapDown: (details, offset) async {
|
||||||
await copySelection(context);
|
await copySelection(context);
|
||||||
})
|
})
|
||||||
]).expanded(),
|
]).expanded(),
|
||||||
TextField(
|
TextFormField(
|
||||||
enabled: !_busy,
|
enabled: !_busy,
|
||||||
|
autofocus: true,
|
||||||
controller: _historyController.controller,
|
controller: _historyController.controller,
|
||||||
focusNode: _historyController.focusNode,
|
focusNode: _historyController.focusNode,
|
||||||
|
textInputAction: TextInputAction.send,
|
||||||
onTapOutside: (event) {
|
onTapOutside: (event) {
|
||||||
FocusManager.instance.primaryFocus?.unfocus();
|
FocusManager.instance.primaryFocus?.unfocus();
|
||||||
},
|
},
|
||||||
|
@ -323,7 +333,7 @@ class _DeveloperPageState extends State<DeveloperPage> {
|
||||||
final debugCommand =
|
final debugCommand =
|
||||||
_historyController.controller.text;
|
_historyController.controller.text;
|
||||||
_historyController.controller.clear();
|
_historyController.controller.clear();
|
||||||
await _sendDebugCommand(debugCommand);
|
await _onSubmitCommand(debugCommand);
|
||||||
},
|
},
|
||||||
)),
|
)),
|
||||||
onChanged: (_) {
|
onChanged: (_) {
|
||||||
|
@ -334,17 +344,12 @@ class _DeveloperPageState extends State<DeveloperPage> {
|
||||||
_historyController.controller.clearComposing();
|
_historyController.controller.clearComposing();
|
||||||
// don't give up focus though
|
// don't give up focus though
|
||||||
},
|
},
|
||||||
onSubmitted: (debugCommand) async {
|
onFieldSubmitted: (debugCommand) async {
|
||||||
if (debugCommand.isEmpty) {
|
if (debugCommand.isEmpty) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
await _onSubmitCommand(debugCommand);
|
||||||
final ok = await _sendDebugCommand(debugCommand);
|
_historyController.focusNode.requestFocus();
|
||||||
if (ok) {
|
|
||||||
setState(() {
|
|
||||||
_historyController.submit(debugCommand);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
).paddingAll(4)
|
).paddingAll(4)
|
||||||
])));
|
])));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue