Functional Navbar + New icons

switch between pages with pageprovider
This commit is contained in:
Jonas Braus
2024-11-21 11:39:27 +01:00
parent acd52702da
commit 0240fce953
4 changed files with 49 additions and 9 deletions
+17 -9
View File
@@ -49,35 +49,43 @@ class MyHome extends StatelessWidget {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: Container(),
bottomNavigationBar: GNav(
body: Consumer<PageProvider>(
builder: (context, pageProvider, child) {
return pageProvider.pages[pageProvider.selectedPage];
},
),
bottomNavigationBar: Padding(
padding: EdgeInsets.all(5),
child: GNav(
onTabChange: (index) {
Provider.of<PageProvider>(context, listen: false).changePage(index);
},
gap: 8,
backgroundColor: Theme.of(context).colorScheme.secondary,
style: GnavStyle.google,
backgroundColor: Theme.of(context).colorScheme.surface,
color: Theme.of(context).colorScheme.onSurface,
activeColor: Theme.of(context).colorScheme.onPrimary,
tabBackgroundColor: Theme.of(context).colorScheme.primary,
tabs: const [
GButton(
icon: Icons.food_bank,
icon: Icons.fastfood_outlined,
text: "Essen",
),GButton(
icon: Icons.room,
icon: Icons.landscape,
text: "Ambiente",
),GButton(
icon: Icons.person,
icon: Icons.mood,
text: "Service",
),GButton(
icon: Icons.question_mark,
icon: Icons.feedback,
text: "Verschläge",
), GButton(
icon: Icons.add_rounded,
icon: Icons.comment,
text: "Verbesserungen",
),
],
),
)
);
}
}