我正在尝试构建一个自定义bottomNavBar,我的代码如下所示:
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Container(
decoration: BoxDecoration(
color: AppColors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(scaleWidth(20)),
topRight: Radius.circular(scaleWidth(20)),
),
boxShadow: [
BoxShadow(
color: Color.fromRGBO(0, 0, 0, 0.1),
blurRadius: 20,
),
],
),
height: scaleWidth(59),
child: Row(
children: _buildBottomNavBarItems(context),
),
),
Container(
color: AppColors.white,
height: MediaQuery.of(context).padding.bottom,
)
],
);
}
我在里面Scaffold这样称呼它:
bottomSheet: BottomNavBar(),
但问题是bottomNavBar覆盖整个屏幕!没有Column它,它工作正常,但它Column是至关重要的,所以我可以有底部Container,height: MediaQuery.of(context).padding.bottom,所以它height会navBar根据设备的不同而动态变化SafeArea。(例:iPhone SE 没有bottomSafeArea,iPhone X 有,所以需要调整高度。)
我在这里缺少什么,我该如何解决?
如果您需要更多信息,请告诉我!