feat: Enhance messaging read receipts and auto-read, fix auth 401 error suppression during logout, and refine agent profile expertise
This commit is contained in:
@@ -151,23 +151,21 @@ class AgentProfile {
|
||||
}
|
||||
|
||||
/// Get specializations / expertise from field values.
|
||||
/// Matches web's getExpertiseTags slugs.
|
||||
/// Matches web's getExpertiseTags slugs exactly.
|
||||
List<String> get specializations {
|
||||
final tags = <String>[];
|
||||
// Must match web's expertiseFieldSlugs exactly (exact match, not contains)
|
||||
const expertiseSlugs = [
|
||||
'about_me_expertise',
|
||||
'expertise_areas',
|
||||
'specializations',
|
||||
'areas_of_expertise',
|
||||
'expertise',
|
||||
'specialization',
|
||||
'property_type',
|
||||
'loan_type',
|
||||
];
|
||||
|
||||
for (final fv in fieldValues) {
|
||||
final slug = fv.fieldSlug.toLowerCase();
|
||||
if (!expertiseSlugs.any((s) => slug.contains(s))) continue;
|
||||
if (!expertiseSlugs.contains(slug)) continue;
|
||||
|
||||
if (fv.jsonValue is List) {
|
||||
for (final v in (fv.jsonValue as List)) {
|
||||
|
||||
@@ -1299,6 +1299,13 @@ class _AgentHomeContentState extends ConsumerState<_AgentHomeContent> {
|
||||
Widget _buildTestimonialsSection(AgentDetailState state) {
|
||||
if (state.testimonials.isEmpty) return const SizedBox.shrink();
|
||||
|
||||
// Calculate average rating dynamically
|
||||
final totalRating = state.testimonials.fold<double>(
|
||||
0, (sum, t) => sum + ((t['rating'] as num?)?.toDouble() ?? 5.0),
|
||||
);
|
||||
final avgRating = (totalRating / state.testimonials.length).toStringAsFixed(1);
|
||||
final count = state.testimonials.length;
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24),
|
||||
child: Column(
|
||||
@@ -1318,9 +1325,9 @@ class _AgentHomeContentState extends ConsumerState<_AgentHomeContent> {
|
||||
height: 1,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
const Text(
|
||||
'Clients rate our real estate services 4.9 out of 5 on average, based on recent client reviews.',
|
||||
style: TextStyle(
|
||||
Text(
|
||||
'Clients rate our real estate services $avgRating out of 5 on average, based on $count recent client review${count != 1 ? 's' : ''}.',
|
||||
style: const TextStyle(
|
||||
fontFamily: 'SourceSerif4',
|
||||
fontSize: 14,
|
||||
color: AppColors.primaryDark,
|
||||
|
||||
@@ -798,11 +798,9 @@ class _AgentCardState extends State<_AgentCard> {
|
||||
|
||||
Widget _buildTag(String label) {
|
||||
return Container(
|
||||
height: 28,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
alignment: Alignment.center,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 5),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
border: Border.all(color: AppColors.primaryDark, width: 0.7),
|
||||
),
|
||||
child: Text(
|
||||
@@ -812,7 +810,6 @@ class _AgentCardState extends State<_AgentCard> {
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColors.primaryDark,
|
||||
height: 1,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user