【发布时间】:2020-12-30 16:55:20
【问题描述】:
我有一个这样的身份验证屏幕:
@override
Widget build(BuildContext context) {
final bottom = MediaQuery.of(context).viewInsets.bottom;
return Scaffold(
resizeToAvoidBottomInset: false,
resizeToAvoidBottomPadding: false,
body: SingleChildScrollView(
reverse: true,
child: Padding(
padding: EdgeInsets.only(bottom: bottom),
child: Column(
children: <Widget>[
SizedBox(height: 48),
Image.asset(
"assets/images/logo.png",
width: 132,
),
SizedBox(height: 48),
Form(
child: Column(
children: <Widget>[
AuthTextFormField(
icon: Icons.email_outlined,
labelText: 'Email',
keyboardType: TextInputType.emailAddress,
),
AuthTextFormField(
icon: Icons.lock_outline,
labelText: 'Password',
obscureText: true,
),
],
),
),
],
),
),
),
);
}
我已经关注了这个answer,但它仍然对我不起作用。键盘仍然覆盖了文本字段。有什么想法吗?
谢谢。
【问题讨论】:
-
你能显示该文件的完整代码,以及你的屏幕输出吗?
-
@Mukul 这就是文件,它只是没有任何逻辑的无状态小部件。我已经更新了截图
-
请检查我的代码,我对您的代码做了一些小改动,对我来说效果很好。
-
我已经复制粘贴了你的代码,但它仍然不适合我
-
尝试删除 resizeToAvoidBottomInset: false, resizeToAvoidBottomPadding: false,这些行并反过来注释:SingleChildScrollView 的 true
标签: flutter keyboard textformfield