fix text selection

Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>
This commit is contained in:
Sahil Yeole 2023-10-20 04:44:53 +05:30
parent e8c4615ff6
commit 00555a8e9e

View File

@ -287,15 +287,10 @@ class _ConnectionPageState extends State<ConnectionPage>
if (fieldFocusNode.hasFocus && !isPeersLoading){ if (fieldFocusNode.hasFocus && !isPeersLoading){
_fetchPeers(); _fetchPeers();
} }
// select all to facilitate removing text, just following the behavior of address input of chrome });
SchedulerBinding.instance.addPostFrameCallback((_) {
final textLength = fieldTextEditingController.value.text.length; final textLength = fieldTextEditingController.value.text.length;
Future.delayed(Duration(milliseconds: 150) , () { // select all to facilitate removing text, just following the behavior of address input of chrome
fieldTextEditingController.selection = TextSelection.collapsed(offset: textLength);
fieldTextEditingController.selection = TextSelection(baseOffset: 0, extentOffset: textLength); fieldTextEditingController.selection = TextSelection(baseOffset: 0, extentOffset: textLength);
});
});
});
return Obx(() => return Obx(() =>
TextField( TextField(
maxLength: 90, maxLength: 90,