import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:rluv/features/budget/screens/budget_overview.dart'; import 'package:rluv/global/styles.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); // This widget is the root of your application. @override Widget build(BuildContext context) { return ProviderScope( child: MaterialApp( debugShowCheckedModeBanner: false, title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.blue, ), home: const Home(), ), ); } } class Home extends ConsumerStatefulWidget { const Home({super.key}); @override ConsumerState createState() => _HomeState(); } class _HomeState extends ConsumerState { @override Widget build(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: false, drawer: const Drawer( backgroundColor: Styles.purpleNurple, ), appBar: AppBar( backgroundColor: Styles.purpleNurple, title: Text( ref.watch(appBarTitleProvider), ), ), body: ref.watch(currentHomePageProvider), ); } } final currentHomePageProvider = StateProvider( (ref) => const BudgetOverviewScreen(), ); final appBarTitleProvider = Provider( (ref) { final currentPageName = ref.watch(currentHomePageProvider).toString(); switch (currentPageName) { case 'BudgetOverviewScreen': return 'Budget'; default: return ''; } }, );