console fix
This commit is contained in:
parent
0e08b591b7
commit
768179ab24
1 changed files with 13 additions and 11 deletions
|
@ -117,7 +117,7 @@ class _SerialDetailPageState extends State<SerialDetailPage> {
|
||||||
serial.sprintln(_textController.text);
|
serial.sprintln(_textController.text);
|
||||||
_messages.add(_textController.text);
|
_messages.add(_textController.text);
|
||||||
messageIndex = _messages.length;
|
messageIndex = _messages.length;
|
||||||
_textController.clear();
|
_textController.text = "";
|
||||||
});
|
});
|
||||||
_textFocus.requestFocus();
|
_textFocus.requestFocus();
|
||||||
}
|
}
|
||||||
|
@ -127,26 +127,28 @@ class _SerialDetailPageState extends State<SerialDetailPage> {
|
||||||
if (event.runtimeType.toString() == 'RawKeyDownEvent') {
|
if (event.runtimeType.toString() == 'RawKeyDownEvent') {
|
||||||
if (event.logicalKey == LogicalKeyboardKey.arrowUp) {
|
if (event.logicalKey == LogicalKeyboardKey.arrowUp) {
|
||||||
if (messageIndex > 0) {
|
if (messageIndex > 0) {
|
||||||
setState(() {
|
|
||||||
messageIndex--;
|
messageIndex--;
|
||||||
print("up: " + _messages[messageIndex]);
|
Future.delayed(const Duration(microseconds: 10), () {
|
||||||
_textController.text = _messages[messageIndex];
|
_textController.text = _messages[messageIndex];
|
||||||
|
_textController.selection =
|
||||||
|
TextSelection.collapsed(offset: _textController.text.length);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else if (event.logicalKey == LogicalKeyboardKey.arrowDown) {
|
} else if (event.logicalKey == LogicalKeyboardKey.arrowDown) {
|
||||||
if (messageIndex >= _messages.length - 1) {
|
if (messageIndex >= _messages.length - 1) {
|
||||||
setState(() {
|
setState(() {
|
||||||
print("clear");
|
|
||||||
messageIndex = _messages.length;
|
messageIndex = _messages.length;
|
||||||
_textController.clear();
|
Future.delayed(const Duration(microseconds: 10), () {
|
||||||
_textFocus.requestFocus();
|
_textController.text = "";
|
||||||
|
_textController.selection = const TextSelection.collapsed(offset: 0);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setState(() {
|
|
||||||
messageIndex++;
|
messageIndex++;
|
||||||
print("down: " + _messages[messageIndex]);
|
Future.delayed(const Duration(microseconds: 10), () {
|
||||||
_textController.text = _messages[messageIndex];
|
_textController.text = _messages[messageIndex];
|
||||||
_textFocus.requestFocus();
|
_textController.selection =
|
||||||
|
TextSelection.collapsed(offset: _textController.text.length);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue