refactor: convert horizontal wrap chips to full-width vertical stack list in agent screens
This commit is contained in:
@@ -969,14 +969,19 @@ class _AgentHomeContentState extends ConsumerState<_AgentHomeContent> {
|
||||
color: AppColors.primaryDark)),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
_buildTagsWrap(
|
||||
state.expertiseYears
|
||||
.map((e) => e['years']!.isNotEmpty
|
||||
? '${e['area']} – ${e['years']}'
|
||||
: e['area']!)
|
||||
.toList(),
|
||||
sectionKey: 'expertise',
|
||||
initialCount: 4,
|
||||
// Force chips to fill the row so every chip starts at the same
|
||||
// left edge — prevents short chips from appearing centered.
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: _buildTagsWrap(
|
||||
state.expertiseYears
|
||||
.map((e) => e['years']!.isNotEmpty
|
||||
? '${e['area']} – ${e['years']}'
|
||||
: e['area']!)
|
||||
.toList(),
|
||||
sectionKey: 'expertise',
|
||||
initialCount: 4,
|
||||
),
|
||||
),
|
||||
],
|
||||
if (state.certifications.isNotEmpty) ...[
|
||||
@@ -1113,70 +1118,81 @@ class _AgentHomeContentState extends ConsumerState<_AgentHomeContent> {
|
||||
isExpanded ? tags : tags.take(initialCount).toList();
|
||||
final remaining = tags.length - initialCount;
|
||||
|
||||
// Cap each chip's width so long taglines wrap inside the chip instead
|
||||
// of overflowing the Wrap's row and clipping behind ancestor bounds.
|
||||
return LayoutBuilder(
|
||||
builder: (ctx, constraints) {
|
||||
final maxChipWidth = constraints.maxWidth.isFinite
|
||||
? constraints.maxWidth
|
||||
: MediaQuery.of(ctx).size.width - 32;
|
||||
return Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
children: [
|
||||
...displayTags.map((tag) => ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: maxChipWidth),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12, vertical: 6),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
border: Border.all(
|
||||
color: AppColors.primaryDark, width: 0.7),
|
||||
),
|
||||
child: Text(
|
||||
tag,
|
||||
softWrap: true,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'SourceSerif4',
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.primaryDark),
|
||||
),
|
||||
),
|
||||
)),
|
||||
if (remaining > 0)
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
if (isExpanded) {
|
||||
_expandedTagSections.remove(sectionKey);
|
||||
} else {
|
||||
_expandedTagSections.add(sectionKey);
|
||||
}
|
||||
});
|
||||
},
|
||||
behavior: HitTestBehavior.opaque,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12, vertical: 6),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
border: Border.all(
|
||||
color: AppColors.primaryDark, width: 0.1),
|
||||
),
|
||||
child: Text(
|
||||
// Each chip fills the full row width so all chips start at the same
|
||||
// left edge regardless of text length. Long text wraps inside the chip.
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
for (int i = 0; i < displayTags.length; i++) ...[
|
||||
if (i > 0) const SizedBox(height: 8),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 14, vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
border:
|
||||
Border.all(color: AppColors.primaryDark, width: 0.7),
|
||||
),
|
||||
child: Text(
|
||||
displayTags[i],
|
||||
softWrap: true,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'SourceSerif4',
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.primaryDark),
|
||||
),
|
||||
),
|
||||
],
|
||||
if (remaining > 0) ...[
|
||||
const SizedBox(height: 8),
|
||||
Align(
|
||||
alignment: Alignment.center,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
if (isExpanded) {
|
||||
_expandedTagSections.remove(sectionKey);
|
||||
} else {
|
||||
_expandedTagSections.add(sectionKey);
|
||||
}
|
||||
});
|
||||
},
|
||||
behavior: HitTestBehavior.opaque,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16, vertical: 6),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
border: Border.all(
|
||||
color: AppColors.accentOrange, width: 1),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
isExpanded ? 'Show Less' : '+$remaining More',
|
||||
style: const TextStyle(
|
||||
fontFamily: 'SourceSerif4',
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w300,
|
||||
color: AppColors.primaryDark)),
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
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