Android SingleChildScrollView赢得';不行?当软键盘出现颤振时,如何调整布局?
我是个新手。键盘将出现,但布局不会调整大小以使其保持在视图中。我还检查了SingleChildScrollView,但不起作用。当软键盘出现颤振时,如何调整布局 这是我的班级:Android SingleChildScrollView赢得';不行?当软键盘出现颤振时,如何调整布局?,android,flutter,keyboard,singlechildscrollview,Android,Flutter,Keyboard,Singlechildscrollview,我是个新手。键盘将出现,但布局不会调整大小以使其保持在视图中。我还检查了SingleChildScrollView,但不起作用。当软键盘出现颤振时,如何调整布局 这是我的班级: return new Scaffold( resizeToAvoidBottomInset: false, backgroundColor: MyColors.gray_dark, appBar: PreferredSize(child: Container(),
return new Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: MyColors.gray_dark,
appBar:
PreferredSize(child: Container(), preferredSize: Size.fromHeight(0)),
body: Stack(
children: <Widget>[
Container(
child: Image.asset(
'assets/images/air_force_golden_jubilee_campus.jpeg',
fit: BoxFit.cover),
width: double.infinity,
height: double.infinity,
),
Container(color: MyColors.primaryDark.withOpacity(0.9)),
SingleChildScrollView(
child: Container(
padding: EdgeInsets.symmetric(vertical: 30, horizontal: 30),
width: double.infinity,
height: double.infinity,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(height: 30),
Text("Welcome!",
style: MyText.display2(context).copyWith(
color: Colors.white, fontFamily: MyFonts.openSansBold)),
Container(height: 5),
Text(schoolDetails.schoolName,
style: MyText.title(context).copyWith(
color: Colors.white,
fontWeight: FontWeight.w300,
fontFamily: MyFonts.openSansRegular)),
Container(height: 10),
Container(
width: 120,
height: 120,
child: Image.asset(
'assets/images/schools/air_force_bal_bharati_logo.png'),
),
Container(height: 10),
Container(height: 3, width: 40, color: Colors.white),
Container(height: 5),
Text("Log in",
style: MyText.medium(context).copyWith(
color: Colors.white,
fontWeight: FontWeight.bold,
fontFamily: MyFonts.openSansBold)),
SizedBox(),
TextField(
controller: nameController,
style: TextStyle(color: Colors.white),
keyboardType: TextInputType.number,
decoration: InputDecoration(
labelText: "USERNAME",
labelStyle: TextStyle(
color: Colors.white,
fontFamily: MyFonts.openSansRegular),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.white, width: 1),
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.white, width: 2),
),
),
),
Container(height: 25),
TextField(
style: TextStyle(color: Colors.white),
controller: passwordController,
keyboardType: TextInputType.text,
obscureText: _obscureText,
decoration: InputDecoration(
labelText: "PASSWORD",
labelStyle: TextStyle(
color: Colors.white,
fontFamily: MyFonts.openSansRegular),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.white, width: 1),
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.white, width: 2),
),
suffixIcon: GestureDetector(
onTap: () {
setState(() {
_obscureText = !_obscureText;
});
},
child: Icon(
_obscureText
? Icons.visibility
: Icons.visibility_off,
color: Colors.white),
)),
),
Container(height: 20),
FloatingActionButton(
heroTag: "fab",
elevation: 0,
backgroundColor: Colors.white,
child: Icon(Icons.chevron_right, color: Colors.cyan[800]),
onPressed: () {
/* Navigator.push(context, MaterialPageRoute(builder: (BuildContext context){
return DashboardRoute(schoolDetails);
//return NoticeType();
}));*/
// LoginData data = new LoginData.section("sahood@traxsmart.in", "abc@123ABC");
progressDialog.show();
LoginData data = new LoginData.section(
nameController.text, passwordController.text);
_signIn(data);
},
),
SizedBox(),
Container(
width: double.infinity,
child: FlatButton(
child: Text("forgot password?",
style: TextStyle(
color: Colors.white,
fontFamily: MyFonts.openSansRegular)),
color: Colors.transparent,
onPressed: () {
/* LoginData data = new LoginData.section("+919061855558", "abc@123ABC");
_registerUser(data);*/
// confirm();
Navigator.push(context,
MaterialPageRoute(builder: (BuildContext context) {
return ForgotPassword();
// return NoticeType();
}));
},
),
)
],
),
),
)
],
),
);
返回新脚手架(
resizeToAvoidBottomInset:false,
背景颜色:MyColors.gray\u深色,
appBar:
PreferredSize(子级:容器(),PreferredSize:Size.fromHeight(0)),
主体:堆栈(
儿童:[
容器(
子:Image.asset(
“资产/图像/air_force_golden_jubilee_campus.jpeg”,
安装:BoxFit.盖),
宽度:double.infinity,
高度:双无限,
),
容器(颜色:MyColors.primarydurk.withOpacity(0.9)),
SingleChildScrollView(
子:容器(
填充:边缘组。对称(垂直:30,水平:30),
宽度:double.infinity,
高度:双无限,
子:列(
mainAxisSize:mainAxisSize.min,
儿童:[
货柜(高度:30),
文本(“欢迎!”,
样式:MyText.display2(上下文).copyWith(
颜色:Colors.white,fontFamily:MyFonts.openSansBold),
货柜(高度:5),
Text(schoolDetails.schoolName,
样式:MyText.title(上下文).copyWith(
颜色:颜色,白色,
fontWeight:fontWeight.w300,
fontFamily:MyFonts.OpenFonts,
集装箱(高度:10),
容器(
宽度:120,
身高:120,
子:Image.asset(
“资产/图片/学校/空军”bal_bharati_logo.png“,
),
集装箱(高度:10),
容器(高度:3,宽度:40,颜色:彩色。白色),
货柜(高度:5),
文本(“登录”,
样式:MyText.medium(context.copyWith)(
颜色:颜色,白色,
fontWeight:fontWeight.bold,
fontFamily:MyFonts.openSansBold),
SizedBox(),
文本字段(
控制器:名称控制器,
样式:TextStyle(颜色:Colors.white),
键盘类型:TextInputType.number,
装饰:输入装饰(
labelText:“用户名”,
标签样式:文本样式(
颜色:颜色,白色,
fontFamily:MyFonts.openSansRegular),
enabledBorder:UnderlineInputBorder(
borderSide:borderSide(颜色:Colors.white,宽度:1),
),
FocusedOrder:下划线输入边框(
borderSide:borderSide(颜色:Colors.white,宽度:2),
),
),
),
货柜(高度:25),
文本字段(
样式:TextStyle(颜色:Colors.white),
控制器:密码控制器,
键盘类型:TextInputType.text,
蒙蔽文本:_蒙蔽文本,
装饰:输入装饰(
labelText:“密码”,
标签样式:文本样式(
颜色:颜色,白色,
fontFamily:MyFonts.openSansRegular),
enabledBorder:UnderlineInputBorder(
borderSide:borderSide(颜色:Colors.white,宽度:1),
),
FocusedOrder:下划线输入边框(
borderSide:borderSide(颜色:Colors.white,宽度:2),
),
后缀:手势检测器(
onTap:(){
设置状态(){
_蒙蔽文本=!\u蒙蔽文本;
});
},
子:图标(
_模糊文本
?图标。可见性
:Icons.visibility\u关闭,
颜色:颜色。白色),
)),
),
货柜(高度:20),
浮动操作按钮(
heroTag:“晶圆厂”,
海拔:0,
背景颜色:Colors.white,
子项:图标(Icons.chevron_right,color:Colors.cyan[800]),
已按下:(){
/*push(上下文,MaterialPage路由(生成器:(BuildContext){
返回仪表板路线(学校详细信息);
//returnnoticeType();
}));*/
//LoginData=新的LoginData.section(“sahood@traxsmart.in", "abc@123ABC");
progressDialog.show();
LoginData data=新LoginData.section(
nameController.text、passwordController.text);
_签名(数据);
},
),
SizedBox(),
容器(
宽度:double.infinity,
孩子:扁平按钮(
子项:文本(“忘记密码?”,
样式:TextStyle(
颜色:颜色,白色,
fontFamily:MyFonts.OpenFonts,
return new Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: MyColors.gray_dark,
appBar:
PreferredSize(child: Container(), preferredSize: Size.fromHeight(0)),
body: SingleChildScrollView(
child: COntainer(
child: Stack(
children: <Widget>[
Container(
child: Image.asset(
'assets/images/air_force_golden_jubilee_campus.jpeg',
fit: BoxFit.cover),
width: double.infinity,
height: double.infinity,
),
Container(color: MyColors.primaryDark.withOpacity(0.9)),
Container(
padding: EdgeInsets.symmetric(vertical: 30, horizontal: 30),
width: double.infinity,
height: double.infinity,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(height: 30),
Text("Welcome!",
style: MyText.display2(context).copyWith(
color: Colors.white, fontFamily: MyFonts.openSansBold)),
Container(height: 5),
Text(schoolDetails.schoolName,
style: MyText.title(context).copyWith(
color: Colors.white,
fontWeight: FontWeight.w300,
fontFamily: MyFonts.openSansRegular)),
Container(height: 10),
Container(
width: 120,
height: 120,
child: Image.asset(
'assets/images/schools/air_force_bal_bharati_logo.png'),
),
Container(height: 10),
Container(height: 3, width: 40, color: Colors.white),
Container(height: 5),
Text("Log in",
style: MyText.medium(context).copyWith(
color: Colors.white,
fontWeight: FontWeight.bold,
fontFamily: MyFonts.openSansBold)),
SizedBox(),
TextField(
controller: nameController,
style: TextStyle(color: Colors.white),
keyboardType: TextInputType.number,
decoration: InputDecoration(
labelText: "USERNAME",
labelStyle: TextStyle(
color: Colors.white,
fontFamily: MyFonts.openSansRegular),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.white, width: 1),
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.white, width: 2),
),
),
),
Container(height: 25),
TextField(
style: TextStyle(color: Colors.white),
controller: passwordController,
keyboardType: TextInputType.text,
obscureText: _obscureText,
decoration: InputDecoration(
labelText: "PASSWORD",
labelStyle: TextStyle(
color: Colors.white,
fontFamily: MyFonts.openSansRegular),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.white, width: 1),
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.white, width: 2),
),
suffixIcon: GestureDetector(
onTap: () {
setState(() {
_obscureText = !_obscureText;
});
},
child: Icon(
_obscureText
? Icons.visibility
: Icons.visibility_off,
color: Colors.white),
)),
),
Container(height: 20),
FloatingActionButton(
heroTag: "fab",
elevation: 0,
backgroundColor: Colors.white,
child: Icon(Icons.chevron_right, color: Colors.cyan[800]),
onPressed: () {
/* Navigator.push(context, MaterialPageRoute(builder: (BuildContext context){
return DashboardRoute(schoolDetails);
//return NoticeType();
}));*/
// LoginData data = new LoginData.section("sahood@traxsmart.in", "abc@123ABC");
progressDialog.show();
LoginData data = new LoginData.section(
nameController.text, passwordController.text);
_signIn(data);
},
),
SizedBox(),
Container(
width: double.infinity,
child: FlatButton(
child: Text("forgot password?",
style: TextStyle(
color: Colors.white,
fontFamily: MyFonts.openSansRegular)),
color: Colors.transparent,
onPressed: () {
/* LoginData data = new LoginData.section("+919061855558", "abc@123ABC");
_registerUser(data);*/
// confirm();
Navigator.push(context,
MaterialPageRoute(builder: (BuildContext context) {
return ForgotPassword();
// return NoticeType();
}));
},
),
)
],
),
),
],
),
),),
);
return new Scaffold(
backgroundColor: Colors.grey,
appBar:
PreferredSize(child: Container(), preferredSize: Size.fromHeight(0)),
body: SingleChildScrollView(
child: Container(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
child: Stack(
children: <Widget>[
Container(
child: Image.network(
'https://wizardsourcer.com/wp-content/uploads/2019/03/Stackoverflow.png'),
width: double.infinity,
height: double.infinity,
),
Container(color: Colors.grey[600]),
Container(
padding: EdgeInsets.symmetric(vertical: 30, horizontal: 30),
width: double.infinity,
height: double.infinity,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(height: 30),
Text("Welcome!"),
Container(height: 5),
Text(
'School Name',
),
Container(height: 10),
Container(
width: 120,
height: 120,
child: Image.network(
'https://wizardsourcer.com/wp-content/uploads/2019/03/Stackoverflow.png'),
),
Container(height: 10),
Container(height: 3, width: 40, color: Colors.white),
Container(height: 5),
Text(
"Log in",
),
SizedBox(),
TextField(
style: TextStyle(color: Colors.white),
keyboardType: TextInputType.number,
decoration: InputDecoration(
labelText: "USERNAME",
labelStyle: TextStyle(
color: Colors.white,
),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.white, width: 1),
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.white, width: 2),
),
),
),
Container(height: 25),
TextField(
style: TextStyle(color: Colors.white),
keyboardType: TextInputType.text,
decoration: InputDecoration(
labelText: "PASSWORD",
labelStyle: TextStyle(
color: Colors.white,
),
enabledBorder: UnderlineInputBorder(
borderSide:
BorderSide(color: Colors.white, width: 1),
),
focusedBorder: UnderlineInputBorder(
borderSide:
BorderSide(color: Colors.white, width: 2),
),
suffixIcon: GestureDetector(
onTap: () {
// setState(() {
// _obscureText = !_obscureText;
// });
},
child:
Icon(Icons.visibility_off, color: Colors.white),
)),
),
Container(height: 20),
FloatingActionButton(
heroTag: "fab",
elevation: 0,
backgroundColor: Colors.white,
child: Icon(Icons.chevron_right, color: Colors.cyan[800]),
onPressed: () {
/* Navigator.push(context, MaterialPageRoute(builder: (BuildContext context){
return DashboardRoute(schoolDetails);
//return NoticeType();
}));*/
// LoginData data = new LoginData.section("sahood@traxsmart.in", "abc@123ABC");
// progressDialog.show();
// LoginData data = new LoginData.section(
// nameController.text, passwordController.text);
// _signIn(data);
},
),
SizedBox(),
Container(
width: double.infinity,
child: FlatButton(
child: Text("forgot password?",
style: TextStyle(
color: Colors.white,
)),
color: Colors.transparent,
onPressed: () {
/* LoginData data = new LoginData.section("+919061855558", "abc@123ABC");
_registerUser(data);*/
// confirm();
// Navigator.push(context,
// MaterialPageRoute(builder: (BuildContext context) {
// return ForgotPassword();
// // return NoticeType();
// }));
},
),
)
],
),
)
],
),
),
),
);