fix black top/bottom bar when wrapping scaffold in safearea
Some checks failed
Pull Request Pipeline / test (pull_request) Successful in 2m10s
Pull Request Pipeline / lint (pull_request) Failing after 2m19s

This commit is contained in:
2025-11-22 16:31:15 +01:00
parent 63d9ed400d
commit b668f6b9ae

View File

@@ -31,73 +31,76 @@ class _CustomNavigationBarState extends State<CustomNavigationBar>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SafeArea( return Container(
minimum: EdgeInsets.symmetric(vertical: 30), decoration: BoxDecoration(color: CustomTheme.backgroundColor),
child: Scaffold( child: SafeArea(
appBar: AppBar( minimum: EdgeInsets.symmetric(vertical: 30),
centerTitle: true, child: Scaffold(
title: Text( appBar: AppBar(
_currentTabTitle(), centerTitle: true,
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold), title: Text(
_currentTabTitle(),
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
),
backgroundColor: CustomTheme.backgroundColor,
scrolledUnderElevation: 0,
actions: [
IconButton(
onPressed: () => Navigator.push(
context,
MaterialPageRoute(builder: (_) => const SettingsView()),
),
icon: const Icon(Icons.settings),
),
],
elevation: 0,
), ),
backgroundColor: CustomTheme.backgroundColor, backgroundColor: CustomTheme.backgroundColor,
scrolledUnderElevation: 0, body: tabs[currentIndex],
actions: [ extendBody: true,
IconButton( bottomNavigationBar: Padding(
onPressed: () => Navigator.push( padding: const EdgeInsets.symmetric(horizontal: 12.0),
context, child: Material(
MaterialPageRoute(builder: (_) => const SettingsView()), elevation: 10,
),
icon: const Icon(Icons.settings),
),
],
elevation: 0,
),
backgroundColor: CustomTheme.backgroundColor,
body: tabs[currentIndex],
extendBody: true,
bottomNavigationBar: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0),
child: Material(
elevation: 10,
borderRadius: BorderRadius.circular(24),
color: CustomTheme.primaryColor,
child: ClipRRect(
borderRadius: BorderRadius.circular(24), borderRadius: BorderRadius.circular(24),
child: SizedBox( color: CustomTheme.primaryColor,
height: 60, child: ClipRRect(
child: Row( borderRadius: BorderRadius.circular(24),
mainAxisAlignment: MainAxisAlignment.spaceAround, child: SizedBox(
children: <Widget>[ height: 60,
NavbarItem( child: Row(
index: 0, mainAxisAlignment: MainAxisAlignment.spaceAround,
isSelected: currentIndex == 0, children: <Widget>[
icon: Icons.home_rounded, NavbarItem(
label: 'Home', index: 0,
onTabTapped: onTabTapped, isSelected: currentIndex == 0,
), icon: Icons.home_rounded,
NavbarItem( label: 'Home',
index: 1, onTabTapped: onTabTapped,
isSelected: currentIndex == 1, ),
icon: Icons.gamepad_rounded, NavbarItem(
label: 'Games', index: 1,
onTabTapped: onTabTapped, isSelected: currentIndex == 1,
), icon: Icons.gamepad_rounded,
NavbarItem( label: 'Games',
index: 2, onTabTapped: onTabTapped,
isSelected: currentIndex == 2, ),
icon: Icons.group_rounded, NavbarItem(
label: 'Groups', index: 2,
onTabTapped: onTabTapped, isSelected: currentIndex == 2,
), icon: Icons.group_rounded,
NavbarItem( label: 'Groups',
index: 3, onTabTapped: onTabTapped,
isSelected: currentIndex == 3, ),
icon: Icons.bar_chart_rounded, NavbarItem(
label: 'Stats', index: 3,
onTabTapped: onTabTapped, isSelected: currentIndex == 3,
), icon: Icons.bar_chart_rounded,
], label: 'Stats',
onTabTapped: onTabTapped,
),
],
),
), ),
), ),
), ),