attempt fix text selection
Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>
This commit is contained in:
parent
9e2c9cbba9
commit
149d57150c
@ -69,12 +69,6 @@ class _ConnectionPageState extends State<ConnectionPage>
|
|||||||
_updateTimer = periodic_immediate(Duration(seconds: 1), () async {
|
_updateTimer = periodic_immediate(Duration(seconds: 1), () async {
|
||||||
updateStatus();
|
updateStatus();
|
||||||
});
|
});
|
||||||
_idFocusNode.addListener(() {
|
|
||||||
_idInputFocused.value = _idFocusNode.hasFocus;
|
|
||||||
// select all to faciliate removing text, just following the behavior of address input of chrome
|
|
||||||
_idController.selection = TextSelection(
|
|
||||||
baseOffset: 0, extentOffset: _idController.value.text.length);
|
|
||||||
});
|
|
||||||
Get.put<IDTextEditingController>(_idController);
|
Get.put<IDTextEditingController>(_idController);
|
||||||
windowManager.addListener(this);
|
windowManager.addListener(this);
|
||||||
}
|
}
|
||||||
@ -289,14 +283,16 @@ class _ConnectionPageState extends State<ConnectionPage>
|
|||||||
VoidCallback onFieldSubmitted,
|
VoidCallback onFieldSubmitted,
|
||||||
) {
|
) {
|
||||||
fieldTextEditingController.text = _idController.text;
|
fieldTextEditingController.text = _idController.text;
|
||||||
fieldFocusNode.addListener(() {
|
fieldFocusNode.addListener(() async {
|
||||||
_idInputFocused.value = fieldFocusNode.hasFocus;
|
_idInputFocused.value = fieldFocusNode.hasFocus;
|
||||||
if (fieldFocusNode.hasFocus && !isPeersLoading){
|
if (fieldFocusNode.hasFocus && !isPeersLoading){
|
||||||
_fetchPeers();
|
_fetchPeers();
|
||||||
}
|
}
|
||||||
// select all to faciliate removing text, just following the behavior of address input of chrome
|
// select all to facilitate removing text, just following the behavior of address input of chrome
|
||||||
_idController.selection = TextSelection(
|
final textLength = fieldTextEditingController.value.text.length;
|
||||||
baseOffset: 0, extentOffset: _idController.value.text.length);
|
await Future.delayed(Duration(milliseconds: 200));
|
||||||
|
fieldTextEditingController.selection = TextSelection.collapsed(offset: textLength);
|
||||||
|
fieldTextEditingController.selection = TextSelection(baseOffset: 0, extentOffset: textLength);
|
||||||
});
|
});
|
||||||
return Obx(() =>
|
return Obx(() =>
|
||||||
TextField(
|
TextField(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user