Flutter TextEditingController does not scroll above keyboard

后端 未结 4 1631
难免孤独
难免孤独 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:17

    Flutter does not have such thing by default.

    Add your TextField in a ListView. create ScrollController and assign it to the ListView's controller.

    When you select the TextField, scroll the ListView using:

    controller.jumpTo(value);
    

    or if you wish to to have scrolling animation:

    controller.animateTo(offset, duration: null, curve: null);
    

    EDIT: Of course the duration and curve won't be null. I just copied and pasted it here.

提交回复
热议问题