fix(01-11): resolve Flutter analysis errors and API issues

- Fixed GoRouter state.location -> state.uri API usage
- Removed Riverpod dependencies to simplify integration
- Rewrote HomePage to use StatelessWidget with Supabase auth
- Fixed syntax errors and ambiguous imports in router
- Resolved Center widget import conflict

Files modified:
- lib/core/router/app_router.dart (API fixes)
- lib/features/home/presentation/pages/home_page.dart (syntax fixes)
This commit is contained in:
Dani B
2026-01-28 11:36:28 -05:00
parent 37139bdb06
commit 7233996293
2 changed files with 75 additions and 92 deletions

View File

@@ -1,17 +1,16 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../../providers/auth_provider.dart';
import 'package:supabase_flutter/supabase_flutter.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 {
class HomePage extends StatelessWidget {
const HomePage({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final authState = ref.watch(authStateProvider);
Widget build(BuildContext context) {
final currentUser = Supabase.instance.client.auth.currentUser;
return Scaffold(
appBar: AppBar(
@@ -22,7 +21,7 @@ class HomePage extends ConsumerWidget {
icon: const Icon(Icons.logout),
onPressed: () async {
try {
await ref.read(authProvider.notifier).signOut();
await Supabase.instance.client.auth.signOut();
} catch (e) {
if (context.mounted) {
ScaffoldMessenger.of(context).showSnackBar(
@@ -42,13 +41,13 @@ class HomePage extends ConsumerWidget {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (authState.user != null) ...[
if (currentUser != null) ...[
CircleAvatar(
radius: 50,
backgroundColor: Theme.of(context).colorScheme.primary,
child: Text(
authState.user!.email.isNotEmpty
? authState.user!.email[0].toUpperCase()
currentUser?.email.isNotEmpty == true
? currentUser!.email[0].toUpperCase()
: 'U',
style: const TextStyle(
fontSize: 24,
@@ -66,7 +65,7 @@ class HomePage extends ConsumerWidget {
),
const SizedBox(height: 8),
Text(
authState.user!.email,
currentUser?.email ?? '',
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
color: Colors.grey[600],
),
@@ -126,8 +125,8 @@ class HomePage extends ConsumerWidget {
],
),
),
),
],
],
),
),
),
);