[英]Flutter RenderFlex Overflow error when using CustomScrollView
I Get renderfexlx overflowed error even when all my widgets are inside custom scroll view widget.即使我的所有小部件都在自定义滚动视图小部件中,我也会收到 renderfexlx 溢出错误。 my scaffold body has a column that column have two expanded widgets all other widget i use are inside those expanded widgets.
我的脚手架主体有一列,该列有两个扩展小部件,我使用的所有其他小部件都在这些扩展小部件内。
I wrapped first column widget in SliverFillRemaining and CustomScrollView i still get renderflex overflowed error我将第一列小部件包裹在 SliverFillRemaining 和 CustomScrollView 中,但仍然出现 renderflex 溢出错误
i tried setting Column MainAxisSize to min it does not work.我尝试将 Column MainAxisSize 设置为 min 它不起作用。
my code我的代码
Scaffold(
backgroundColor: Colors.transparent,
body: CustomScrollView(
reverse: true,
slivers: [
SliverFillRemaining(
hasScrollBody: false,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Expanded(
flex: 3,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Text(
'Welcome to\nMonumental habits.',
style: kTitle,
textAlign: TextAlign.center,
),
SizedBox(
height: 30,
),
],
),
),
Expanded(
flex: 5,
child: Column(
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column(
children: [
LargeIconButton(
buttonName: 'Continue with Google',
icon: 'assets/images/auth/google_icon.png',
onPressed: () {},
),
SizedBox(
height: 10,
),
LargeIconButton(
buttonName: 'Continue with Facebook',
icon: 'assets/images/auth/facebook_icon.png',
onPressed: () {},
),
SizedBox(
height: 30,
)
],
),
),
Expanded(
child: Container(
decoration: BoxDecoration(
color: Colors.white,
),
child: Column(
children: [
Padding(
padding: const EdgeInsets.symmetric(
vertical: 14),
child: Text(
'Login with email',
style: kBodyText3,
),
),
Divider(
height: 3,
color: kPrimaryColor.withOpacity(0.7),
),
SizedBox(
height: 10,
),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 14,
),
child: Column(
children: [
MyTextFormField(
hint: 'Email',
icon: Icons.email_outlined,
inputType: TextInputType.emailAddress,
inputAction: TextInputAction.next,
fillColor: kScaffoldBackground,
focus: _focusNodes[0],
vlidator: emailValidator,
),
MyPasswordField(
fillColor: kScaffoldBackground,
focus: _focusNodes[1],
validator: passwordValidator,
),
MyTextButton(
buttonName: 'Login',
onPressed: () {},
bgColor: kPrimaryColor),
],
),
),
],
),
),
)
],
),
),
],
),
),
],
),
)
将 customScrollView 包装在设备大小的容器中,或者可以是一个 safeArea 小部件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.