From b5c3f6daf9ea510ec28e1f6a9e7eff20a60ee63a Mon Sep 17 00:00:00 2001 From: pradeepkumar Date: Sat, 21 Mar 2026 08:55:43 +0530 Subject: [PATCH] feat: Add agent profile verification status fields and display corresponding UI banners on the agent home screen. --- .../agents/data/models/agent_profile.dart | 8 ++ .../screens/agent_home_screen.dart | 126 ++++++++++++++++++ pubspec.yaml | 2 +- 3 files changed, 135 insertions(+), 1 deletion(-) diff --git a/lib/features/agents/data/models/agent_profile.dart b/lib/features/agents/data/models/agent_profile.dart index 6c70733..eca80e6 100644 --- a/lib/features/agents/data/models/agent_profile.dart +++ b/lib/features/agents/data/models/agent_profile.dart @@ -17,6 +17,8 @@ class AgentProfile { final double? averageRating; final int totalReviews; final bool isVerified; + final String? verificationStatus; + final String? verificationNote; final bool isFeatured; final bool isActive; final bool isAvailable; @@ -46,6 +48,8 @@ class AgentProfile { this.averageRating, this.totalReviews = 0, this.isVerified = false, + this.verificationStatus, + this.verificationNote, this.isFeatured = false, this.isActive = true, this.isAvailable = false, @@ -214,6 +218,8 @@ class AgentProfile { averageRating: averageRating, totalReviews: totalReviews, isVerified: isVerified, + verificationStatus: verificationStatus, + verificationNote: verificationNote, isFeatured: isFeatured, isActive: isActive, isAvailable: isAvailable ?? this.isAvailable, @@ -246,6 +252,8 @@ class AgentProfile { averageRating: (json['averageRating'] as num?)?.toDouble(), totalReviews: json['totalReviews'] as int? ?? 0, isVerified: json['isVerified'] as bool? ?? false, + verificationStatus: json['verificationStatus'] as String?, + verificationNote: json['verificationNote'] as String?, isFeatured: json['isFeatured'] as bool? ?? false, isActive: json['isActive'] as bool? ?? true, isAvailable: json['isAvailable'] as bool? ?? false, diff --git a/lib/features/agents/presentation/screens/agent_home_screen.dart b/lib/features/agents/presentation/screens/agent_home_screen.dart index 391017e..1eb1dd8 100644 --- a/lib/features/agents/presentation/screens/agent_home_screen.dart +++ b/lib/features/agents/presentation/screens/agent_home_screen.dart @@ -257,6 +257,7 @@ class _AgentHomeContentState extends ConsumerState<_AgentHomeContent> { child: Column( children: [ const SizedBox(height: 12), + _buildVerificationBanner(agent), _buildCoverAndAvatar(agent), const SizedBox(height: 16), _buildStatusSection(agent), @@ -278,6 +279,131 @@ class _AgentHomeContentState extends ConsumerState<_AgentHomeContent> { ); } + // ── Verification status banner ── + Widget _buildVerificationBanner(AgentProfile agent) { + final status = agent.verificationStatus; + if (status == null || status == 'APPROVED') return const SizedBox.shrink(); + + if (status == 'REJECTED') { + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 22, vertical: 0), + child: Container( + margin: const EdgeInsets.only(bottom: 12), + padding: const EdgeInsets.all(14), + decoration: BoxDecoration( + color: const Color(0xFFFEF2F2), + border: Border.all(color: const Color(0xFFFECACA)), + borderRadius: BorderRadius.circular(12), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Icon(Icons.warning_amber_rounded, size: 18, color: Colors.red[700]), + const SizedBox(width: 8), + Text('Profile Verification Rejected', + style: TextStyle(fontFamily: 'Fractul', fontSize: 14, fontWeight: FontWeight.w700, color: Colors.red[800])), + ], + ), + if (agent.verificationNote != null && agent.verificationNote!.isNotEmpty) ...[ + const SizedBox(height: 6), + Text('Reason: ${agent.verificationNote}', + style: TextStyle(fontFamily: 'SourceSerif4', fontSize: 13, color: Colors.red[700])), + ], + const SizedBox(height: 8), + Text('Please update your profile and documents, then resubmit.', + style: TextStyle(fontFamily: 'SourceSerif4', fontSize: 13, color: Colors.red[600])), + const SizedBox(height: 10), + GestureDetector( + onTap: () => context.push('/agent/edit-profile'), + child: Container( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), + decoration: BoxDecoration( + color: AppColors.accentOrange, + borderRadius: BorderRadius.circular(8), + ), + child: const Text('Update & Resubmit', + style: TextStyle(fontFamily: 'SourceSerif4', fontSize: 13, color: Colors.white, fontWeight: FontWeight.w600)), + ), + ), + ], + ), + ), + ); + } + + if (status == 'PENDING_REVIEW') { + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 22), + child: Container( + margin: const EdgeInsets.only(bottom: 12), + padding: const EdgeInsets.all(14), + decoration: BoxDecoration( + color: const Color(0xFFFEFCE8), + border: Border.all(color: const Color(0xFFFDE68A)), + borderRadius: BorderRadius.circular(12), + ), + child: Row( + children: [ + Container(width: 10, height: 10, decoration: const BoxDecoration(color: Color(0xFFFBBF24), shape: BoxShape.circle)), + const SizedBox(width: 10), + const Expanded( + child: Text('Profile verification is under review. You will be notified once approved.', + style: TextStyle(fontFamily: 'Fractul', fontSize: 13, fontWeight: FontWeight.w700, color: Color(0xFF854D0E))), + ), + ], + ), + ), + ); + } + + if (status == 'NONE') { + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 22), + child: Container( + margin: const EdgeInsets.only(bottom: 12), + padding: const EdgeInsets.all(14), + decoration: BoxDecoration( + color: const Color(0xFFEFF6FF), + border: Border.all(color: const Color(0xFFBFDBFE)), + borderRadius: BorderRadius.circular(12), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Icon(Icons.info_outline, size: 18, color: Colors.blue[700]), + const SizedBox(width: 8), + const Expanded( + child: Text('Complete your profile and upload verification documents to get verified.', + style: TextStyle(fontFamily: 'Fractul', fontSize: 13, fontWeight: FontWeight.w700, color: Color(0xFF1E40AF))), + ), + ], + ), + const SizedBox(height: 10), + GestureDetector( + onTap: () => context.push('/agent/edit-profile'), + child: Container( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), + decoration: BoxDecoration( + color: AppColors.accentOrange, + borderRadius: BorderRadius.circular(8), + ), + child: const Text('Complete Profile', + style: TextStyle(fontFamily: 'SourceSerif4', fontSize: 13, color: Colors.white, fontWeight: FontWeight.w600)), + ), + ), + ], + ), + ), + ); + } + + return const SizedBox.shrink(); + } + // ── Agent profile photo as cover image ── Widget _buildCoverAndAvatar(AgentProfile agent) { final screenWidth = MediaQuery.of(context).size.width; diff --git a/pubspec.yaml b/pubspec.yaml index 91cb235..b4b3059 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: real_estate_mobile description: "RE-Quest Real Estate Mobile App" publish_to: 'none' -version: 1.0.0+3 +version: 1.0.0+4 environment: sdk: ^3.10.1