如何解决A RenderFlex 在右侧溢出了 8.0 像素
enter image description here 我有一个 RenderFlex 在导航栏中溢出并尝试修复它,但我不能,所以你能帮我吗? 我尝试了更多问题,例如 crossAxisAlignment、mainAxisAlignment 、将扩展更改为容器、将容器更改为扩展等等。
@override
Widget build(BuildContext context) {
return BottomAppBar(
notchMargin: 10,elevation: 30,color: Theme.of(context).backgroundColor,shape: CircularNotchedRectangle(),child: Container(
height: 75.h,child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.start,children: [
MaterialButton(
highlightColor: Colors.transparent,onpressed: () => changeIndex(0),child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,children: [
Icon(
IconData(0xe902,fontFamily: 'DFSIcons'),size: 25.sp,color: currentTab == 0
? Theme.of(context).primaryColor
: Colors.grey[700],),Texts(
Translations.of(context).home ?? "",style: TextStyles.CAPTION,],MaterialButton(
highlightColor: Colors.transparent,onpressed: () => changeIndex(1),children: [
SvgPicture.asset(
'assets/SVG/inBox.svg',width: 20.w,height: 20.w,color: currentTab == 1
? Theme.of(context).primaryColor
: Colors.grey[700],Texts(
Translations.of(context).inBox ?? "",Row(
children: [
MaterialButton(
// minWidth: 85.w,highlightColor: Colors.transparent,onpressed: () => changeIndex(2),children: [
Icon(
IconData(0xe901,color: currentTab == 2
? Theme.of(context).primaryColor
: Colors.grey[700],Texts(
Translations.of(context).appointments ?? "",MaterialButton(
// minWidth: 85.w,onpressed: () => changeIndex(3),children: [
Icon(
IconData(0xe900,color: currentTab == 3
? Theme.of(context).primaryColor
: Colors.grey[700],Texts(
Translations.of(context).profile ?? "",);
[enter image description here][1] }
}
解决方法
尝试将所有 MaterialButton 放在一个 Row 中,或者只是使用一个 BottomNavigationBar 小部件。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。