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
This commit is contained in:
Dani B
2026-01-28 13:07:27 -05:00
parent 9a6332eacf
commit 92c9fce9f6
2 changed files with 84 additions and 83 deletions

View File

@@ -15,7 +15,6 @@ class HomePage extends ConsumerWidget {
final currentUser = authState.user; final currentUser = authState.user;
final authNotifier = ref.read(authProvider.notifier); final authNotifier = ref.read(authProvider.notifier);
return Scaffold(
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: const Text('Sage'), title: const Text('Sage'),
@@ -116,8 +115,8 @@ class HomePage extends ConsumerWidget {
radius: 50, radius: 50,
backgroundColor: Theme.of(context).colorScheme.primary, backgroundColor: Theme.of(context).colorScheme.primary,
child: Text( child: Text(
(currentUser?.email.isNotEmpty ?? false) (currentUser.email.isNotEmpty)
? currentUser!.email[0].toUpperCase() ? currentUser.email[0].toUpperCase()
: 'U', : 'U',
style: const TextStyle( style: const TextStyle(
fontSize: 24, fontSize: 24,
@@ -135,13 +134,13 @@ class HomePage extends ConsumerWidget {
), ),
const SizedBox(height: 8), const SizedBox(height: 8),
Text( Text(
currentUser?.email ?? '', currentUser.email,
style: Theme.of(context).textTheme.bodyLarge?.copyWith( style: Theme.of(context).textTheme.bodyLarge?.copyWith(
color: Colors.grey[600], color: Colors.grey[600],
), ),
), ),
] else ...[ ] else ...[
const Icon( Icon(
Icons.account_circle, Icons.account_circle,
size: 100, size: 100,
color: Colors.grey[400], color: Colors.grey[400],
@@ -195,12 +194,13 @@ class HomePage extends ConsumerWidget {
], ],
), ),
), ),
),
], ],
), ),
), ),
),
], ],
), ),
); );
);
} }
} }

View File

@@ -45,6 +45,7 @@ dependencies:
go_router: ^13.0.0 go_router: ^13.0.0
# State management # State management
flutter_riverpod: ^2.5.0
riverpod: ^2.5.0 riverpod: ^2.5.0
# Secure storage for authentication tokens # Secure storage for authentication tokens