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:
@@ -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,9 +1096,20 @@ class _AgentHomeContentState extends ConsumerState<_AgentHomeContent> {
|
||||
height: 1.8),
|
||||
),
|
||||
)),
|
||||
if (card.values.length > 5) ...[
|
||||
if (hasMore) ...[
|
||||
const SizedBox(height: 8),
|
||||
Container(
|
||||
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(
|
||||
@@ -1104,18 +1120,23 @@ class _AgentHomeContentState extends ConsumerState<_AgentHomeContent> {
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Text('Show More',
|
||||
style: TextStyle(
|
||||
Text(isExpanded ? 'Show Less' : 'Show More',
|
||||
style: const 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),
|
||||
Icon(
|
||||
isExpanded
|
||||
? Icons.keyboard_arrow_up
|
||||
: Icons.keyboard_arrow_down,
|
||||
size: 14,
|
||||
color: AppColors.accentOrange),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user