Merge pull request #6166 from sahilyeole/feat/autocomplete
Fix ID text field ui not updating on peer card connection
This commit is contained in:
commit
00ab830ad1
@ -2024,6 +2024,10 @@ connect(
|
||||
final idController = Get.find<IDTextEditingController>();
|
||||
idController.text = formatID(id);
|
||||
}
|
||||
if (Get.isRegistered<TextEditingController>()){
|
||||
final fieldTextEditingController = Get.find<TextEditingController>();
|
||||
fieldTextEditingController.text = formatID(id);
|
||||
}
|
||||
} catch (_) {}
|
||||
}
|
||||
id = id.replaceAll(' ', '');
|
||||
|
@ -81,6 +81,9 @@ class _ConnectionPageState extends State<ConnectionPage>
|
||||
if (Get.isRegistered<IDTextEditingController>()) {
|
||||
Get.delete<IDTextEditingController>();
|
||||
}
|
||||
if (Get.isRegistered<TextEditingController>()){
|
||||
Get.delete<TextEditingController>();
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@ -235,6 +238,7 @@ class _ConnectionPageState extends State<ConnectionPage>
|
||||
VoidCallback onFieldSubmitted,
|
||||
) {
|
||||
fieldTextEditingController.text = _idController.text;
|
||||
Get.put<TextEditingController>(fieldTextEditingController);
|
||||
fieldFocusNode.addListener(() async {
|
||||
_idInputFocused.value = fieldFocusNode.hasFocus;
|
||||
if (fieldFocusNode.hasFocus && !isPeersLoading){
|
||||
@ -271,18 +275,6 @@ class _ConnectionPageState extends State<ConnectionPage>
|
||||
onChanged: (v) {
|
||||
_idController.id = v;
|
||||
},
|
||||
onSubmitted: (s) {
|
||||
if (s == '') {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
final id = int.parse(s);
|
||||
_idController.id = s;
|
||||
onConnect();
|
||||
} catch (_) {
|
||||
return;
|
||||
}
|
||||
},
|
||||
));
|
||||
},
|
||||
optionsViewBuilder: (BuildContext context, AutocompleteOnSelected<Peer> onSelected, Iterable<Peer> options) {
|
||||
|
Loading…
Reference in New Issue
Block a user