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>();
|
final idController = Get.find<IDTextEditingController>();
|
||||||
idController.text = formatID(id);
|
idController.text = formatID(id);
|
||||||
}
|
}
|
||||||
|
if (Get.isRegistered<TextEditingController>()){
|
||||||
|
final fieldTextEditingController = Get.find<TextEditingController>();
|
||||||
|
fieldTextEditingController.text = formatID(id);
|
||||||
|
}
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
}
|
}
|
||||||
id = id.replaceAll(' ', '');
|
id = id.replaceAll(' ', '');
|
||||||
|
@ -81,6 +81,9 @@ class _ConnectionPageState extends State<ConnectionPage>
|
|||||||
if (Get.isRegistered<IDTextEditingController>()) {
|
if (Get.isRegistered<IDTextEditingController>()) {
|
||||||
Get.delete<IDTextEditingController>();
|
Get.delete<IDTextEditingController>();
|
||||||
}
|
}
|
||||||
|
if (Get.isRegistered<TextEditingController>()){
|
||||||
|
Get.delete<TextEditingController>();
|
||||||
|
}
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,6 +238,7 @@ class _ConnectionPageState extends State<ConnectionPage>
|
|||||||
VoidCallback onFieldSubmitted,
|
VoidCallback onFieldSubmitted,
|
||||||
) {
|
) {
|
||||||
fieldTextEditingController.text = _idController.text;
|
fieldTextEditingController.text = _idController.text;
|
||||||
|
Get.put<TextEditingController>(fieldTextEditingController);
|
||||||
fieldFocusNode.addListener(() async {
|
fieldFocusNode.addListener(() async {
|
||||||
_idInputFocused.value = fieldFocusNode.hasFocus;
|
_idInputFocused.value = fieldFocusNode.hasFocus;
|
||||||
if (fieldFocusNode.hasFocus && !isPeersLoading){
|
if (fieldFocusNode.hasFocus && !isPeersLoading){
|
||||||
@ -271,18 +275,6 @@ class _ConnectionPageState extends State<ConnectionPage>
|
|||||||
onChanged: (v) {
|
onChanged: (v) {
|
||||||
_idController.id = 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) {
|
optionsViewBuilder: (BuildContext context, AutocompleteOnSelected<Peer> onSelected, Iterable<Peer> options) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user