feat: Implement expandable expertise tags on the agent detail screen and adjust chat screen lifecycle to clear active conversation in deactivate.

This commit is contained in:
pradeepkumar
2026-03-20 02:42:01 +05:30
parent 38423d1586
commit cbb9034424
4 changed files with 101 additions and 37 deletions

View File

@@ -742,33 +742,7 @@ class _AgentDetailScreenState extends ConsumerState<AgentDetailScreen> {
// Expertise tags (matching web ProfileCard)
if (state.expertiseTags.isNotEmpty) ...[
const SizedBox(height: 14),
Wrap(
alignment: WrapAlignment.center,
spacing: 8,
runSpacing: 8,
children: state.expertiseTags
.map((tag) => Container(
padding: const EdgeInsets.symmetric(
horizontal: 12, vertical: 5),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
border: Border.all(
color: AppColors.primaryDark,
width: 0.7,
),
),
child: Text(
tag,
style: const TextStyle(
fontFamily: 'SourceSerif4',
fontSize: 14,
fontWeight: FontWeight.w400,
color: AppColors.primaryDark,
),
),
))
.toList(),
),
_ExpandableTagsWrap(tags: state.expertiseTags),
],
// Bio with Show More / Show Less
if (state.descriptionText.isNotEmpty) ...[
@@ -1225,6 +1199,81 @@ class _AgentDetailScreenState extends ConsumerState<AgentDetailScreen> {
// ── Expandable Chips Section ──
class _ExpandableTagsWrap extends StatefulWidget {
final List<String> tags;
final int initialCount;
const _ExpandableTagsWrap({required this.tags, this.initialCount = 6});
@override
State<_ExpandableTagsWrap> createState() => _ExpandableTagsWrapState();
}
class _ExpandableTagsWrapState extends State<_ExpandableTagsWrap> {
bool _expanded = false;
@override
Widget build(BuildContext context) {
final displayTags =
_expanded ? widget.tags : widget.tags.take(widget.initialCount).toList();
final hasMore = widget.tags.length > widget.initialCount;
return Column(
children: [
Wrap(
alignment: WrapAlignment.center,
spacing: 8,
runSpacing: 8,
children: displayTags
.map((tag) => Container(
padding:
const EdgeInsets.symmetric(horizontal: 12, vertical: 5),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
border: Border.all(
color: AppColors.primaryDark,
width: 0.7,
),
),
child: Text(
tag,
style: const TextStyle(
fontFamily: 'SourceSerif4',
fontSize: 14,
fontWeight: FontWeight.w400,
color: AppColors.primaryDark,
),
),
))
.toList(),
),
if (hasMore) ...[
const SizedBox(height: 10),
GestureDetector(
onTap: () => setState(() => _expanded = !_expanded),
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
border: Border.all(color: AppColors.accentOrange, width: 0.7),
),
child: Text(
_expanded ? 'Show Less' : 'Show More',
style: const TextStyle(
fontFamily: 'SourceSerif4',
fontSize: 10,
fontWeight: FontWeight.w700,
color: AppColors.accentOrange,
),
),
),
),
],
],
);
}
}
class _ExpandableChipsSection extends StatefulWidget {
final String title;
final List<String> items;