feat: add featured professionals carousel to home screen

This commit is contained in:
pradeepkumar
2026-02-25 06:55:05 +05:30
parent e0a747d64b
commit c9366dedd0
3 changed files with 417 additions and 11 deletions

View File

@@ -14,6 +14,65 @@ const _fallbackImages = [
'assets/images/professional-3.jpg',
];
/// Default agents data — matches web's hardcoded agentsData fallback.
const _defaultAgents = [
ProfessionalItem(
name: 'Arjun Mehta',
subtitle: 'Residential Property Expert',
location: 'San Francisco, CA',
experience: '10+ years in the real estate industry.',
expertise: ['Residential', 'Rental', 'Commercial', 'Inspection', 'Land', 'Rental'],
),
ProfessionalItem(
name: 'Anderson',
subtitle: 'Rental & Investment Consultant',
location: 'New York',
experience: '7+ years in the real estate industry.',
expertise: ['Residential', 'Rental', 'Commercial'],
),
ProfessionalItem(
name: 'Sarah Johnson',
subtitle: 'Luxury Real Estate Specialist',
location: 'Los Angeles, CA',
experience: '12+ years in the real estate industry.',
expertise: ['Luxury', 'Residential', 'Investment'],
),
];
/// Default lenders data — matches web's hardcoded lendersData fallback.
const _defaultLenders = [
ProfessionalItem(
name: 'Sarah Johnson',
subtitle: 'Mortgage Specialist',
location: 'Los Angeles, CA',
experience: '10+ years in mortgage lending.',
expertise: ['FHA Loans', 'Conventional', 'VA Loans', 'Refinancing', 'Jumbo'],
),
ProfessionalItem(
name: 'Michael Chen',
subtitle: 'Senior Loan Officer',
location: 'Seattle, WA',
experience: '7+ years in lending.',
expertise: ['Jumbo Loans', 'Refinancing', 'Investment', 'First-time', 'USDA'],
),
ProfessionalItem(
name: 'Emily Davis',
subtitle: 'Home Loan Advisor',
location: 'Austin, TX',
experience: '5+ years in mortgage industry.',
expertise: ['First-time Buyers', 'FHA', 'USDA Loans', 'VA Loans', 'Conventional'],
),
];
/// Default content — matches web's defaultContent pattern.
const _defaultContent = TopProfessionalsContent(
title: '"Meet top real estate professionals"',
ctaText: 'Discover 5,000+ Top Real Estate Agents in Our Network.',
ctaButtonText: 'See All Agents',
agents: _defaultAgents,
lenders: _defaultLenders,
);
class TopProfessionalsSection extends ConsumerStatefulWidget {
const TopProfessionalsSection({super.key});
@@ -43,18 +102,18 @@ class _TopProfessionalsSectionState
@override
Widget build(BuildContext context) {
final homeState = ref.watch(homeProvider);
final topProfessionals = homeState.content?.topProfessionals;
final activeList = _activeTab == 'agents'
? (topProfessionals?.agents ?? [])
: (topProfessionals?.lenders ?? []);
// Use CMS data if available, otherwise fallback to defaults (same as web)
final data = homeState.content?.topProfessionals ?? _defaultContent;
final activeList = _activeTab == 'agents' ? data.agents : data.lenders;
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: Column(
children: [
Text(
topProfessionals?.title ?? '"Meet top real estate professionals"',
data.title,
textAlign: TextAlign.center,
style: const TextStyle(
fontFamily: 'Fractul',
@@ -104,7 +163,7 @@ class _TopProfessionalsSectionState
const SizedBox(height: 32),
// See All Agents CTA
_buildSeeAllAgentsCta(topProfessionals),
_buildSeeAllAgentsCta(data),
],
),
);
@@ -659,7 +718,7 @@ class _TopProfessionalsSectionState
);
}
Widget _buildSeeAllAgentsCta(TopProfessionalsContent? content) {
Widget _buildSeeAllAgentsCta(TopProfessionalsContent content) {
return Container(
width: double.infinity,
padding: const EdgeInsets.all(24),
@@ -693,8 +752,7 @@ class _TopProfessionalsSectionState
),
const SizedBox(height: 12),
Text(
content?.ctaText ??
'Discover 5,000+ Top Real Estate Agents in Our Network.',
content.ctaText,
textAlign: TextAlign.center,
style: const TextStyle(
fontFamily: 'SourceSerif4',
@@ -717,7 +775,7 @@ class _TopProfessionalsSectionState
),
),
child: Text(
content?.ctaButtonText ?? 'See All Agents',
content.ctaButtonText,
style: const TextStyle(
fontFamily: 'Fractul',
fontSize: 16,