flutter 输入法键盘弹出报错 bottom overflowed by 200 pixels
·
在Scaffold中使用了Column组件,在移动端调出键盘时,报溢出异常问题。
解决方式:
- 给Scaffold 添加如下属性
// 用来防止软键盘弹出时遮挡页面的东西。值默认为 true。
// 当设置为 true 的时候,软键盘弹出页面会自动调整尺寸避免遮挡;
// 当为 false 的时候则软键盘弹出不会自动调整尺寸。
resizeToAvoidBottomInset:false
- body中的内容使用SingleChildScrollView包一下
body: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
_loginTitle(),
Container(
height: 400,
margin: const EdgeInsets.fromLTRB(20, 10, 20, 10),
decoration: const BoxDecoration(
color: AppColors.white,
borderRadius: BorderRadius.all(Radius.circular(8)),
),
child: Stack(
children: [
Column(
children: [
_textFiled(),
_autoLogin(),
_loginButton(),
_privacy(),
],
),
],
),
),
],
),
),
感谢:
flutter - 调出键盘报错溢出异常:bottom overflowed by 80 pixels
Flutter问题:bottom overflowed by 94 pixels
更多推荐
所有评论(0)