feat: Fetch real agent data for featured professionals and update associated icons and image placeholders.

This commit is contained in:
pradeepkumar
2026-03-14 21:30:37 +05:30
parent ddcc04a446
commit 751388ed00
9 changed files with 124 additions and 181 deletions

View File

@@ -7,13 +7,6 @@ import 'package:real_estate_mobile/core/widgets/s3_image.dart';
import 'package:real_estate_mobile/features/agents/data/models/agent_profile.dart';
import 'package:real_estate_mobile/features/agents/presentation/providers/agents_provider.dart';
/// Local fallback images for professionals.
const _fallbackImages = [
'assets/images/professional-1.jpg',
'assets/images/professional-2.jpg',
'assets/images/professional-3.jpg',
];
/// Featured professionals carousel shown above the agents/lenders tab section.
/// Now fetches REAL agent data from GET /agents API (like web does)
/// instead of using CMS/hardcoded fallback data.
@@ -148,7 +141,7 @@ class _FeaturedProfessionalsSectionState
left: index == 0 ? 0 : 8,
right: index == professionals.length - 1 ? 0 : 8,
),
child: Container(),
child: _buildFeaturedCard(professionals[index], index),
),
);
},
@@ -348,18 +341,16 @@ class _FeaturedProfessionalsSectionState
}
Widget _buildImagePlaceholder(int index) {
final assetPath = _fallbackImages[index % _fallbackImages.length];
return Image.asset(
assetPath,
const colors = [
Color(0xFFC4D9D4),
Color(0xFFD4C9B8),
Color(0xFFB8C4D4),
];
return Container(
width: double.infinity,
height: 192,
fit: BoxFit.cover,
errorBuilder: (context, error, stackTrace) => Container(
width: double.infinity,
height: 192,
color: AppColors.gradientStart,
child: const Icon(Icons.person, size: 60, color: AppColors.primaryDark),
),
color: colors[index % colors.length],
child: const Icon(Icons.person, size: 80, color: AppColors.primaryDark),
);
}

View File

@@ -39,11 +39,18 @@ const _defaultFeatures = FeaturesContent(
);
/// Map of feature icon keys to local SVG asset paths and Material fallback icons.
/// Supports both default slug keys and CMS web-style icon paths.
const _iconMap = {
// Default slug-based keys
'hire_quickly': ('assets/icons/hire_quickly_icon.svg', Icons.bolt),
'verified': ('assets/icons/verified_icon.svg', Icons.verified_user_outlined),
'top_rated': ('assets/icons/top_rated_icon.svg', Icons.star_outline),
'trusted': ('assets/icons/trusted_icon.svg', Icons.people_outline),
// CMS web-path keys (from CMS iconPath field)
'/assets/icons/hourglass-icon.svg': ('assets/icons/hire_quickly_icon.svg', Icons.bolt),
'/assets/icons/verified-badge-icon.svg': ('assets/icons/verified_icon.svg', Icons.verified_user_outlined),
'/assets/icons/star-orange-icon.svg': ('assets/icons/top_rated_icon.svg', Icons.star_outline),
'/assets/icons/trusted-people-icon.svg': ('assets/icons/trusted_icon.svg', Icons.people_outline),
};
class FeaturesSection extends ConsumerWidget {