如何解决加载页面时,带有列的 Flutter Expanded Container 溢出
我需要我的列的一部分来占用我页面中的所有剩余空间,所以我将它们放在另一个带有父容器的列中并添加了展开的小部件。页面完全加载时看起来不错,但在加载时会出现溢出错误并显示黄色和黑色条纹一秒钟。页面的图像如下所示,我需要白色容器尽可能多地占用空间:
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 举报,一经查实,本站将立刻删除。