diff --git a/lib/features/about/presentation/screens/about_screen.dart b/lib/features/about/presentation/screens/about_screen.dart index 6728dfe..d3388c4 100644 --- a/lib/features/about/presentation/screens/about_screen.dart +++ b/lib/features/about/presentation/screens/about_screen.dart @@ -4,6 +4,7 @@ import 'package:go_router/go_router.dart'; import 'package:real_estate_mobile/core/constants/app_colors.dart'; import 'package:real_estate_mobile/core/network/api_client.dart'; import 'package:real_estate_mobile/core/widgets/s3_image.dart'; +import 'package:real_estate_mobile/features/auth/presentation/providers/auth_provider.dart'; // ── Data models (matching web CMS types) ── @@ -825,9 +826,18 @@ class AboutScreen extends ConsumerWidget { ), ), const SizedBox(height: 24), - // Find Agents Now button - GestureDetector( - onTap: () => context.push('/agents/search'), + // Find Agents Now button — navigate based on user role + Consumer(builder: (context, ref, _) { + return GestureDetector( + onTap: () { + final authState = ref.read(authProvider); + if (authState.status == AuthStatus.authenticated && + authState.user?.role == 'AGENT') { + context.go('/home'); + } else { + context.push('/agents/search'); + } + }, child: Container( height: 50, width: 210, @@ -846,7 +856,8 @@ class AboutScreen extends ConsumerWidget { ), ), ), - ), + ); + }), const SizedBox(height: 12), // Get Help button GestureDetector( diff --git a/lib/features/contact/presentation/screens/contact_screen.dart b/lib/features/contact/presentation/screens/contact_screen.dart index d2036c6..d76b27e 100644 --- a/lib/features/contact/presentation/screens/contact_screen.dart +++ b/lib/features/contact/presentation/screens/contact_screen.dart @@ -1,10 +1,12 @@ import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:go_router/go_router.dart'; import 'package:url_launcher/url_launcher.dart'; import 'package:real_estate_mobile/core/constants/api_constants.dart'; import 'package:real_estate_mobile/core/constants/app_colors.dart'; import 'package:real_estate_mobile/core/network/api_client.dart'; +import 'package:real_estate_mobile/features/auth/presentation/providers/auth_provider.dart'; class ContactScreen extends StatefulWidget { const ContactScreen({super.key}); @@ -589,9 +591,18 @@ class _ContactScreenState extends State { ), ), const SizedBox(height: 24), - // Start Your Search button - GestureDetector( - onTap: () => context.push('/agents/search'), + // Start Your Search button — navigate based on user role + Consumer(builder: (context, ref, _) { + return GestureDetector( + onTap: () { + final authState = ref.read(authProvider); + if (authState.status == AuthStatus.authenticated && + authState.user?.role == 'AGENT') { + context.go('/home'); + } else { + context.push('/agents/search'); + } + }, child: Container( height: 46, width: 220, @@ -620,7 +631,8 @@ class _ContactScreenState extends State { ], ), ), - ), + ); + }), ], ), );