feat: Add professional ratings to cards, implement scroll-to-top on home tab re-tap, and improve agent type fetching in the hero section.

This commit is contained in:
pradeepkumar
2026-03-15 22:28:59 +05:30
parent 1fafbb1eb4
commit f6263b833c
6 changed files with 76 additions and 17 deletions

View File

@@ -55,14 +55,18 @@ class _HeroSectionState extends ConsumerState<HeroSection> {
context.push('/agents/search${queryString.isNotEmpty ? '?$queryString' : ''}');
}
void _showTypePicker() {
final topProState = ref.read(topProfessionalsProvider);
final agentTypes = topProState.agentTypes;
Future<void> _showTypePicker() async {
var agentTypes = ref.read(topProfessionalsProvider).agentTypes;
// If types haven't loaded yet, fetch them directly
if (agentTypes.isEmpty) {
// If types not loaded yet, just navigate to search
context.push('/agents/search');
return;
try {
final repo = ref.read(agentsRepositoryProvider);
agentTypes = await repo.getAgentTypes();
} catch (_) {
return;
}
if (!mounted || agentTypes.isEmpty) return;
}
showModalBottomSheet(

View File

@@ -103,7 +103,7 @@ class _TopProfessionalsSectionState
else ...[
// Professional Cards - horizontal scroll
SizedBox(
height: 480,
height: 540,
child: ListView.builder(
controller: _scrollController,
scrollDirection: Axis.horizontal,
@@ -293,8 +293,10 @@ class _TopProfessionalsSectionState
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Image
Expanded(
// Image (226px per Figma)
SizedBox(
width: double.infinity,
height: 226,
child: ClipRRect(
borderRadius:
const BorderRadius.vertical(top: Radius.circular(15)),
@@ -302,7 +304,7 @@ class _TopProfessionalsSectionState
? S3Image(
imageUrl: imageUrl,
width: double.infinity,
height: double.infinity,
height: 226,
fit: BoxFit.cover,
alignment: Alignment.topCenter,
placeholder: (_) => _buildImagePlaceholder(index),
@@ -313,7 +315,8 @@ class _TopProfessionalsSectionState
),
// Content
Padding(
Expanded(
child: Padding(
padding: const EdgeInsets.fromLTRB(16, 12, 16, 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -468,9 +471,26 @@ class _TopProfessionalsSectionState
),
const SizedBox(height: 8),
],
// Star Rating
Row(
children: List.generate(5, (i) {
return Padding(
padding: const EdgeInsets.only(right: 4),
child: Icon(
i < item.rating.round()
? Icons.star_rounded
: Icons.star_outline_rounded,
color: const Color(0xFFE5A625),
size: 24,
),
);
}),
),
],
),
),
),
],
),
);
@@ -478,7 +498,7 @@ class _TopProfessionalsSectionState
Widget _buildShimmerCards() {
return SizedBox(
height: 480,
height: 540,
child: Shimmer.fromColors(
baseColor: const Color(0xFFE0E0E0),
highlightColor: const Color(0xFFF5F5F5),
@@ -492,7 +512,7 @@ class _TopProfessionalsSectionState
children: [
// Image placeholder
Container(
height: 192,
height: 226,
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.vertical(top: Radius.circular(15)),
@@ -558,7 +578,7 @@ class _TopProfessionalsSectionState
Widget _buildAvatarPlaceholder() {
return Container(
width: double.infinity,
height: 192,
height: 226,
color: AppColors.gradientStart,
child: const Icon(Icons.person, size: 60, color: AppColors.primaryDark),
);