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:real_estate_mobile/core/constants/app_colors.dart'; import 'package:real_estate_mobile/features/auth/presentation/providers/auth_provider.dart'; import 'package:real_estate_mobile/features/home/presentation/widgets/featured_professionals_section.dart'; import 'package:real_estate_mobile/features/home/presentation/widgets/features_section.dart'; import 'package:real_estate_mobile/features/home/presentation/widgets/hero_section.dart'; import 'package:real_estate_mobile/features/home/presentation/widgets/home_header.dart'; import 'package:real_estate_mobile/features/home/presentation/widgets/testimonials_section.dart'; import 'package:real_estate_mobile/features/home/presentation/widgets/top_professionals_section.dart'; import 'package:real_estate_mobile/features/home/presentation/widgets/trust_stats_section.dart'; class HomeScreen extends ConsumerStatefulWidget { const HomeScreen({super.key}); @override ConsumerState createState() => _HomeScreenState(); } class _HomeScreenState extends ConsumerState { int _selectedIndex = 0; @override Widget build(BuildContext context) { return Scaffold( body: _buildBody(), bottomNavigationBar: _buildBottomNavBar(), ); } Widget _buildBody() { // Only Home tab (index 0) has content for now switch (_selectedIndex) { case 0: return _buildHomeContent(); case 1: case 2: case 3: default: return Center( child: Text( ['Home', 'Listings', 'Messages', 'Profile'][_selectedIndex], style: const TextStyle( fontFamily: 'Fractul', fontSize: 18, fontWeight: FontWeight.w600, color: AppColors.primaryDark, ), ), ); } } Widget _buildHomeContent() { return SingleChildScrollView( child: Column( children: [ // Header SafeArea( bottom: false, child: const HomeHeader(), ), // Hero Section with Search const HeroSection(), const SizedBox(height: 40), // Features Section const FeaturesSection(), const SizedBox(height: 40), // Featured Professionals Carousel const FeaturedProfessionalsSection(), const SizedBox(height: 40), // Top Professionals Section (Agents/Lenders tabs) const TopProfessionalsSection(), const SizedBox(height: 40), // Trust & Stats Section const TrustStatsSection(), const SizedBox(height: 40), // Testimonials Section const TestimonialsSection(), const SizedBox(height: 40), // Footer _buildFooter(), ], ), ); } // ── Bottom Navigation Bar (matches Figma node 49:6485) ── Widget _buildBottomNavBar() { return Container( decoration: const BoxDecoration( color: Colors.white, border: Border( top: BorderSide(color: Color(0xFFE8E8E8), width: 1), ), ), child: SafeArea( top: false, child: Padding( padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ _buildNavItem( index: 0, svgPath: 'assets/icons/nav_home_icon.svg', fallbackIcon: Icons.home, ), _buildNavItem( index: 1, svgPath: 'assets/icons/nav_list_icon.svg', fallbackIcon: Icons.list, ), _buildNavItem( index: 2, svgPath: 'assets/icons/nav_messages_icon.svg', fallbackIcon: Icons.chat_bubble, ), _buildNavItem( index: 3, svgPath: 'assets/icons/nav_profile_icon.svg', fallbackIcon: Icons.person_outline, ), ], ), ), ), ); } Widget _buildNavItem({ required int index, required String svgPath, required IconData fallbackIcon, }) { final isSelected = _selectedIndex == index; return GestureDetector( onTap: () { if (index == 1) { context.push('/agents/search'); return; } if (index == 2 || index == 3) { final authState = ref.read(authProvider); if (authState.status != AuthStatus.authenticated) { context.push('/login'); return; } } setState(() => _selectedIndex = index); }, behavior: HitTestBehavior.opaque, child: Padding( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), child: SvgPicture.asset( svgPath, width: 24, height: 24, colorFilter: isSelected ? const ColorFilter.mode(AppColors.primaryDark, BlendMode.srcIn) : const ColorFilter.mode(AppColors.accentOrange, BlendMode.srcIn), placeholderBuilder: (_) => Icon( fallbackIcon, size: 24, color: isSelected ? AppColors.primaryDark : AppColors.accentOrange, ), ), ), ); } Widget _buildFooter() { return Container( width: double.infinity, padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 24), color: AppColors.primaryDark, child: Column( children: [ Image.asset( 'assets/icons/logo.png', width: 109, height: 29, color: Colors.white, ), const SizedBox(height: 16), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ _buildFooterLink('Home'), _buildFooterDot(), _buildFooterLink('About'), _buildFooterDot(), _buildFooterLink('Contact'), _buildFooterDot(), _buildFooterLink('FAQ'), ], ), const SizedBox(height: 16), Text( '\u00A9 2025 RE-QuestN. All rights reserved.', style: TextStyle( fontFamily: 'SourceSerif4', fontSize: 12, fontWeight: FontWeight.w400, color: Colors.white.withValues(alpha: 0.6), ), ), ], ), ); } Widget _buildFooterLink(String text) { return Text( text, style: const TextStyle( fontFamily: 'SourceSerif4', fontSize: 14, fontWeight: FontWeight.w400, color: Colors.white, ), ); } Widget _buildFooterDot() { return Padding( padding: const EdgeInsets.symmetric(horizontal: 12), child: Text( '\u2022', style: TextStyle( fontSize: 14, color: Colors.white.withValues(alpha: 0.5), ), ), ); } }