Flutter TextEditingController does not scroll above keyboard

后端 未结 4 1632
难免孤独
难免孤独 2021-02-09 19:42

In android version, Flutter TextEditingController does not scroll above keyboard like default text fields do when you start typing in field. I tried to look in sample apps provi

4条回答
  •  北海茫月
    2021-02-09 20:23

    Thank you all for the helpful answers @user2785693 pointed in the right direction.
    I found complete working solution here: here

    Issue with just using scroll or focusNode.listner is, it was working only if I focus on textbox for the first time, but if I minimize the keyboard and again click on same text box which already had focus, the listner callback was not firing, so the auto scroll code was not running. Solution was to add "WidgetsBindingObserver" to state class and override "didChangeMetrics" function.

    Hope this helps others to make Flutter forms more user friendly.

提交回复
热议问题