When the keyboard appears, the Flutter widgets resize. How to prevent this?

后端 未结 9 1299
灰色年华
灰色年华 2020-12-02 05:51

I have a Column of Expanded widgets like this:

 return new Container(
      child: new Column(
        crossAxisAlignment: CrossAxisAlignment.stretch,
               


        
9条回答
  •  执念已碎
    2020-12-02 06:24

    Well I think if we implement @Aman's solution it will make our app behaves ugly as when the keyboard appears, it will not adjust our viewport of the screen as per available height and it will make out other fields hide behind the keyboard. So I would suggest useSingleChildScrollView instead.

    Wrap your code with SingleChildScrollView as given below,

     return new Container(
      child: SingleChildScrollView(
        child: new Column(
        crossAxisAlignment: CrossAxisAlignment.stretch,
        children: [
          new Expanded(
            flex: 1,
            child: convertFrom,
          ),
          new Expanded(
            flex: 1,
            child: convertTo,
          ),
          new Expanded(
            flex: 1,
            child: description,
          ),
        ],
      ),
     ),
    );
    

提交回复
热议问题