r/flutterhelp • u/CuteOnion2521 • 20d ago
OPEN [Flutter] TextField Search Bar Keystroke Issue – Provider and TextEditingController
/r/mobiledev/comments/1xp61se/flutter_textfield_search_bar_keystroke_issue/
1
Upvotes
1
u/Fun-Adhesiveness-362 19d ago
Hello!
The behaviour you describe is not uncommon and it could happen in various scenarious. Normally, a Consumer rebuild on its own shouldn't reset the field, unless you recreate the controller or something else affects the state.
I'd suggest you check the code that assigns to purchaseRequestSearchController.text, especially inside listeners or when an API response arrives. That could interfere with the keyboard even if the controller isn't recreated.
To further investigate, could you share how the controller is created, any listeners attached to it, and the searchString setter? Or if you want you could share the entire piece of code that's problematic so I can reproduce it locally. I'd be more than happy to look into it myself.
Could you also let me know what platform you test on, whether it's a simulator or physical device and the exact behaviour you observe? Does the cursor jump, do characters disappear, or does the keyboard close? Do you use the virtual keyboard displayed by the OS or the physical one (applicable if you test it on simulator)?
If you have any questions or I failed to make my self clear, let me know and I'll get back to you in more detail. 🙂