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) {
|
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,29 +1096,45 @@ 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(
|
||||||
padding:
|
onTap: () {
|
||||||
const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
|
setState(() {
|
||||||
decoration: BoxDecoration(
|
if (isExpanded) {
|
||||||
borderRadius: BorderRadius.circular(15),
|
_expandedTagSections.remove(sectionKey);
|
||||||
border:
|
} else {
|
||||||
Border.all(color: AppColors.accentOrange, width: 1),
|
_expandedTagSections.add(sectionKey);
|
||||||
),
|
}
|
||||||
child: Row(
|
});
|
||||||
mainAxisSize: MainAxisSize.min,
|
},
|
||||||
children: [
|
behavior: HitTestBehavior.opaque,
|
||||||
const Text('Show More',
|
child: Container(
|
||||||
style: TextStyle(
|
padding:
|
||||||
fontFamily: 'SourceSerif4',
|
const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
|
||||||
fontSize: 10,
|
decoration: BoxDecoration(
|
||||||
fontWeight: FontWeight.w700,
|
borderRadius: BorderRadius.circular(15),
|
||||||
color: AppColors.accentOrange)),
|
border:
|
||||||
const SizedBox(width: 4),
|
Border.all(color: AppColors.accentOrange, width: 1),
|
||||||
Icon(Icons.keyboard_arrow_down,
|
),
|
||||||
size: 14, color: AppColors.accentOrange),
|
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),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user