我建立了一个登录页面,其中包含一个带有两个扩展子元素的股票小部件 第一个扩展具有用户名,密码文本字段和登录按钮,第二个扩展具有注册和忘记密码按钮 发生的事情是,当键盘打开时,第二个扩展出现在键盘上方,并且文本字段并未全部显示在屏幕上
body: GestureDetector(
onTap: (){
FocusScope.of(context).requestFocus(new FocusNode());
},
child: Container(
child: Column(
children: <Widget>[
Expanded(
flex: 3,
child: Form(
key: _formKey,
child: ListView(
shrinkWrap: true,
padding: EdgeInsets.only(left: 24.0, right: 24.0),
children: <Widget>[
SizedBox(
height: spaces,
),
loginImage,
SizedBox(
height: spaces,
),
buildUsernameTextField(),
SizedBox(
height: spaces,
),
buildPasswordTextField(),
SizedBox(
height: spaces,
),
login(),
],
),
),
),
Expanded(
flex: 1,
child: Container(
decoration: BoxDecoration(
boxShadow: [
new BoxShadow(
color: Colors.black45,
offset: Offset(0.0, -6.0),
blurRadius: 10.0,
),
],
borderRadius: BorderRadius.only(
topLeft: Radius.circular(55),
topRight: Radius.circular(55)),
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
const Color(0xFFFF215490),
const Color(0xFFFF010431)
],
tileMode: TileMode.clamp)),
child: ListView(
shrinkWrap: true,
padding: EdgeInsets.only(left: 24, right: 24),
children: <Widget>[
SizedBox(
height: spaces,
),
signup(),
forgetPassword(),
//_buildPasswordTextField(),
],
),
),
),
],
),
),
),
);
如何解决?
答案 0 :(得分:0)
如果没有,请尝试以下操作:
Scaffold(
resizeToAvoidBottomInset: false,
),
我已经尝试过了,它可以正常工作,我无法想象为什么它冻结了屏幕