From 412d111b10a333896ca0c9ab88839f440386dceb Mon Sep 17 00:00:00 2001 From: Jonas Braus Date: Thu, 21 Nov 2024 11:11:45 +0100 Subject: [PATCH] Default Layout NavBar --- lib/main.dart | 74 ++++++++++++++++++++++++++++++--- lib/modules/Test.dart | 0 lib/providers/pageProvider.dart | 5 +++ lib/widgets/Test.dart | 0 pubspec.lock | 8 ++++ pubspec.yaml | 1 + 6 files changed, 82 insertions(+), 6 deletions(-) create mode 100644 lib/modules/Test.dart create mode 100644 lib/providers/pageProvider.dart create mode 100644 lib/widgets/Test.dart diff --git a/lib/main.dart b/lib/main.dart index 18a9acd..1f21489 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,4 +1,7 @@ import 'package:flutter/material.dart'; +import 'package:google_nav_bar/google_nav_bar.dart'; +import 'package:mensaapp/providers/pageProvider.dart'; +import 'package:provider/provider.dart'; void main() { runApp(const MyApp()); @@ -10,12 +13,71 @@ class MyApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { - return MaterialApp( - theme: ThemeData( - colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), - useMaterial3: true, + return MultiProvider( + providers: [ + ChangeNotifierProvider( + create: (context) => PageProvider(), + ) + ], + child: MaterialApp( + theme: ThemeData( + colorScheme: const ColorScheme( + primary: Color.fromRGBO(236, 92, 61, 1), + onPrimary: Color.fromRGBO(240, 240, 240, 1), + secondary: Color.fromRGBO(203, 203, 203, 1), + onSecondary: Color.fromRGBO(60, 60, 60, 1), + error: Colors.red, + onError: Colors.white, + surface: Colors.white, + onSurface: Color.fromRGBO(60, 60, 60, 1), + brightness: Brightness.light, + tertiary: Color.fromRGBO(251, 216, 17, 0), + onTertiary: Color.fromRGBO(60, 60, 60, 1) + ), + useMaterial3: true, + ), + home: const MyHome() ), - home: const Placeholder(), ); } -} \ No newline at end of file +} + +class MyHome extends StatelessWidget { + const MyHome({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(), + body: Container(), + bottomNavigationBar: GNav( + onTabChange: (index) { + + }, + gap: 8, + backgroundColor: Theme.of(context).colorScheme.secondary, + 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, + text: "Essen", + ),GButton( + icon: Icons.room, + text: "Ambiente", + ),GButton( + icon: Icons.person, + text: "Service", + ),GButton( + icon: Icons.question_mark, + text: "Verschläge", + ), GButton( + icon: Icons.add_rounded, + text: "Verbesserungen", + ), + ], + ), + ); + } +} diff --git a/lib/modules/Test.dart b/lib/modules/Test.dart new file mode 100644 index 0000000..e69de29 diff --git a/lib/providers/pageProvider.dart b/lib/providers/pageProvider.dart new file mode 100644 index 0000000..45cdca4 --- /dev/null +++ b/lib/providers/pageProvider.dart @@ -0,0 +1,5 @@ +import 'package:flutter/material.dart'; + +class PageProvider extends ChangeNotifier { + +} \ No newline at end of file diff --git a/lib/widgets/Test.dart b/lib/widgets/Test.dart new file mode 100644 index 0000000..e69de29 diff --git a/pubspec.lock b/pubspec.lock index fbec4a4..fc02723 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -75,6 +75,14 @@ packages: description: flutter source: sdk version: "0.0.0" + google_nav_bar: + dependency: "direct main" + description: + name: google_nav_bar + sha256: bb12dd21514ee1b041ab3127673e2fd85e693337df308f7f2b75cd1e8e92eaf4 + url: "https://pub.dev" + source: hosted + version: "5.0.7" leak_tracker: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 614843b..d883c88 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -31,6 +31,7 @@ dependencies: flutter: sdk: flutter provider: ^6.1.2 + google_nav_bar: ^5.0.7 # The following adds the Cupertino Icons font to your application.