基本上我有一个登录页面,我首先进入2个容器,其中一个覆盖55%和45%的屏幕。然后在这两个容器的顶部,我添加了一个容器,其中屏幕大小的前40%,并且在其中我还有一个容器,其中包含我的用户名和密码文本字段。所以在设计方面我很好。
现在键盘出现密码字段的问题完全不可见。首先我只是堆栈然后我做谷歌和一些建议把脚手架和添加此行resizeToAvoidBottomPadding:false,但似乎也不适合我。
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomPadding: false,
body: Container(
child: Stack(
children: <Widget>[
// The containers in the background
new Column(
children: <Widget>[
new Container(
height: MediaQuery.of(context).size.height * .55,
//color: Colors.blue,
decoration: new BoxDecoration(
image: new DecorationImage(image: new AssetImage("lib/assets/cbg.png"), fit: BoxFit.cover,),
),
),
new Container(
height: MediaQuery.of(context).size.height * .45,
color: Colors.white,
)
],
),
// The card widget with top padding,
// incase if you wanted bottom padding to work,
// set the `alignment` of container to Alignment.bottomCenter
new Container(
alignment: Alignment.topCenter,
padding: new EdgeInsets.only(
top: MediaQuery.of(context).size.height * .40,
right: 20.0,
left: 20.0),
child: new Container(
height: MediaQuery.of(context).size.height * .45,
width: MediaQuery.of(context).size.width,
child: new Card(
color: Colors.white,
elevation: 4.0,
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 40.0),
child: Column(
children: <Widget>[
SizedBox(height: MediaQuery.of(context).size.height * .05),
new TextFormField(
decoration: new InputDecoration(
labelText: "Enter Email",
fillColor: Colors.white,
border: new OutlineInputBorder(
borderRadius: new BorderRadius.circular(10.0),
borderSide: new BorderSide(
color: Colors.blue
),
),
//fillColor: Colors.green
),
validator: (val) {
if(val.length==0) {
return "Email cannot be empty";
}else{
return null;
}
},
keyboardType: TextInputType.emailAddress,
style: new TextStyle(
fontFamily: "Poppins",
),
),
SizedBox(height: MediaQuery.of(context).size.height * .05),
new TextFormField(
decoration: new InputDecoration(
labelText: "Enter Password",
fillColor: Colors.white,
border: new OutlineInputBorder(
borderRadius: new BorderRadius.circular(10.0),
borderSide: new BorderSide(
),
),
//fillColor: Colors.green
),
validator: (val) {
if(val.length==0) {
return "Password cannot be empty";
}else{
return null;
}
},
keyboardType: TextInputType.emailAddress,
style: new TextStyle(
fontFamily: "Poppins",
),
),
],
),
)
),
),
),
new Container(
alignment: Alignment.topCenter,
padding: new EdgeInsets.only(
top: MediaQuery.of(context).size.height * .80,
right: 50.0,
left: 50.0),
child: new FlatButton(
color: Colors.red,
child: Text("Press Me"),
onPressed: () {},
),
),
new Container(
alignment: Alignment.topCenter,
padding: new EdgeInsets.only(
top: MediaQuery.of(context).size.height * .90,
right: 50.0,
left: 50.0),
child: new FlatButton(
color: Colors.red,
child: Text("Forgot Password ?"),
onPressed: () {},
),
)
],
)
)
);
}
}
更改后键盘仍然出现轻微覆盖文本字段。
我可以实现一些吗?
您应该将所有这些放在ListView中,然后当您打开键盘时,列表将向上滚动。
• 在flutter中,软键盘不会出现。相反,屏幕上出现了一个白屏
• Firebase 消息传递和位置包正在抛出:一些输入文件使用或覆盖已弃用的 API 警告,尽管已升级
• 如何在 Angular 中使用 Enter 键触发事件?
• Flutter bottomNavigationBar 在 systemNavigationBar 后面延伸
• Unity 新输入系统错误的显示名称与 AZERTY 键盘
• jquery position() 和 css position
• 使用锁是否可以缓解由 volatile 关键字处理的问题?
• LangChain 和 OpenAI 的问题 - 不可阻挡的 UnicodeEncodeError
• Android 上的 Angular:“下一步”按钮未聚焦自定义 ControlValueAccessor
• 谷歌了很多但无法弄清楚:MongoError: E11000 duplicate key error collection
• TypeError:无法读取 node.js 中未定义的属性(读取“split”)
• SwiftUI 向上移动键盘视图时如何修复不和谐的动画?
• org.springframework.orm.jpa.JpaSystemException:为:类oneToOne