When I select a Textfield the keyboard moves over it

后端 未结 10 699
渐次进展
渐次进展 2020-12-03 05:51

When i select a Textfield, the keyboard is going to be shown but the keyboard hide my selected TextField. Does someone have a solution?

10条回答
  •  南方客
    南方客 (楼主)
    2020-12-03 06:44

    A pretty short way to realize this is by simply using a MediaQuery for getting the bottom view insets. This would look as follows:

    ...
    return Row(
      children: [
        TextField(
          decoration: InputDecoration.collapsed(hintText: "Start typing ..."),
          controller: _chatController,
        ),
        SizedBox(
          height: MediaQuery.of(Context).viewInsets.bottom,
        ),
      ],
    );
    ...
    

    Hope it helps!

提交回复
热议问题