import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import '../../providers/auth_provider.dart'; /// Home page for authenticated users /// /// Displays welcome message and provides logout functionality /// This is the main landing page after successful authentication class HomePage extends ConsumerWidget { const HomePage({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { final authState = ref.watch(authStateProvider); return Scaffold( appBar: AppBar( title: const Text('Sage'), backgroundColor: Theme.of(context).colorScheme.inversePrimary, actions: [ IconButton( icon: const Icon(Icons.logout), onPressed: () async { // TODO: Implement logout functionality // await ref.read(authStateProvider.notifier).signOut(); }, tooltip: 'Logout', ), ], ), body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ if (authState.user != null) ...[ CircleAvatar( radius: 50, backgroundColor: Theme.of(context).colorScheme.primary, child: Text( authState.user!.email.isNotEmpty ? authState.user!.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( authState.user!.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( 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'), ), ], ), ), ), ], ), ), ); } }