加载页面时,带有列的 Flutter Expanded Container 溢出

问题描述

我需要我的列的一部分来占用我页面中的所有剩余空间,所以我将它们放在另一个带有父容器的列中并添加了展开的小部件。页面完全加载时看起来不错,但在加载时会出现溢出错误显示黄色和黑色条纹一秒钟。页面的图像如下所示,我需要白色容器尽可能多地占用空间:

enter image description here

这是在页面完全加载时工作正常但在加载时显示错误代码

Column(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,children: [
            Expanded(
              child: Container(
                margin: EdgeInsets.fromLTRB(40,16,40,50),decoration: Boxdecoration(
                    color: Theme.of(context).cardColor,borderRadius: BorderRadius.all(Radius.circular(10))),child: Column(
                  mainAxisSize: MainAxisSize.max,crossAxisAlignment: CrossAxisAlignment.stretch,mainAxisAlignment: MainAxisAlignment.start,children: [
                    SizedBox(
                      height: MediaQuery.of(context).size.width - 80,child: Image.asset(
                        AppImages.GET_STARTED,fit: BoxFit.fill,),Text(
                      "Get started",textAlign: TextAlign.center,style: Theme.of(context)
                          .textTheme
                          .headline3
                          ?.copyWith(color: Theme.of(context).primaryColor),SizedBox(
                      height: 8,Padding(
                      padding: const EdgeInsets.symmetric(horizontal: 16.0),child: Text(
                        AppStrings.GET_STARTED_MESSAGE,textAlign: TextAlign.justify,maxLines: 4,overflow: TextOverflow.ellipsis,style: Theme.of(context)
                            .textTheme
                            .bodyText1
                            ?.copyWith(color: Theme.of(context).primaryColor),],)),Padding(
              padding: const EdgeInsets.fromLTRB(24,24,40),child: Row(
                mainAxisAlignment: MainAxisAlignment.center,children: [
                  Expanded(
                      child: NotRecommendedButton(
                          onTap: () => Navigator.of(context).pop(),text: AppStrings.BACK)),SizedBox(
                    width: 8,Expanded(
                      child: AppButton(
                    onTap: () => Navigator.of(context).push(MaterialPageRoute(
                        builder: (_) => LocationDetailsPage())),text: AppStrings.NEXT,isBackgroundColor: true,isTextPrimaryColor: true,))
                ],)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)