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);
|
||||
_messages.add(_textController.text);
|
||||
messageIndex = _messages.length;
|
||||
_textController.clear();
|
||||
_textController.text = "";
|
||||
});
|
||||
_textFocus.requestFocus();
|
||||
}
|
||||
|
@ -127,26 +127,28 @@ class _SerialDetailPageState extends State<SerialDetailPage> {
|
|||
if (event.runtimeType.toString() == 'RawKeyDownEvent') {
|
||||
if (event.logicalKey == LogicalKeyboardKey.arrowUp) {
|
||||
if (messageIndex > 0) {
|
||||
setState(() {
|
||||
messageIndex--;
|
||||
print("up: " + _messages[messageIndex]);
|
||||
Future.delayed(const Duration(microseconds: 10), () {
|
||||
_textController.text = _messages[messageIndex];
|
||||
_textController.selection =
|
||||
TextSelection.collapsed(offset: _textController.text.length);
|
||||
});
|
||||
}
|
||||
} else if (event.logicalKey == LogicalKeyboardKey.arrowDown) {
|
||||
if (messageIndex >= _messages.length - 1) {
|
||||
setState(() {
|
||||
print("clear");
|
||||
messageIndex = _messages.length;
|
||||
_textController.clear();
|
||||
_textFocus.requestFocus();
|
||||
Future.delayed(const Duration(microseconds: 10), () {
|
||||
_textController.text = "";
|
||||
_textController.selection = const TextSelection.collapsed(offset: 0);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
messageIndex++;
|
||||
print("down: " + _messages[messageIndex]);
|
||||
Future.delayed(const Duration(microseconds: 10), () {
|
||||
_textController.text = _messages[messageIndex];
|
||||
_textFocus.requestFocus();
|
||||
_textController.selection =
|
||||
TextSelection.collapsed(offset: _textController.text.length);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue