问题描述
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 小部件。