当多个Textfield添加并打开键盘时,flutter iOS底部闪烁闪烁
我在一个扑朔迷离的项目之一中使用了底部。它在Android和iOS模拟器上完美工作。当我在真实iPhone上运行该项目时,我会面临问题。请查看所附代码和图像。
_changePasswordBottomSheet() {
showModalBottomSheet(
isScrollControlled: true,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
context: context,
builder: (builder) {
return Padding(
padding: MediaQuery.of(context).viewInsets,
child: Container(
padding: EdgeInsets.symmetric(horizontal: 15),
height: 400,
color: Colors.transparent,
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: const Radius.circular(10.0),
topRight: const Radius.circular(10.0))),
child: Column(
children: [
Padding(
padding: EdgeInsets.all(12.w),
child: InkWell(
onTap: () {
NavigationService().setPopNavigator();
},
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
setWidth(25),
setComonText(
'CHANGE PASSWORD',
setAlignment: TextAlign.center,
style: CustomTheme().setTextStyle(
fontsize: 18.w,
weight: weight.semibold,
color: C.blackTxt),
),
Container(
height: 25.w,
width: 25.w,
decoration: BoxDecoration(
color: C.primaryGreyColor,
borderRadius: BorderRadius.circular(12.5.w),
),
child: Icon(
Icons.close,
color: C.white,
size: 16.w,
)),
],
),
),
),
setHight(25.w),
Container(
padding: EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(
border: Border.all(color: C.boxBorderColor),
borderRadius: BorderRadius.circular(5)),
child: TextFormField(
controller: editController.signupPassword,
obscureText: true,
decoration: InputDecoration(
hintText: "Passsword",
border: InputBorder.none,
hintStyle: CustomTheme().setTextStyle(
fontsize: 16.w,
weight: weight.semibold,
color: C.boxBorderColor)),
style: CustomTheme().setTextStyle(
fontsize: 16.w, weight: weight.semibold),
),
),
setHight(35.w),
Container(
padding: EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(
border: Border.all(color: C.boxBorderColor),
borderRadius: BorderRadius.circular(5)),
child: TextFormField(
controller: editController.signupNewPass,
obscureText: true,
decoration: InputDecoration(
hintText: "New Passsword",
border: InputBorder.none,
hintStyle: CustomTheme().setTextStyle(
fontsize: 16.w,
weight: weight.semibold,
color: C.boxBorderColor)),
style: CustomTheme().setTextStyle(
fontsize: 16.w, weight: weight.semibold),
),
),
setHight(10.w),
Container(
padding: EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(
border: Border.all(color: C.boxBorderColor),
borderRadius: BorderRadius.circular(5)),
child: TextFormField(
controller: editController.signupConfirmPass,
obscureText: true,
decoration: InputDecoration(
hintText: "Confirm Passsword",
border: InputBorder.none,
hintStyle: CustomTheme().setTextStyle(
fontsize: 16.w,
weight: weight.semibold,
color: C.boxBorderColor)),
style: CustomTheme().setTextStyle(
fontsize: 16.w, weight: weight.semibold),
),
),
setHight(50.w),
Row(
children: [
setWidth(20.w),
Expanded(
child: createButton(
width: setDeviceWidth() - 40.w,
text: 'CANCEL',
txtColor: C.white,
btnColour: C.primaryGreyColor,
onBtnClick: () {
editController.cancelPassword();
NavigationService().setPopNavigator();
},
fontSize: 14.w,
height: 45.w,
borderRadius: BorderRadius.circular(22.5.w)),
),
setWidth(20.w),
Expanded(
child: createButton(
width: setDeviceWidth() - 40.w,
text: 'SAVE',
txtColor: C.white,
onBtnClick: () {
editController.cancelPassword();
NavigationService().setPopNavigator();
modalBottomSheetSuccess(
'Password Saved \nSuccessfully!');
TimerUtils().startTimer(() {
NavigationService().setPopNavigator();
});
},
fontSize: 14.w,
height: 45.w,
borderRadius: BorderRadius.circular(22.5.w)),
),
setWidth(20.w),
],
)
],
)),
),
);
});
}
附件的图像为:
I have used the bottomsheet at one of my flutter project. It works perfectly on android and IOS simulator. When I run the project on real iPhone I am facing issues. please check attached code and image.
_changePasswordBottomSheet() {
showModalBottomSheet(
isScrollControlled: true,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
context: context,
builder: (builder) {
return Padding(
padding: MediaQuery.of(context).viewInsets,
child: Container(
padding: EdgeInsets.symmetric(horizontal: 15),
height: 400,
color: Colors.transparent,
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: const Radius.circular(10.0),
topRight: const Radius.circular(10.0))),
child: Column(
children: [
Padding(
padding: EdgeInsets.all(12.w),
child: InkWell(
onTap: () {
NavigationService().setPopNavigator();
},
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
setWidth(25),
setComonText(
'CHANGE PASSWORD',
setAlignment: TextAlign.center,
style: CustomTheme().setTextStyle(
fontsize: 18.w,
weight: weight.semibold,
color: C.blackTxt),
),
Container(
height: 25.w,
width: 25.w,
decoration: BoxDecoration(
color: C.primaryGreyColor,
borderRadius: BorderRadius.circular(12.5.w),
),
child: Icon(
Icons.close,
color: C.white,
size: 16.w,
)),
],
),
),
),
setHight(25.w),
Container(
padding: EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(
border: Border.all(color: C.boxBorderColor),
borderRadius: BorderRadius.circular(5)),
child: TextFormField(
controller: editController.signupPassword,
obscureText: true,
decoration: InputDecoration(
hintText: "Passsword",
border: InputBorder.none,
hintStyle: CustomTheme().setTextStyle(
fontsize: 16.w,
weight: weight.semibold,
color: C.boxBorderColor)),
style: CustomTheme().setTextStyle(
fontsize: 16.w, weight: weight.semibold),
),
),
setHight(35.w),
Container(
padding: EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(
border: Border.all(color: C.boxBorderColor),
borderRadius: BorderRadius.circular(5)),
child: TextFormField(
controller: editController.signupNewPass,
obscureText: true,
decoration: InputDecoration(
hintText: "New Passsword",
border: InputBorder.none,
hintStyle: CustomTheme().setTextStyle(
fontsize: 16.w,
weight: weight.semibold,
color: C.boxBorderColor)),
style: CustomTheme().setTextStyle(
fontsize: 16.w, weight: weight.semibold),
),
),
setHight(10.w),
Container(
padding: EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(
border: Border.all(color: C.boxBorderColor),
borderRadius: BorderRadius.circular(5)),
child: TextFormField(
controller: editController.signupConfirmPass,
obscureText: true,
decoration: InputDecoration(
hintText: "Confirm Passsword",
border: InputBorder.none,
hintStyle: CustomTheme().setTextStyle(
fontsize: 16.w,
weight: weight.semibold,
color: C.boxBorderColor)),
style: CustomTheme().setTextStyle(
fontsize: 16.w, weight: weight.semibold),
),
),
setHight(50.w),
Row(
children: [
setWidth(20.w),
Expanded(
child: createButton(
width: setDeviceWidth() - 40.w,
text: 'CANCEL',
txtColor: C.white,
btnColour: C.primaryGreyColor,
onBtnClick: () {
editController.cancelPassword();
NavigationService().setPopNavigator();
},
fontSize: 14.w,
height: 45.w,
borderRadius: BorderRadius.circular(22.5.w)),
),
setWidth(20.w),
Expanded(
child: createButton(
width: setDeviceWidth() - 40.w,
text: 'SAVE',
txtColor: C.white,
onBtnClick: () {
editController.cancelPassword();
NavigationService().setPopNavigator();
modalBottomSheetSuccess(
'Password Saved \nSuccessfully!');
TimerUtils().startTimer(() {
NavigationService().setPopNavigator();
});
},
fontSize: 14.w,
height: 45.w,
borderRadius: BorderRadius.circular(22.5.w)),
),
setWidth(20.w),
],
)
],
)),
),
);
});
}
Attached Image is:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论