a workaround of issue #2886, following the behavior address input of

chrome
This commit is contained in:
rustdesk 2023-01-30 18:30:38 +08:00
parent f4d0305242
commit 87de9eb726
2 changed files with 6 additions and 1 deletions

View File

@ -419,7 +419,10 @@ class _PeerSearchBarState extends State<PeerSearchBar> {
Widget _buildSearchBar() { Widget _buildSearchBar() {
RxBool focused = false.obs; RxBool focused = false.obs;
FocusNode focusNode = FocusNode(); FocusNode focusNode = FocusNode();
focusNode.addListener(() => focused.value = focusNode.hasFocus); focusNode.addListener(() {
focused.value = focusNode.hasFocus;
peerSearchTextController.selection = TextSelection(baseOffset: 0, extentOffset: peerSearchTextController.value.text.length);
});
return Container( return Container(
width: 120, width: 120,
decoration: BoxDecoration( decoration: BoxDecoration(

View File

@ -64,6 +64,8 @@ class _ConnectionPageState extends State<ConnectionPage>
}); });
_idFocusNode.addListener(() { _idFocusNode.addListener(() {
_idInputFocused.value = _idFocusNode.hasFocus; _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);
}); });
windowManager.addListener(this); windowManager.addListener(this);
} }