flutter调出键盘报错溢出异常:bottom overflowed by 104 PIXELS

如题,在做登录时,点击输入用户名的输入框,唤起键盘报错溢出BUG:bottom overflowed by 104 PIXELS。

报错时直接使用的Scaffold布局,在body中创建Column。出错误代码:

return new Scaffold(
      appBar: new AppBar(
        title: new Text("搜索"),
      ),
      //使用ScrollView包装一下,否则键盘弹出时会报错空间溢出
      body: new Column( ... )
            ),
          ),
 );

解决办法是使用SingleChildScrollView包装一下:

return new Scaffold(
      appBar: new AppBar(
        title: new Text("搜索"),
      ),
      //使用ScrollView包装一下,否则键盘弹出时会报错空间溢出
      body: new SingleChildScrollView(
            child: new ConstrainedBox(
              constraints: new BoxConstraints(
                minHeight: 120.0,
              ),
              child: new Column(
                mainAxisSize: MainAxisSize.min,
                mainAxisAlignment: MainAxisAlignment.spaceAround,
                children: <Widget>[
                  new Padding(
                    padding: EdgeInsets.fromLTRB(0.0, 40.0, 0.0, 10.0),
                    child:new Text("注意",style: new TextStyle(fontSize: 18.0,color: Colors.orangeAccent),),
                  ),
                ],
              ),
            ),
          ),
    );

原文链接:https://www.choupangxia.com/topic/detail/93

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

程序新视界

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值