Код: Выделить всё
SizedBox(
height: controller.isVisible.value ? 80 : 0,
child: SafeArea(
bottom: true,
top: false,
child: MyBottomNavBar(
onItemSelected: controller.onMenuSelected,
selectedIndex: controller.lastSelectedIndex.value,
),
),
);
< /code>
Я также использую этот метод, чтобы получить высоту системы системной навигации, < /p>
/// Returns the height of the bottom system navigation bar (if present).
static double getBottomSystemBarHeight(BuildContext context) {
final viewPadding = MediaQuery.of(context).viewPadding;
final viewInsets = MediaQuery.of(context).viewInsets;
// Return bottom padding only if the keyboard is not open
return viewInsets.bottom == 0 ? viewPadding.bottom : 0;
}
< /code>
Я использовал это возвращаемое значение в качестве нижней заполнения класса Mybottomnavbar < /p>
Container(
padding: EdgeInsets.only(
bottom: DeviceUtils.getBottomSystemBarHeight(context),
),
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Colors.grey.withValues(alpha: 0.5),
spreadRadius: 3,
blurRadius: 4,
offset: Offset(0, 3),
),
],
),
child: BottomNavigationBar(
key: bottomNavKey,
items: _navItemBuilder(navItems),
elevation: 10,
showSelectedLabels: true,
showUnselectedLabels: true,
selectedFontSize: 10,
unselectedFontSize: 10,
selectedLabelStyle: TextStyle(fontFamily: 'Poppins'),
type: BottomNavigationBarType.fixed,
backgroundColor: AppColors.pageBackground,
currentIndex: navController.selectedIndex,
onTap: (index) {
navController.updateSelectedIndex(index);
onItemSelected(navItems[index].menuCode);
},
),
),
Подробнее здесь: https://stackoverflow.com/questions/796 ... r-overflow