Flutter TextField autocomplete overlay

前端 未结 4 1001
梦谈多话
梦谈多话 2021-02-07 15:14

I am struggling to create TextField with autocomplete overlay. I have form with TextFields and I want to display suggestions based on what is typed in TextField.

Someth

4条回答
  •  忘了有多久
    2021-02-07 15:53

    I would probably have a Container with a fixed height, containing a Column with its crossAxisAlignment set to stretch. The first child in the column would be the text field. The second would be an Expanded containing a ListView with a custom delegate to provide the children. Then, as the data in the text field changes, you update the delegate so that the children are updated. Each child would be a ListTile containing an InkWell which, when tapped, fills the text field appropriately.

提交回复
热议问题