diff --git a/lib/auth/auth_state.dart b/lib/auth/auth_state.dart index 4e73cde..ed60185 100644 --- a/lib/auth/auth_state.dart +++ b/lib/auth/auth_state.dart @@ -4,8 +4,13 @@ class AuthState extends ChangeNotifier { bool _isLoggedIn = false; bool get isLoggedIn => _isLoggedIn; - void toggleLogin() { - _isLoggedIn = !_isLoggedIn; + void toggleLogin({bool? value}) { + _isLoggedIn = value ?? !_isLoggedIn; + notifyListeners(); + } + + void logout() { + _isLoggedIn = false; notifyListeners(); } } diff --git a/lib/home/home_screen.dart b/lib/home/home_screen.dart index 675603b..d638e88 100644 --- a/lib/home/home_screen.dart +++ b/lib/home/home_screen.dart @@ -26,7 +26,42 @@ class _LoggedInView extends StatelessWidget { @override Widget build(BuildContext context) { - return const Center(child: Text('Logged In')); + final authState = Provider.of(context, listen: false); + + return Scaffold( + appBar: AppBar( + title: const Text('Welcome Back!'), + actions: [ + IconButton( + icon: const Icon(Icons.person), + onPressed: () { + context.go('/profile'); // Navigate to profile screen + }, + ), + ], + ), + body: ListView.builder( + itemCount: 20, // Example items + itemBuilder: (context, index) { + return Card( + margin: const EdgeInsets.all(8.0), + child: ListTile( + leading: const Icon(Icons.star), + title: Text('Item ${index + 1}'), + subtitle: const Text('This is an example item.'), + ), + ); + }, + ), + floatingActionButton: FloatingActionButton.extended( + onPressed: () { + authState.logout(); // Call logout method + }, + label: const Text('Logout'), + icon: const Icon(Icons.logout), + ), + floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat, + ); } }