Flutter / Android - moving focus from a TextField to a DropdownButton

后端 未结 3 1125
醉梦人生
醉梦人生 2021-02-14 14:35

I have a textfield and a dropdownbutton on a screen. When I move from the textfield to choose an item and then back to the textfield I find this a little bit awkward.

3条回答
  •  猫巷女王i
    2021-02-14 14:52

    @Dithest answer is correct but one problem still in this use case is when user tap outside of drop down menu then text field refocus and keyboard open . My work around of this issue is to add following code as well in onTap Listener of DropDownButton

    FocusScope.of(context).requestFocus(new FocusNode());///It will clear all focus of the textfield

提交回复
热议问题