refactor: convert horizontal wrap chips to full-width vertical stack list in agent screens
This commit is contained in:
@@ -1297,52 +1297,68 @@ class _ExpandableTagsWrapState extends State<_ExpandableTagsWrap> {
|
|||||||
_expanded ? widget.tags : widget.tags.take(widget.initialCount).toList();
|
_expanded ? widget.tags : widget.tags.take(widget.initialCount).toList();
|
||||||
final hasMore = widget.tags.length > widget.initialCount;
|
final hasMore = widget.tags.length > widget.initialCount;
|
||||||
|
|
||||||
|
// Each chip fills the row width so all chips share the same left edge.
|
||||||
return Column(
|
return Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
Wrap(
|
for (int i = 0; i < displayTags.length; i++) ...[
|
||||||
alignment: WrapAlignment.center,
|
if (i > 0) const SizedBox(height: 8),
|
||||||
spacing: 8,
|
Container(
|
||||||
runSpacing: 8,
|
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 10),
|
||||||
children: displayTags
|
decoration: BoxDecoration(
|
||||||
.map((tag) => Container(
|
borderRadius: BorderRadius.circular(15),
|
||||||
padding:
|
border: Border.all(
|
||||||
const EdgeInsets.symmetric(horizontal: 12, vertical: 5),
|
color: AppColors.primaryDark,
|
||||||
decoration: BoxDecoration(
|
width: 0.7,
|
||||||
borderRadius: BorderRadius.circular(15),
|
),
|
||||||
border: Border.all(
|
),
|
||||||
color: AppColors.primaryDark,
|
child: Text(
|
||||||
width: 0.7,
|
displayTags[i],
|
||||||
),
|
softWrap: true,
|
||||||
),
|
style: const TextStyle(
|
||||||
child: Text(
|
fontFamily: 'SourceSerif4',
|
||||||
tag,
|
fontSize: 14,
|
||||||
style: const TextStyle(
|
fontWeight: FontWeight.w400,
|
||||||
fontFamily: 'SourceSerif4',
|
color: AppColors.primaryDark,
|
||||||
fontSize: 14,
|
),
|
||||||
fontWeight: FontWeight.w400,
|
),
|
||||||
color: AppColors.primaryDark,
|
),
|
||||||
),
|
],
|
||||||
),
|
|
||||||
))
|
|
||||||
.toList(),
|
|
||||||
),
|
|
||||||
if (hasMore) ...[
|
if (hasMore) ...[
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
GestureDetector(
|
Align(
|
||||||
onTap: () => setState(() => _expanded = !_expanded),
|
alignment: Alignment.center,
|
||||||
child: Container(
|
child: GestureDetector(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
|
onTap: () => setState(() => _expanded = !_expanded),
|
||||||
decoration: BoxDecoration(
|
child: Container(
|
||||||
borderRadius: BorderRadius.circular(15),
|
padding:
|
||||||
border: Border.all(color: AppColors.accentOrange, width: 0.7),
|
const EdgeInsets.symmetric(horizontal: 16, vertical: 6),
|
||||||
),
|
decoration: BoxDecoration(
|
||||||
child: Text(
|
borderRadius: BorderRadius.circular(15),
|
||||||
_expanded ? 'Show Less' : 'Show More',
|
border:
|
||||||
style: const TextStyle(
|
Border.all(color: AppColors.accentOrange, width: 1),
|
||||||
fontFamily: 'SourceSerif4',
|
),
|
||||||
fontSize: 10,
|
child: Row(
|
||||||
fontWeight: FontWeight.w700,
|
mainAxisSize: MainAxisSize.min,
|
||||||
color: AppColors.accentOrange,
|
children: [
|
||||||
|
Text(
|
||||||
|
_expanded ? 'Show Less' : 'Show More',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontFamily: 'SourceSerif4',
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
color: AppColors.accentOrange,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 4),
|
||||||
|
Icon(
|
||||||
|
_expanded
|
||||||
|
? Icons.keyboard_arrow_up
|
||||||
|
: Icons.keyboard_arrow_down,
|
||||||
|
size: 14,
|
||||||
|
color: AppColors.accentOrange,
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -1380,7 +1396,7 @@ class _ExpandableChipsSectionState extends State<_ExpandableChipsSection> {
|
|||||||
final hasMore = widget.items.length > widget.initialCount;
|
final hasMore = widget.items.length > widget.initialCount;
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
widget.title,
|
widget.title,
|
||||||
@@ -1392,85 +1408,80 @@ class _ExpandableChipsSectionState extends State<_ExpandableChipsSection> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 14),
|
const SizedBox(height: 14),
|
||||||
Wrap(
|
// Each chip fills the row so all start at the same left edge.
|
||||||
spacing: 10,
|
for (int i = 0; i < showItems.length; i++) ...[
|
||||||
runSpacing: 10,
|
if (i > 0) const SizedBox(height: 10),
|
||||||
children: [
|
Container(
|
||||||
...showItems.map(
|
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 10),
|
||||||
(item) => IntrinsicWidth(
|
decoration: BoxDecoration(
|
||||||
child: Container(
|
borderRadius: BorderRadius.circular(15),
|
||||||
height: 28,
|
border: Border.all(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
color: AppColors.primaryDark,
|
||||||
alignment: Alignment.center,
|
width: 0.7,
|
||||||
decoration: BoxDecoration(
|
),
|
||||||
borderRadius: BorderRadius.circular(15),
|
),
|
||||||
border: Border.all(
|
child: Text(
|
||||||
color: AppColors.primaryDark,
|
showItems[i],
|
||||||
width: 0.7,
|
softWrap: true,
|
||||||
),
|
style: const TextStyle(
|
||||||
|
fontFamily: 'SourceSerif4',
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: AppColors.primaryDark,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
if (hasMore || _expanded) ...[
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Align(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () => setState(() => _expanded = !_expanded),
|
||||||
|
child: Container(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 16, vertical: 6),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(15),
|
||||||
|
border: Border.all(
|
||||||
|
color: _expanded
|
||||||
|
? AppColors.accentOrange
|
||||||
|
: AppColors.primaryDark.withValues(alpha: 0.15),
|
||||||
|
width: 1,
|
||||||
),
|
),
|
||||||
child: Text(
|
),
|
||||||
item,
|
child: Row(
|
||||||
style: const TextStyle(
|
mainAxisSize: MainAxisSize.min,
|
||||||
fontFamily: 'SourceSerif4',
|
children: [
|
||||||
fontSize: 14,
|
Text(
|
||||||
fontWeight: FontWeight.w500,
|
_expanded
|
||||||
color: AppColors.primaryDark,
|
? 'Show Less'
|
||||||
|
: '+${widget.items.length - widget.initialCount} More',
|
||||||
|
style: TextStyle(
|
||||||
|
fontFamily: 'SourceSerif4',
|
||||||
|
fontSize: _expanded ? 13 : 13,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
color: _expanded
|
||||||
|
? AppColors.accentOrange
|
||||||
|
: AppColors.primaryDark,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(width: 4),
|
||||||
|
Icon(
|
||||||
|
_expanded
|
||||||
|
? Icons.keyboard_arrow_up
|
||||||
|
: Icons.keyboard_arrow_down,
|
||||||
|
size: 14,
|
||||||
|
color: _expanded
|
||||||
|
? AppColors.accentOrange
|
||||||
|
: AppColors.primaryDark,
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (hasMore || _expanded)
|
),
|
||||||
GestureDetector(
|
],
|
||||||
onTap: () => setState(() => _expanded = !_expanded),
|
|
||||||
child: IntrinsicWidth(
|
|
||||||
child: Container(
|
|
||||||
height: 28,
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
|
||||||
alignment: Alignment.center,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(15),
|
|
||||||
border: Border.all(
|
|
||||||
color: _expanded
|
|
||||||
? AppColors.accentOrange
|
|
||||||
: AppColors.primaryDark.withValues(alpha: 0.15),
|
|
||||||
width: 1,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
_expanded
|
|
||||||
? 'Show Less'
|
|
||||||
: '+${widget.items.length - widget.initialCount} More',
|
|
||||||
style: TextStyle(
|
|
||||||
fontFamily: 'SourceSerif4',
|
|
||||||
fontSize: _expanded ? 13 : 15,
|
|
||||||
fontWeight: _expanded
|
|
||||||
? FontWeight.w700
|
|
||||||
: FontWeight.w300,
|
|
||||||
color: _expanded
|
|
||||||
? AppColors.accentOrange
|
|
||||||
: AppColors.primaryDark,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (_expanded) ...[
|
|
||||||
const SizedBox(width: 2),
|
|
||||||
const Icon(
|
|
||||||
Icons.keyboard_arrow_up,
|
|
||||||
size: 14,
|
|
||||||
color: AppColors.accentOrange,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 14),
|
const SizedBox(height: 14),
|
||||||
Divider(
|
Divider(
|
||||||
color: AppColors.primaryDark.withValues(alpha: 0.15),
|
color: AppColors.primaryDark.withValues(alpha: 0.15),
|
||||||
|
|||||||
@@ -969,14 +969,19 @@ class _AgentHomeContentState extends ConsumerState<_AgentHomeContent> {
|
|||||||
color: AppColors.primaryDark)),
|
color: AppColors.primaryDark)),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
_buildTagsWrap(
|
// Force chips to fill the row so every chip starts at the same
|
||||||
state.expertiseYears
|
// left edge — prevents short chips from appearing centered.
|
||||||
.map((e) => e['years']!.isNotEmpty
|
SizedBox(
|
||||||
? '${e['area']} – ${e['years']}'
|
width: double.infinity,
|
||||||
: e['area']!)
|
child: _buildTagsWrap(
|
||||||
.toList(),
|
state.expertiseYears
|
||||||
sectionKey: 'expertise',
|
.map((e) => e['years']!.isNotEmpty
|
||||||
initialCount: 4,
|
? '${e['area']} – ${e['years']}'
|
||||||
|
: e['area']!)
|
||||||
|
.toList(),
|
||||||
|
sectionKey: 'expertise',
|
||||||
|
initialCount: 4,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
if (state.certifications.isNotEmpty) ...[
|
if (state.certifications.isNotEmpty) ...[
|
||||||
@@ -1113,70 +1118,81 @@ class _AgentHomeContentState extends ConsumerState<_AgentHomeContent> {
|
|||||||
isExpanded ? tags : tags.take(initialCount).toList();
|
isExpanded ? tags : tags.take(initialCount).toList();
|
||||||
final remaining = tags.length - initialCount;
|
final remaining = tags.length - initialCount;
|
||||||
|
|
||||||
// Cap each chip's width so long taglines wrap inside the chip instead
|
// Each chip fills the full row width so all chips start at the same
|
||||||
// of overflowing the Wrap's row and clipping behind ancestor bounds.
|
// left edge regardless of text length. Long text wraps inside the chip.
|
||||||
return LayoutBuilder(
|
return Column(
|
||||||
builder: (ctx, constraints) {
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
final maxChipWidth = constraints.maxWidth.isFinite
|
children: [
|
||||||
? constraints.maxWidth
|
for (int i = 0; i < displayTags.length; i++) ...[
|
||||||
: MediaQuery.of(ctx).size.width - 32;
|
if (i > 0) const SizedBox(height: 8),
|
||||||
return Wrap(
|
Container(
|
||||||
spacing: 8,
|
padding: const EdgeInsets.symmetric(
|
||||||
runSpacing: 8,
|
horizontal: 14, vertical: 10),
|
||||||
children: [
|
decoration: BoxDecoration(
|
||||||
...displayTags.map((tag) => ConstrainedBox(
|
borderRadius: BorderRadius.circular(15),
|
||||||
constraints: BoxConstraints(maxWidth: maxChipWidth),
|
border:
|
||||||
child: Container(
|
Border.all(color: AppColors.primaryDark, width: 0.7),
|
||||||
padding: const EdgeInsets.symmetric(
|
),
|
||||||
horizontal: 12, vertical: 6),
|
child: Text(
|
||||||
decoration: BoxDecoration(
|
displayTags[i],
|
||||||
borderRadius: BorderRadius.circular(15),
|
softWrap: true,
|
||||||
border: Border.all(
|
style: const TextStyle(
|
||||||
color: AppColors.primaryDark, width: 0.7),
|
fontFamily: 'SourceSerif4',
|
||||||
),
|
fontSize: 14,
|
||||||
child: Text(
|
fontWeight: FontWeight.w500,
|
||||||
tag,
|
color: AppColors.primaryDark),
|
||||||
softWrap: true,
|
),
|
||||||
style: const TextStyle(
|
),
|
||||||
fontFamily: 'SourceSerif4',
|
],
|
||||||
fontSize: 14,
|
if (remaining > 0) ...[
|
||||||
fontWeight: FontWeight.w500,
|
const SizedBox(height: 8),
|
||||||
color: AppColors.primaryDark),
|
Align(
|
||||||
),
|
alignment: Alignment.center,
|
||||||
),
|
child: GestureDetector(
|
||||||
)),
|
onTap: () {
|
||||||
if (remaining > 0)
|
setState(() {
|
||||||
GestureDetector(
|
if (isExpanded) {
|
||||||
onTap: () {
|
_expandedTagSections.remove(sectionKey);
|
||||||
setState(() {
|
} else {
|
||||||
if (isExpanded) {
|
_expandedTagSections.add(sectionKey);
|
||||||
_expandedTagSections.remove(sectionKey);
|
}
|
||||||
} else {
|
});
|
||||||
_expandedTagSections.add(sectionKey);
|
},
|
||||||
}
|
behavior: HitTestBehavior.opaque,
|
||||||
});
|
child: Container(
|
||||||
},
|
padding: const EdgeInsets.symmetric(
|
||||||
behavior: HitTestBehavior.opaque,
|
horizontal: 16, vertical: 6),
|
||||||
child: Container(
|
decoration: BoxDecoration(
|
||||||
padding: const EdgeInsets.symmetric(
|
borderRadius: BorderRadius.circular(15),
|
||||||
horizontal: 12, vertical: 6),
|
border: Border.all(
|
||||||
decoration: BoxDecoration(
|
color: AppColors.accentOrange, width: 1),
|
||||||
borderRadius: BorderRadius.circular(15),
|
),
|
||||||
border: Border.all(
|
child: Row(
|
||||||
color: AppColors.primaryDark, width: 0.1),
|
mainAxisSize: MainAxisSize.min,
|
||||||
),
|
children: [
|
||||||
child: Text(
|
Text(
|
||||||
isExpanded ? 'Show Less' : '+$remaining More',
|
isExpanded ? 'Show Less' : '+$remaining More',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontFamily: 'SourceSerif4',
|
fontFamily: 'SourceSerif4',
|
||||||
fontSize: 15,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.w300,
|
fontWeight: FontWeight.w600,
|
||||||
color: AppColors.primaryDark)),
|
color: AppColors.accentOrange),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 4),
|
||||||
|
Icon(
|
||||||
|
isExpanded
|
||||||
|
? Icons.keyboard_arrow_up
|
||||||
|
: Icons.keyboard_arrow_down,
|
||||||
|
size: 14,
|
||||||
|
color: AppColors.accentOrange,
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
);
|
),
|
||||||
},
|
],
|
||||||
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -753,46 +753,55 @@ class _AgentCardState extends State<_AgentCard> {
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
|
|
||||||
// Expertise tags
|
// Expertise tags — full-width pills, all start at same left edge
|
||||||
if (specializations.isNotEmpty) ...[
|
if (specializations.isNotEmpty) ...[
|
||||||
Wrap(
|
Builder(builder: (_) {
|
||||||
alignment: WrapAlignment.start,
|
final visible = _tagsExpanded
|
||||||
spacing: 6,
|
? specializations
|
||||||
runSpacing: 6,
|
: specializations.take(6).toList();
|
||||||
children: [
|
return Column(
|
||||||
...(_tagsExpanded
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
? specializations
|
children: [
|
||||||
: specializations.take(6))
|
for (int i = 0; i < visible.length; i++) ...[
|
||||||
.map((tag) => _buildTag(tag)),
|
if (i > 0) const SizedBox(height: 6),
|
||||||
if (specializations.length > 6)
|
_buildTag(visible[i]),
|
||||||
GestureDetector(
|
],
|
||||||
onTap: () =>
|
if (specializations.length > 6) ...[
|
||||||
setState(() => _tagsExpanded = !_tagsExpanded),
|
const SizedBox(height: 8),
|
||||||
child: Container(
|
Align(
|
||||||
padding: const EdgeInsets.symmetric(
|
alignment: Alignment.center,
|
||||||
horizontal: 10, vertical: 5),
|
child: GestureDetector(
|
||||||
decoration: BoxDecoration(
|
onTap: () => setState(
|
||||||
borderRadius: BorderRadius.circular(20),
|
() => _tagsExpanded = !_tagsExpanded),
|
||||||
color: AppColors.accentOrange
|
child: Container(
|
||||||
.withValues(alpha: 0.1),
|
padding: const EdgeInsets.symmetric(
|
||||||
border: Border.all(
|
horizontal: 12, vertical: 5),
|
||||||
color: AppColors.accentOrange, width: 0.7),
|
decoration: BoxDecoration(
|
||||||
),
|
borderRadius: BorderRadius.circular(20),
|
||||||
child: Text(
|
color: AppColors.accentOrange
|
||||||
_tagsExpanded
|
.withValues(alpha: 0.1),
|
||||||
? 'Show Less'
|
border: Border.all(
|
||||||
: '+${specializations.length - 6} more',
|
color: AppColors.accentOrange,
|
||||||
style: const TextStyle(
|
width: 0.7),
|
||||||
fontFamily: 'SourceSerif4',
|
),
|
||||||
fontSize: 13,
|
child: Text(
|
||||||
fontWeight: FontWeight.w600,
|
_tagsExpanded
|
||||||
color: AppColors.accentOrange,
|
? 'Show Less'
|
||||||
|
: '+${specializations.length - 6} more',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontFamily: 'SourceSerif4',
|
||||||
|
fontSize: 13,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: AppColors.accentOrange,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
],
|
||||||
),
|
);
|
||||||
|
}),
|
||||||
const SizedBox(height: 14),
|
const SizedBox(height: 14),
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user