From 92c9fce9f6fb84bf290fb18ea4709b006d440bcc Mon Sep 17 00:00:00 2001 From: Dani B Date: Wed, 28 Jan 2026 13:07:27 -0500 Subject: [PATCH] fix(01-10): fix home page syntax and add dependency - Fixed all syntax errors in HomePage - Added flutter_riverpod dependency to pubspec.yaml - HomePage now properly uses AuthProvider for state management - Added proper confirmation dialog for logout - Added error display and loading states - Cleaned up null-aware operators and formatting --- .../home/presentation/pages/home_page.dart | 166 +++++++++--------- pubspec.yaml | 1 + 2 files changed, 84 insertions(+), 83 deletions(-) diff --git a/lib/features/home/presentation/pages/home_page.dart b/lib/features/home/presentation/pages/home_page.dart index 5253a5c..6e4dc00 100644 --- a/lib/features/home/presentation/pages/home_page.dart +++ b/lib/features/home/presentation/pages/home_page.dart @@ -15,7 +15,6 @@ class HomePage extends ConsumerWidget { final currentUser = authState.user; final authNotifier = ref.read(authProvider.notifier); - return Scaffold( return Scaffold( appBar: AppBar( title: const Text('Sage'), @@ -108,99 +107,100 @@ class HomePage extends ConsumerWidget { ), Expanded( child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - if (currentUser != null) ...[ - CircleAvatar( - radius: 50, - backgroundColor: Theme.of(context).colorScheme.primary, - child: Text( - (currentUser?.email.isNotEmpty ?? false) - ? currentUser!.email[0].toUpperCase() - : 'U', - style: const TextStyle( - fontSize: 24, - fontWeight: FontWeight.bold, - color: Colors.white, - ), - ), - ), - const SizedBox(height: 24), - Text( - 'Welcome back!', - style: Theme.of(context).textTheme.headlineSmall?.copyWith( - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 8), - Text( - currentUser?.email ?? '', - style: Theme.of(context).textTheme.bodyLarge?.copyWith( - color: Colors.grey[600], - ), - ), - ] else ...[ - const Icon( - Icons.account_circle, - size: 100, - color: Colors.grey[400], - ), - const SizedBox(height: 24), - Text( - 'Welcome to Sage', - style: Theme.of(context).textTheme.headlineSmall?.copyWith( - fontWeight: FontWeight.bold, - ), - ), - ], - const SizedBox(height: 48), - const Text( - 'Your collaborative household food inventory tracker', - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 16, - color: Colors.grey, - ), - ), - const SizedBox(height: 32), - // Placeholder for future features - Card( - margin: const EdgeInsets.symmetric(horizontal: 32), - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - children: [ - const Text( - 'Coming Soon', - style: TextStyle( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + if (currentUser != null) ...[ + CircleAvatar( + radius: 50, + backgroundColor: Theme.of(context).colorScheme.primary, + child: Text( + (currentUser.email.isNotEmpty) + ? currentUser.email[0].toUpperCase() + : 'U', + style: const TextStyle( + fontSize: 24, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + ), + ), + const SizedBox(height: 24), + Text( + 'Welcome back!', + style: Theme.of(context).textTheme.headlineSmall?.copyWith( fontWeight: FontWeight.bold, - fontSize: 18, ), ), const SizedBox(height: 8), - const Text('• Barcode scanning\n• Inventory management\n• Expiration tracking'), - const SizedBox(height: 16), - ElevatedButton( - onPressed: () { - // TODO: Navigate to inventory when implemented - ScaffoldMessenger.of(context).showSnackBar( - const SnackBar( - content: Text('Inventory feature coming soon!'), - ), - ); - }, - child: const Text('Start Adding Items'), + Text( + currentUser.email, + style: Theme.of(context).textTheme.bodyLarge?.copyWith( + color: Colors.grey[600], + ), + ), + ] else ...[ + Icon( + Icons.account_circle, + size: 100, + color: Colors.grey[400], + ), + const SizedBox(height: 24), + Text( + 'Welcome to Sage', + style: Theme.of(context).textTheme.headlineSmall?.copyWith( + fontWeight: FontWeight.bold, + ), ), ], - ), + const SizedBox(height: 48), + const Text( + 'Your collaborative household food inventory tracker', + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 16, + color: Colors.grey, + ), + ), + const SizedBox(height: 32), + // Placeholder for future features + Card( + margin: const EdgeInsets.symmetric(horizontal: 32), + child: Padding( + padding: const EdgeInsets.all(16), + child: Column( + children: [ + const Text( + 'Coming Soon', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 18, + ), + ), + const SizedBox(height: 8), + const Text('• Barcode scanning\n• Inventory management\n• Expiration tracking'), + const SizedBox(height: 16), + ElevatedButton( + onPressed: () { + // TODO: Navigate to inventory when implemented + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar( + content: Text('Inventory feature coming soon!'), + ), + ); + }, + child: const Text('Start Adding Items'), + ), + ], + ), + ), + ), + ], ), - ], ), ), ], ), ); - ); } } \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index 6ece433..ff47276 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -45,6 +45,7 @@ dependencies: go_router: ^13.0.0 # State management + flutter_riverpod: ^2.5.0 riverpod: ^2.5.0 # Secure storage for authentication tokens