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.

This commit is contained in:
pradeepkumar
2026-03-15 00:50:03 +05:30
parent b7f131c677
commit d5a92e0b94

View File

@@ -1057,6 +1057,11 @@ class _AgentHomeContentState extends ConsumerState<_AgentHomeContent> {
Widget _buildSpecCard(SpecializationCard card) { Widget _buildSpecCard(SpecializationCard card) {
final displayName = AgentDetailState.titleCase(card.name); 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( return Container(
margin: const EdgeInsets.symmetric(horizontal: 66, vertical: 8), margin: const EdgeInsets.symmetric(horizontal: 66, vertical: 8),
width: 298, width: 298,
@@ -1079,7 +1084,7 @@ class _AgentHomeContentState extends ConsumerState<_AgentHomeContent> {
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: AppColors.primaryDark)), color: AppColors.primaryDark)),
const SizedBox(height: 12), const SizedBox(height: 12),
...card.values.take(5).map((val) => Padding( ...displayValues.map((val) => Padding(
padding: const EdgeInsets.symmetric(vertical: 4), padding: const EdgeInsets.symmetric(vertical: 4),
child: Text( child: Text(
AgentDetailState.titleCase(val), AgentDetailState.titleCase(val),
@@ -1091,9 +1096,20 @@ class _AgentHomeContentState extends ConsumerState<_AgentHomeContent> {
height: 1.8), height: 1.8),
), ),
)), )),
if (card.values.length > 5) ...[ if (hasMore) ...[
const SizedBox(height: 8), const SizedBox(height: 8),
Container( GestureDetector(
onTap: () {
setState(() {
if (isExpanded) {
_expandedTagSections.remove(sectionKey);
} else {
_expandedTagSections.add(sectionKey);
}
});
},
behavior: HitTestBehavior.opaque,
child: Container(
padding: padding:
const EdgeInsets.symmetric(horizontal: 16, vertical: 4), const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
decoration: BoxDecoration( decoration: BoxDecoration(
@@ -1104,18 +1120,23 @@ class _AgentHomeContentState extends ConsumerState<_AgentHomeContent> {
child: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
const Text('Show More', Text(isExpanded ? 'Show Less' : 'Show More',
style: TextStyle( style: const TextStyle(
fontFamily: 'SourceSerif4', fontFamily: 'SourceSerif4',
fontSize: 10, fontSize: 10,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: AppColors.accentOrange)), color: AppColors.accentOrange)),
const SizedBox(width: 4), const SizedBox(width: 4),
Icon(Icons.keyboard_arrow_down, Icon(
size: 14, color: AppColors.accentOrange), isExpanded
? Icons.keyboard_arrow_up
: Icons.keyboard_arrow_down,
size: 14,
color: AppColors.accentOrange),
], ],
), ),
), ),
),
], ],
], ],
), ),