简体   繁体   English

使用 CustomScrollView 时出现 Flutter RenderFlex 溢出错误

[英]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.

相关问题 Flutter:使用列时 RenderFlex 溢出 - Flutter: RenderFlex overflow when using column 带有 CustomScrollView Renderflex 错误的底部导航栏 - bottomNavigationBar with CustomScrollView Renderflex Error RenderFlex 溢出使用 Flutter GridView - RenderFlex overflow using Flutter GridView Flutter RenderFlex 溢出崩溃 - Flutter RenderFlex overflow crash 使用键盘时 flutter 中 modalbottomsheet 中的 renderflex 溢出错误 - renderflex overflowed error in modalbottomsheet in flutter when using keyboard 在容器内使用卡类型 class 时显示 RenderFlex 溢出错误 - Flutter - RenderFlex overflow error displayed while using the card type class inside a container - Flutter Flutter BottomNavigationBar 与 AnimatedContainer - 是什么导致 RenderFlex 溢出错误? - Flutter BottomNavigationBar with AnimatedContainer - what is causing a RenderFlex overflow error? GridView.builder() 中每个项目的 Flutter-Renderflex 溢出错误 - Flutter-Renderflex overflow error on each item in GridView.builder() 在 Flutter 中的 AlertBox 中键入时出现 renderflex 溢出错误 - A renderflex overflowed error when typing in an AlertBox in Flutter 使用多个 SliverStaggeredGrid 时出现 Flutter CustomScrollView 滚动错误 - flutter CustomScrollView scroll bug when using multiple SliverStaggeredGrid
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM