[英]Flutter avoiding resize screen when i have TextFormField into PageView
in this simplified code i have two TextFormField
into one of flutter PageView
pages, that they are into another class which that extended from Container
, not any Scaffold
, now when i click into one of this TextFormFields
, resizeToAvoidBottom* don't work in my code在这个简化的代码中,我有两个
TextFormField
到一个 flutter PageView
页面中,它们是从Container
扩展的另一个类,而不是任何Scaffold
,现在当我点击这个TextFormFields
,resizeToAvoidBottom* 在我的代码中不起作用
Widget build(BuildContext context) {
return Consumer<ThemeManager>(builder: (context, theme, child) {
return Directionality(
textDirection: TextDirection.rtl,
child: Scaffold(
key: _scaffoldKey,
backgroundColor: theme.accentColor,
resizeToAvoidBottomPadding: false,
resizeToAvoidBottomInset: false,
body: NotificationListener<OverscrollIndicatorNotification>(
onNotification: (overScroll) {
overScroll.disallowGlow();
return false;
},
child: Container(
width: double.infinity,
height: double.infinity,
child: IntrinsicHeight(
child: Stack(
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height - 50,
child: Column(
mainAxisSize: MainAxisSize.max,
children: <Widget>[
BuildLoginHeaderScreen(theme: theme),
Expanded(
child: PageView(
controller: _pageController,
children: <Widget>[
... // contains two TextFormFields
],
),
),
],
),
),
],
),
),
),
),
),
);
});
}
You can go around using resizeToAvoidBottomPadding
by wrapping appropriate part of your code with SingleChildScrollView
.您可以使用到处
resizeToAvoidBottomPadding
通过包装你的代码的适当部分SingleChildScrollView
。 For example例如
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.max,
children: <Widget>[
BuildLoginHeaderScreen(theme: theme),
Expanded(
child: PageView(
controller: _pageController,
children: <Widget>[
... // contains two TextFormFields
],
),
),
],
),
),
This will prevent pixel overflow when the keyboard reduces the view area.当键盘缩小视图区域时,这将防止像素溢出。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.