Ste*_*pan 9 android android-edittext dart flutter
我在应用程序中有一些登录页面.但是,当我专注于TextFormField时,键盘覆盖字段并且看不到任何内容.作为Android开发者,
我通常通过添加android:windowSoftInputMode="adjustResize|stateHidden
到清单来修复它.
如何在Flutter中解决它?
码:
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: ListView(
children: <Widget>[
Center(child: Image(image: AssetImage("images/uhk.jpg"))),
Form(
key: formKey,
child: Padding(
padding: EdgeInsets.only(top: 20.0, left: 30.0, right: 30.0),
child: Column(
children: <Widget>[
TextFormField(
decoration:
new InputDecoration(labelText: "P?ihlašovací jméno"),
maxLines: 1,
keyboardType: TextInputType.emailAddress,
onSaved: (String value) => ""),
TextFormField(
decoration: new InputDecoration(labelText: "Heslo"),
maxLines: 1,
obscureText: true,
onSaved: (String value) => ""),
],
),
),
),
Padding(
padding: EdgeInsets.only(top: 50.0, left: 30.0, right: 30.0),
child: RaisedButton(
child: Text("P?ihlásit se",
style: TextStyle(
fontSize: 16.0, color: Colors.white, height: 3.0)),
color: Colors.lightBlue,
onPressed: () => "")),
Padding(
padding: EdgeInsets.only(
top: 20.0,
),
child: Center(
child: FlatButton(
onPressed: () => "",
child: Text("Vytvo?it ú?et",
style: TextStyle(fontSize: 14.0, color: Colors.grey)),
))),
],
),
}
Run Code Online (Sandbox Code Playgroud)
//Add this line "resizeToAvoidBottomInset: true," to your Scaffold and put your main container in ScrollView.
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: true,
key: _scaffoldKey,
backgroundColor: Colors.white,
body: SingleChildScrollView(
child: Container()
),
);
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2190 次 |
最近记录: |