feat: add id field to professional models and enable navigation to agent detail pages
This commit is contained in:
@@ -63,6 +63,7 @@ class TopProfessionalsContent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class ProfessionalItem {
|
class ProfessionalItem {
|
||||||
|
final String? id;
|
||||||
final String name;
|
final String name;
|
||||||
final String subtitle;
|
final String subtitle;
|
||||||
final String location;
|
final String location;
|
||||||
@@ -72,6 +73,7 @@ class ProfessionalItem {
|
|||||||
final double rating;
|
final double rating;
|
||||||
|
|
||||||
const ProfessionalItem({
|
const ProfessionalItem({
|
||||||
|
this.id,
|
||||||
required this.name,
|
required this.name,
|
||||||
this.subtitle = '',
|
this.subtitle = '',
|
||||||
this.location = '',
|
this.location = '',
|
||||||
@@ -83,6 +85,7 @@ class ProfessionalItem {
|
|||||||
|
|
||||||
factory ProfessionalItem.fromJson(Map<String, dynamic> json) {
|
factory ProfessionalItem.fromJson(Map<String, dynamic> json) {
|
||||||
return ProfessionalItem(
|
return ProfessionalItem(
|
||||||
|
id: json['id'] as String?,
|
||||||
name: json['name'] as String? ?? '',
|
name: json['name'] as String? ?? '',
|
||||||
subtitle: json['subtitle'] as String? ?? '',
|
subtitle: json['subtitle'] as String? ?? '',
|
||||||
location: json['location'] as String? ?? '',
|
location: json['location'] as String? ?? '',
|
||||||
@@ -127,6 +130,7 @@ class HeroContent {
|
|||||||
// --- Features Section ---
|
// --- Features Section ---
|
||||||
|
|
||||||
class FeaturedAgentItem {
|
class FeaturedAgentItem {
|
||||||
|
final String? id;
|
||||||
final String name;
|
final String name;
|
||||||
final String role;
|
final String role;
|
||||||
final String rating;
|
final String rating;
|
||||||
@@ -135,6 +139,7 @@ class FeaturedAgentItem {
|
|||||||
final String imageUrl;
|
final String imageUrl;
|
||||||
|
|
||||||
const FeaturedAgentItem({
|
const FeaturedAgentItem({
|
||||||
|
this.id,
|
||||||
this.name = '',
|
this.name = '',
|
||||||
this.role = '',
|
this.role = '',
|
||||||
this.rating = '',
|
this.rating = '',
|
||||||
@@ -145,6 +150,7 @@ class FeaturedAgentItem {
|
|||||||
|
|
||||||
factory FeaturedAgentItem.fromJson(Map<String, dynamic> json) {
|
factory FeaturedAgentItem.fromJson(Map<String, dynamic> json) {
|
||||||
return FeaturedAgentItem(
|
return FeaturedAgentItem(
|
||||||
|
id: json['id'] as String?,
|
||||||
name: json['name'] as String? ?? '',
|
name: json['name'] as String? ?? '',
|
||||||
role: json['role'] as String? ?? '',
|
role: json['role'] as String? ?? '',
|
||||||
rating: json['rating'] as String? ?? '',
|
rating: json['rating'] as String? ?? '',
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:shimmer/shimmer.dart';
|
import 'package:shimmer/shimmer.dart';
|
||||||
import 'package:real_estate_mobile/core/constants/app_colors.dart';
|
import 'package:real_estate_mobile/core/constants/app_colors.dart';
|
||||||
import 'package:real_estate_mobile/core/widgets/s3_image.dart';
|
import 'package:real_estate_mobile/core/widgets/s3_image.dart';
|
||||||
@@ -141,7 +142,7 @@ class _FeaturedProfessionalsSectionState
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildFeaturedCard(FeaturedAgentItem item, int index) {
|
Widget _buildFeaturedCard(FeaturedAgentItem item, int index) {
|
||||||
return Container(
|
final card = Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
borderRadius: BorderRadius.circular(15),
|
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) {
|
Widget _buildImagePlaceholder(int index) {
|
||||||
|
|||||||
@@ -300,7 +300,7 @@ class _TopProfessionalsSectionState
|
|||||||
final locationText = item.location;
|
final locationText = item.location;
|
||||||
final subtitle = item.subtitle.isNotEmpty ? '(${item.subtitle})' : '';
|
final subtitle = item.subtitle.isNotEmpty ? '(${item.subtitle})' : '';
|
||||||
|
|
||||||
return Container(
|
final card = Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
borderRadius: BorderRadius.circular(15),
|
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() {
|
Widget _buildShimmerCards() {
|
||||||
|
|||||||
Reference in New Issue
Block a user