From d5a92e0b94769eba54df5ecd63e88bc7595b4dea Mon Sep 17 00:00:00 2001 From: pradeepkumar Date: Sun, 15 Mar 2026 00:50:03 +0530 Subject: [PATCH] feat: Implement 'Show More/Less' for agent specialization cards, enhance dynamic form field controller management in agent profile editing, and move the agent edit profile route to a standalone screen. --- .../screens/agent_home_screen.dart | 67 ++++++++++++------- 1 file changed, 44 insertions(+), 23 deletions(-) diff --git a/lib/features/agents/presentation/screens/agent_home_screen.dart b/lib/features/agents/presentation/screens/agent_home_screen.dart index 3192549..56139a8 100644 --- a/lib/features/agents/presentation/screens/agent_home_screen.dart +++ b/lib/features/agents/presentation/screens/agent_home_screen.dart @@ -1057,6 +1057,11 @@ class _AgentHomeContentState extends ConsumerState<_AgentHomeContent> { Widget _buildSpecCard(SpecializationCard card) { final displayName = AgentDetailState.titleCase(card.name); + final sectionKey = 'spec_${card.slug}'; + final isExpanded = _expandedTagSections.contains(sectionKey); + final displayValues = isExpanded ? card.values : card.values.take(5).toList(); + final hasMore = card.values.length > 5; + return Container( margin: const EdgeInsets.symmetric(horizontal: 66, vertical: 8), width: 298, @@ -1079,7 +1084,7 @@ class _AgentHomeContentState extends ConsumerState<_AgentHomeContent> { fontWeight: FontWeight.w700, color: AppColors.primaryDark)), const SizedBox(height: 12), - ...card.values.take(5).map((val) => Padding( + ...displayValues.map((val) => Padding( padding: const EdgeInsets.symmetric(vertical: 4), child: Text( AgentDetailState.titleCase(val), @@ -1091,29 +1096,45 @@ class _AgentHomeContentState extends ConsumerState<_AgentHomeContent> { height: 1.8), ), )), - if (card.values.length > 5) ...[ + if (hasMore) ...[ const SizedBox(height: 8), - Container( - padding: - const EdgeInsets.symmetric(horizontal: 16, vertical: 4), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15), - border: - Border.all(color: AppColors.accentOrange, width: 1), - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - const Text('Show More', - style: TextStyle( - fontFamily: 'SourceSerif4', - fontSize: 10, - fontWeight: FontWeight.w700, - color: AppColors.accentOrange)), - const SizedBox(width: 4), - Icon(Icons.keyboard_arrow_down, - size: 14, color: AppColors.accentOrange), - ], + GestureDetector( + onTap: () { + setState(() { + if (isExpanded) { + _expandedTagSections.remove(sectionKey); + } else { + _expandedTagSections.add(sectionKey); + } + }); + }, + behavior: HitTestBehavior.opaque, + child: Container( + padding: + const EdgeInsets.symmetric(horizontal: 16, vertical: 4), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + border: + Border.all(color: AppColors.accentOrange, width: 1), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Text(isExpanded ? 'Show Less' : 'Show More', + style: const TextStyle( + fontFamily: 'SourceSerif4', + fontSize: 10, + fontWeight: FontWeight.w700, + color: AppColors.accentOrange)), + const SizedBox(width: 4), + Icon( + isExpanded + ? Icons.keyboard_arrow_up + : Icons.keyboard_arrow_down, + size: 14, + color: AppColors.accentOrange), + ], + ), ), ), ],