From d3f23f9c53fa7f4804b81b7ef9db9238768c1b81 Mon Sep 17 00:00:00 2001 From: pradeepkumar Date: Mon, 20 Apr 2026 10:32:12 +0530 Subject: [PATCH] feat: add id field to professional models and enable navigation to agent detail pages --- .../home/data/models/landing_page_content.dart | 6 ++++++ .../widgets/featured_professionals_section.dart | 15 ++++++++++++++- .../widgets/top_professionals_section.dart | 14 +++++++++++++- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/lib/features/home/data/models/landing_page_content.dart b/lib/features/home/data/models/landing_page_content.dart index d935edd..4856ba4 100644 --- a/lib/features/home/data/models/landing_page_content.dart +++ b/lib/features/home/data/models/landing_page_content.dart @@ -63,6 +63,7 @@ class TopProfessionalsContent { } class ProfessionalItem { + final String? id; final String name; final String subtitle; final String location; @@ -72,6 +73,7 @@ class ProfessionalItem { final double rating; const ProfessionalItem({ + this.id, required this.name, this.subtitle = '', this.location = '', @@ -83,6 +85,7 @@ class ProfessionalItem { factory ProfessionalItem.fromJson(Map json) { return ProfessionalItem( + id: json['id'] as String?, name: json['name'] as String? ?? '', subtitle: json['subtitle'] as String? ?? '', location: json['location'] as String? ?? '', @@ -127,6 +130,7 @@ class HeroContent { // --- Features Section --- class FeaturedAgentItem { + final String? id; final String name; final String role; final String rating; @@ -135,6 +139,7 @@ class FeaturedAgentItem { final String imageUrl; const FeaturedAgentItem({ + this.id, this.name = '', this.role = '', this.rating = '', @@ -145,6 +150,7 @@ class FeaturedAgentItem { factory FeaturedAgentItem.fromJson(Map json) { return FeaturedAgentItem( + id: json['id'] as String?, name: json['name'] as String? ?? '', role: json['role'] as String? ?? '', rating: json['rating'] as String? ?? '', diff --git a/lib/features/home/presentation/widgets/featured_professionals_section.dart b/lib/features/home/presentation/widgets/featured_professionals_section.dart index 459b802..a166479 100644 --- a/lib/features/home/presentation/widgets/featured_professionals_section.dart +++ b/lib/features/home/presentation/widgets/featured_professionals_section.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:go_router/go_router.dart'; import 'package:shimmer/shimmer.dart'; import 'package:real_estate_mobile/core/constants/app_colors.dart'; import 'package:real_estate_mobile/core/widgets/s3_image.dart'; @@ -141,7 +142,7 @@ class _FeaturedProfessionalsSectionState } Widget _buildFeaturedCard(FeaturedAgentItem item, int index) { - return Container( + final card = Container( decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(15), @@ -306,6 +307,18 @@ class _FeaturedProfessionalsSectionState ], ), ); + + if (item.id != null && item.id!.isNotEmpty) { + return Material( + color: Colors.transparent, + child: InkWell( + borderRadius: BorderRadius.circular(15), + onTap: () => context.push('/agents/detail/${item.id}'), + child: card, + ), + ); + } + return card; } Widget _buildImagePlaceholder(int index) { diff --git a/lib/features/home/presentation/widgets/top_professionals_section.dart b/lib/features/home/presentation/widgets/top_professionals_section.dart index 07eda63..c72b1c6 100644 --- a/lib/features/home/presentation/widgets/top_professionals_section.dart +++ b/lib/features/home/presentation/widgets/top_professionals_section.dart @@ -300,7 +300,7 @@ class _TopProfessionalsSectionState final locationText = item.location; final subtitle = item.subtitle.isNotEmpty ? '(${item.subtitle})' : ''; - return Container( + final card = Container( decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(15), @@ -538,6 +538,18 @@ class _TopProfessionalsSectionState ], ), ); + + if (item.id != null && item.id!.isNotEmpty) { + return Material( + color: Colors.transparent, + child: InkWell( + borderRadius: BorderRadius.circular(15), + onTap: () => context.push('/agents/detail/${item.id}'), + child: card, + ), + ); + } + return card; } Widget _buildShimmerCards() {