update mobile design
This commit is contained in:
@@ -1,25 +1,62 @@
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:real_estate_mobile/config/app_config.dart';
|
||||
import 'package:real_estate_mobile/core/constants/app_colors.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';
|
||||
import 'package:real_estate_mobile/features/home/data/models/landing_page_content.dart';
|
||||
import 'package:real_estate_mobile/features/home/presentation/providers/home_provider.dart';
|
||||
|
||||
class TopProfessionalsSection extends ConsumerWidget {
|
||||
/// Local fallback images for professionals when CMS returns no image.
|
||||
const _fallbackImages = [
|
||||
'assets/images/professional-1.jpg',
|
||||
'assets/images/professional-2.jpg',
|
||||
'assets/images/professional-3.jpg',
|
||||
];
|
||||
|
||||
class TopProfessionalsSection extends ConsumerStatefulWidget {
|
||||
const TopProfessionalsSection({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final state = ref.watch(topProfessionalsProvider);
|
||||
ConsumerState<TopProfessionalsSection> createState() =>
|
||||
_TopProfessionalsSectionState();
|
||||
}
|
||||
|
||||
class _TopProfessionalsSectionState
|
||||
extends ConsumerState<TopProfessionalsSection> {
|
||||
String _activeTab = 'agents';
|
||||
int _currentPage = 0;
|
||||
late PageController _pageController;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_pageController = PageController();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_pageController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final homeState = ref.watch(homeProvider);
|
||||
final topProfessionals = homeState.content?.topProfessionals;
|
||||
|
||||
final activeList = _activeTab == 'agents'
|
||||
? (topProfessionals?.agents ?? [])
|
||||
: (topProfessionals?.lenders ?? []);
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24),
|
||||
child: Column(
|
||||
children: [
|
||||
const Text(
|
||||
'"Meet top real estate professionals"',
|
||||
Text(
|
||||
topProfessionals?.title ?? '"Meet top real estate professionals"',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Fractul',
|
||||
fontSize: 25,
|
||||
fontWeight: FontWeight.w700,
|
||||
@@ -29,65 +66,75 @@ class TopProfessionalsSection extends ConsumerWidget {
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Agents / Lenders Tab
|
||||
_buildCategoryTab(ref, state.activeTab),
|
||||
_buildCategoryTab(),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Content
|
||||
if (state.isLoading)
|
||||
if (homeState.isLoading)
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 40),
|
||||
child: CircularProgressIndicator(
|
||||
color: AppColors.accentOrange,
|
||||
),
|
||||
)
|
||||
else if (state.error != null)
|
||||
_buildErrorState(ref, state.error!)
|
||||
else if (state.activeList.isEmpty)
|
||||
_buildEmptyState(state.activeTab)
|
||||
else if (homeState.error != null)
|
||||
_buildErrorState(homeState.error!)
|
||||
else if (activeList.isEmpty)
|
||||
_buildEmptyState()
|
||||
else ...[
|
||||
// Agent Cards - horizontal scroll
|
||||
// Professional Cards - horizontal scroll
|
||||
SizedBox(
|
||||
height: 480,
|
||||
height: 500,
|
||||
child: PageView.builder(
|
||||
controller: PageController(viewportFraction: 1.0),
|
||||
itemCount: state.activeList.length,
|
||||
controller: _pageController,
|
||||
itemCount: activeList.length,
|
||||
onPageChanged: (index) {
|
||||
setState(() => _currentPage = index);
|
||||
},
|
||||
itemBuilder: (context, index) {
|
||||
return _buildAgentCard(state.activeList[index]);
|
||||
return _buildProfessionalCard(activeList[index], index: index);
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Progress indicator
|
||||
_buildProgressIndicator(state.activeList.length),
|
||||
_buildProgressIndicator(activeList.length),
|
||||
],
|
||||
const SizedBox(height: 32),
|
||||
|
||||
// See All Agents CTA
|
||||
_buildSeeAllAgentsCta(),
|
||||
_buildSeeAllAgentsCta(topProfessionals),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCategoryTab(WidgetRef ref, String activeTab) {
|
||||
Widget _buildCategoryTab() {
|
||||
return Container(
|
||||
height: 45,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
border: Border.all(color: AppColors.primaryDark, width: 0.1),
|
||||
border: Border.all(color: AppColors.primaryDark, width: 0.7),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
// Agents tab
|
||||
Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: () => ref
|
||||
.read(topProfessionalsProvider.notifier)
|
||||
.setActiveTab('agents'),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_activeTab = 'agents';
|
||||
_currentPage = 0;
|
||||
});
|
||||
if (_pageController.hasClients) {
|
||||
_pageController.jumpToPage(0);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: activeTab == 'agents'
|
||||
color: _activeTab == 'agents'
|
||||
? AppColors.accentOrange
|
||||
: Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
@@ -99,9 +146,15 @@ class TopProfessionalsSection extends ConsumerWidget {
|
||||
'assets/icons/agents_tab_icon.svg',
|
||||
width: 24,
|
||||
height: 24,
|
||||
colorFilter: ColorFilter.mode(
|
||||
_activeTab == 'agents'
|
||||
? Colors.white
|
||||
: AppColors.primaryDark,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
placeholderBuilder: (_) => Icon(
|
||||
Icons.people,
|
||||
color: activeTab == 'agents'
|
||||
color: _activeTab == 'agents'
|
||||
? Colors.white
|
||||
: AppColors.primaryDark,
|
||||
size: 24,
|
||||
@@ -114,7 +167,7 @@ class TopProfessionalsSection extends ConsumerWidget {
|
||||
fontFamily: 'SourceSerif4',
|
||||
fontSize: 17,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: activeTab == 'agents'
|
||||
color: _activeTab == 'agents'
|
||||
? Colors.white
|
||||
: AppColors.primaryDark,
|
||||
),
|
||||
@@ -127,13 +180,19 @@ class TopProfessionalsSection extends ConsumerWidget {
|
||||
// Lenders tab
|
||||
Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: () => ref
|
||||
.read(topProfessionalsProvider.notifier)
|
||||
.setActiveTab('lenders'),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_activeTab = 'lenders';
|
||||
_currentPage = 0;
|
||||
});
|
||||
if (_pageController.hasClients) {
|
||||
_pageController.jumpToPage(0);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: activeTab == 'lenders'
|
||||
color: _activeTab == 'lenders'
|
||||
? AppColors.accentOrange
|
||||
: Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
@@ -145,9 +204,15 @@ class TopProfessionalsSection extends ConsumerWidget {
|
||||
'assets/icons/lenders_tab_icon.svg',
|
||||
width: 24,
|
||||
height: 24,
|
||||
colorFilter: ColorFilter.mode(
|
||||
_activeTab == 'lenders'
|
||||
? Colors.white
|
||||
: AppColors.primaryDark,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
placeholderBuilder: (_) => Icon(
|
||||
Icons.calendar_today,
|
||||
color: activeTab == 'lenders'
|
||||
color: _activeTab == 'lenders'
|
||||
? Colors.white
|
||||
: AppColors.primaryDark,
|
||||
size: 24,
|
||||
@@ -160,7 +225,7 @@ class TopProfessionalsSection extends ConsumerWidget {
|
||||
fontFamily: 'SourceSerif4',
|
||||
fontSize: 17,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: activeTab == 'lenders'
|
||||
color: _activeTab == 'lenders'
|
||||
? Colors.white
|
||||
: AppColors.primaryDark,
|
||||
),
|
||||
@@ -175,7 +240,50 @@ class TopProfessionalsSection extends ConsumerWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildAgentCard(AgentProfile agent) {
|
||||
/// Resolves an image URL: full URL → use as-is, relative → prepend base URL.
|
||||
String? _resolveImageUrl(String imageUrl) {
|
||||
if (imageUrl.isEmpty) return null;
|
||||
if (imageUrl.startsWith('http://') || imageUrl.startsWith('https://')) {
|
||||
return imageUrl;
|
||||
}
|
||||
final baseUrl = AppConfig.apiBaseUrl;
|
||||
if (baseUrl.isNotEmpty) {
|
||||
return '$baseUrl$imageUrl';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Builds the card image: CachedNetworkImage for valid URLs, local asset fallback otherwise.
|
||||
Widget _buildCardImage(ProfessionalItem professional, int index) {
|
||||
final resolvedUrl = _resolveImageUrl(professional.imageUrl);
|
||||
|
||||
if (resolvedUrl != null) {
|
||||
return CachedNetworkImage(
|
||||
imageUrl: resolvedUrl,
|
||||
width: double.infinity,
|
||||
height: 192,
|
||||
fit: BoxFit.cover,
|
||||
placeholder: (context, url) => _buildImagePlaceholder(index),
|
||||
errorWidget: (context, url, error) => _buildImagePlaceholder(index),
|
||||
);
|
||||
}
|
||||
return _buildImagePlaceholder(index);
|
||||
}
|
||||
|
||||
/// Shows a local fallback professional image (cycles through 3 images).
|
||||
Widget _buildImagePlaceholder(int index) {
|
||||
final assetPath = _fallbackImages[index % _fallbackImages.length];
|
||||
return Image.asset(
|
||||
assetPath,
|
||||
width: double.infinity,
|
||||
height: 192,
|
||||
fit: BoxFit.cover,
|
||||
errorBuilder: (context, error, stackTrace) => _buildAvatarPlaceholder(),
|
||||
);
|
||||
}
|
||||
|
||||
// ── Unified Professional Card (matches Figma design for both tabs) ──
|
||||
Widget _buildProfessionalCard(ProfessionalItem professional, {int index = 0}) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
@@ -185,27 +293,21 @@ class TopProfessionalsSection extends ConsumerWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Agent image
|
||||
// Image
|
||||
ClipRRect(
|
||||
borderRadius:
|
||||
const BorderRadius.vertical(top: Radius.circular(15)),
|
||||
child: agent.avatar != null && agent.avatar!.isNotEmpty
|
||||
? Image.network(
|
||||
agent.avatar!,
|
||||
width: double.infinity,
|
||||
height: 192,
|
||||
fit: BoxFit.cover,
|
||||
errorBuilder: (_, __, ___) => _buildAvatarPlaceholder(),
|
||||
)
|
||||
: _buildAvatarPlaceholder(),
|
||||
child: _buildCardImage(professional, index),
|
||||
),
|
||||
|
||||
// Content
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.fromLTRB(16, 12, 16, 12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Name and rating row
|
||||
// Row 1: Name + verified badge + star Rating
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
@@ -213,7 +315,7 @@ class TopProfessionalsSection extends ConsumerWidget {
|
||||
children: [
|
||||
Flexible(
|
||||
child: Text(
|
||||
agent.fullName,
|
||||
professional.name,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Fractul',
|
||||
fontSize: 14,
|
||||
@@ -223,75 +325,101 @@ class TopProfessionalsSection extends ConsumerWidget {
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
if (agent.isVerified) ...[
|
||||
const SizedBox(width: 8),
|
||||
SvgPicture.asset(
|
||||
'assets/icons/verified_badge_icon.svg',
|
||||
width: 16,
|
||||
height: 16,
|
||||
placeholderBuilder: (_) => const Icon(
|
||||
Icons.verified,
|
||||
color: Colors.blue,
|
||||
size: 16,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
SvgPicture.asset(
|
||||
'assets/icons/verified_badge_icon.svg',
|
||||
width: 16,
|
||||
height: 16,
|
||||
placeholderBuilder: (_) => const Icon(
|
||||
Icons.verified,
|
||||
color: Color(0xFF1DA1F2),
|
||||
size: 16,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (agent.rating != null) ...[
|
||||
SvgPicture.asset(
|
||||
'assets/icons/star_rating_icon.svg',
|
||||
width: 16,
|
||||
height: 16,
|
||||
placeholderBuilder: (_) => const Icon(
|
||||
Icons.star,
|
||||
color: AppColors.accentOrange,
|
||||
size: 16,
|
||||
),
|
||||
SvgPicture.asset(
|
||||
'assets/icons/star_rating_icon.svg',
|
||||
width: 16,
|
||||
height: 16,
|
||||
placeholderBuilder: (_) => const Icon(
|
||||
Icons.star,
|
||||
color: Color(0xFFFFDE21),
|
||||
size: 16,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'${agent.rating!.toStringAsFixed(1)} Rating',
|
||||
style: const TextStyle(
|
||||
fontFamily: 'SourceSerif4',
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColors.primaryDark,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
const Text(
|
||||
'Rating',
|
||||
style: TextStyle(
|
||||
fontFamily: 'SourceSerif4',
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColors.primaryDark,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
|
||||
// Verified text
|
||||
if (agent.isVerified)
|
||||
// Row 2: (Subtitle) in parentheses
|
||||
if (professional.subtitle.isNotEmpty)
|
||||
Text(
|
||||
'"Verified local ${agent.agentType?.name.toLowerCase() ?? 'agent'}"',
|
||||
'(${professional.subtitle})',
|
||||
style: const TextStyle(
|
||||
fontFamily: 'SourceSerif4',
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Color(0xFF638559),
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColors.primaryDark,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
|
||||
// Row 3: Verified badge + "Verified local agent" in green
|
||||
Row(
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
'assets/icons/verified_badge_icon.svg',
|
||||
width: 14,
|
||||
height: 14,
|
||||
placeholderBuilder: (_) => const Icon(
|
||||
Icons.verified,
|
||||
color: Color(0xFF638559),
|
||||
size: 14,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
const Text(
|
||||
'"Verified local agent"',
|
||||
style: TextStyle(
|
||||
fontFamily: 'SourceSerif4',
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Color(0xFF638559),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
|
||||
// Location
|
||||
if (agent.location.isNotEmpty)
|
||||
// Row 4: Location: label
|
||||
if (professional.location.isNotEmpty) ...[
|
||||
const Text(
|
||||
'Location:',
|
||||
style: TextStyle(
|
||||
fontFamily: 'Fractul',
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: AppColors.primaryDark,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
// Pin icon + location text
|
||||
Row(
|
||||
children: [
|
||||
const Text(
|
||||
'Location:',
|
||||
style: TextStyle(
|
||||
fontFamily: 'Fractul',
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: AppColors.primaryDark,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
SvgPicture.asset(
|
||||
'assets/icons/location_pin_icon.svg',
|
||||
width: 14,
|
||||
@@ -305,7 +433,7 @@ class TopProfessionalsSection extends ConsumerWidget {
|
||||
const SizedBox(width: 4),
|
||||
Expanded(
|
||||
child: Text(
|
||||
agent.location,
|
||||
professional.location,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'SourceSerif4',
|
||||
fontSize: 10,
|
||||
@@ -317,52 +445,35 @@ class TopProfessionalsSection extends ConsumerWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
|
||||
// Expertise
|
||||
if (agent.agentType != null)
|
||||
Row(
|
||||
children: [
|
||||
const Text(
|
||||
'Expertise:',
|
||||
style: TextStyle(
|
||||
fontFamily: 'Fractul',
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: AppColors.primaryDark,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'(${agent.agentType!.name})',
|
||||
style: const TextStyle(
|
||||
fontFamily: 'SourceSerif4',
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColors.primaryDark,
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
// Row 5: Expertise: label + tags
|
||||
if (professional.expertise.isNotEmpty) ...[
|
||||
const Text(
|
||||
'Expertise:',
|
||||
style: TextStyle(
|
||||
fontFamily: 'Fractul',
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: AppColors.primaryDark,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Tags from specializations
|
||||
if (agent.specializations.isNotEmpty)
|
||||
const SizedBox(height: 6),
|
||||
// Tags as bordered pills
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
children: agent.specializations
|
||||
runSpacing: 6,
|
||||
children: professional.expertise
|
||||
.take(6)
|
||||
.map((tag) => _buildTag(tag))
|
||||
.toList(),
|
||||
),
|
||||
],
|
||||
const Spacer(),
|
||||
|
||||
// Experience
|
||||
if (agent.experienceText.isNotEmpty)
|
||||
// Experience text
|
||||
if (professional.experience.isNotEmpty)
|
||||
RichText(
|
||||
text: TextSpan(
|
||||
children: [
|
||||
@@ -376,7 +487,7 @@ class TopProfessionalsSection extends ConsumerWidget {
|
||||
),
|
||||
),
|
||||
TextSpan(
|
||||
text: agent.experienceText,
|
||||
text: professional.experience,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'SourceSerif4',
|
||||
fontSize: 14,
|
||||
@@ -386,7 +497,30 @@ class TopProfessionalsSection extends ConsumerWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
|
||||
// 5 star rating icons row at bottom
|
||||
Row(
|
||||
children: List.generate(
|
||||
5,
|
||||
(index) => Padding(
|
||||
padding: const EdgeInsets.only(right: 4),
|
||||
child: SvgPicture.asset(
|
||||
'assets/icons/star_rating_icon.svg',
|
||||
width: 18,
|
||||
height: 18,
|
||||
placeholderBuilder: (_) => const Icon(
|
||||
Icons.star,
|
||||
color: Color(0xFFFFDE21),
|
||||
size: 18,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -427,9 +561,11 @@ class TopProfessionalsSection extends ConsumerWidget {
|
||||
Widget _buildProgressIndicator(int totalCards) {
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final indicatorWidth = totalCards > 0
|
||||
? constraints.maxWidth / totalCards
|
||||
: 103.0;
|
||||
final indicatorWidth =
|
||||
totalCards > 0 ? constraints.maxWidth / totalCards : 103.0;
|
||||
final offset = totalCards > 0
|
||||
? (_currentPage * constraints.maxWidth / totalCards)
|
||||
: 0.0;
|
||||
return Stack(
|
||||
children: [
|
||||
Container(
|
||||
@@ -440,12 +576,16 @@ class TopProfessionalsSection extends ConsumerWidget {
|
||||
border: Border.all(color: AppColors.primaryDark, width: 0.1),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 5,
|
||||
width: indicatorWidth.clamp(40.0, 150.0),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.primaryDark,
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
AnimatedPositioned(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
left: offset,
|
||||
child: Container(
|
||||
height: 5,
|
||||
width: indicatorWidth.clamp(40.0, 150.0),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.primaryDark,
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -454,7 +594,7 @@ class TopProfessionalsSection extends ConsumerWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildErrorState(WidgetRef ref, String error) {
|
||||
Widget _buildErrorState(String error) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 40),
|
||||
child: Column(
|
||||
@@ -476,8 +616,7 @@ class TopProfessionalsSection extends ConsumerWidget {
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
TextButton(
|
||||
onPressed: () =>
|
||||
ref.read(topProfessionalsProvider.notifier).refresh(),
|
||||
onPressed: () => ref.read(homeProvider.notifier).loadContent(),
|
||||
child: const Text(
|
||||
'Retry',
|
||||
style: TextStyle(
|
||||
@@ -493,19 +632,21 @@ class TopProfessionalsSection extends ConsumerWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildEmptyState(String activeTab) {
|
||||
Widget _buildEmptyState() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 40),
|
||||
child: Column(
|
||||
children: [
|
||||
Icon(
|
||||
activeTab == 'agents' ? Icons.people_outline : Icons.account_balance_outlined,
|
||||
_activeTab == 'agents'
|
||||
? Icons.people_outline
|
||||
: Icons.account_balance_outlined,
|
||||
color: AppColors.hintText,
|
||||
size: 48,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
'No ${activeTab == 'agents' ? 'agents' : 'lenders'} found',
|
||||
'No ${_activeTab == 'agents' ? 'agents' : 'lenders'} found',
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Fractul',
|
||||
fontSize: 14,
|
||||
@@ -518,7 +659,7 @@ class TopProfessionalsSection extends ConsumerWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSeeAllAgentsCta() {
|
||||
Widget _buildSeeAllAgentsCta(TopProfessionalsContent? content) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(24),
|
||||
@@ -541,20 +682,21 @@ class TopProfessionalsSection extends ConsumerWidget {
|
||||
child: Column(
|
||||
children: [
|
||||
Image.asset(
|
||||
'assets/icons/network_icon.svg',
|
||||
'assets/icons/network_icon.png',
|
||||
width: 30,
|
||||
height: 23,
|
||||
errorBuilder: (_, __, ___) => const Icon(
|
||||
errorBuilder: (_, e, s) => const Icon(
|
||||
Icons.hub,
|
||||
color: AppColors.primaryDark,
|
||||
size: 30,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
const Text(
|
||||
'Discover 5,000+ Top Real Estate Agents in Our Network',
|
||||
Text(
|
||||
content?.ctaText ??
|
||||
'Discover 5,000+ Top Real Estate Agents in Our Network.',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontFamily: 'SourceSerif4',
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
@@ -574,9 +716,9 @@ class TopProfessionalsSection extends ConsumerWidget {
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
child: const Text(
|
||||
'See All Agents',
|
||||
style: TextStyle(
|
||||
child: Text(
|
||||
content?.ctaButtonText ?? 'See All Agents',
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Fractul',
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
|
||||
Reference in New Issue
Block a user