Flutter Can not focus on the TextField after navigation

The reason: The widget will rebuild when focus lost or in focus. If you declare request focus in new to hide the keyboard in widget build method, when you click on Textfield, keyboard shows and widget build method will be called, in build method you call request hide keyboard then the loop occurs.

The focus issues just happen if the current screen navigated by MaterialPageRoute with Navigator. If you start screen at home in main.dart, the focus issues will not happen. That’s weird. @@

Just remove in the base widget, just call it in trigger function like on tab or pressed


Leave a Reply

Your email address will not be published.Required fields are marked *