feat(app): chat sections are clear collapsible dividers; closed chats start collapsed

This commit is contained in:
2026-10-24 00:22:18 +01:00
parent d0b1c8e524
commit 1e55b8d2b3
16 changed files with 293 additions and 161 deletions
@@ -1,5 +1,5 @@
import '../../../../ui/layout/collapsible_list_section.dart';
import '../../../../ui/theme/app_theme.dart';
import '../../../../ui/layout/section_heading.dart';
import 'package:flutter/cupertino.dart';
import '../../../../core/api_gateway.dart';
@@ -58,23 +58,32 @@ class CupertinoSessionList extends StatelessWidget {
);
}
List<CupertinoListSection> _section(ChatSessionSection section) {
List<Widget> _section(ChatSessionSection section) {
final groups = groupChatSessions(section.sessions);
// Closed chats start folded away; the live ones start open.
return [
for (final group in groups)
CupertinoListSection.insetGrouped(
backgroundColor: AppColors.groupedBackground,
// Styled as a section divider, not as another chat row.
header: Builder(
builder: (context) => Text(
groups.length > 1
? '${section.title} · ${group.directory.isEmpty ? 'No directory' : group.directory}'
: section.title,
style: SectionHeadingStyle.of(context).title,
CollapsibleListSection(
key: ValueKey('chat-section-${section.title}'),
title: section.title,
count: section.sessions.length,
initiallyOpen: section.title != 'Closed',
children: [
for (final group in groups)
CupertinoListSection.insetGrouped(
backgroundColor: AppColors.groupedBackground,
header: groups.length > 1
? Text(
group.directory.isEmpty
? 'No directory'
: group.directory,
)
: null,
children: [
for (final session in group.sessions) ..._row(session),
],
),
),
children: [for (final session in group.sessions) ..._row(session)],
),
],
),
];
}
@@ -1,3 +1,4 @@
import '../../../../ui/layout/collapsible_list_section.dart';
import '../../../../ui/layout/section_heading.dart';
import 'package:flutter/material.dart';
@@ -63,14 +64,12 @@ class MaterialSessionList extends StatelessWidget {
Widget _section(BuildContext context, ChatSessionSection section) {
final groups = groupChatSessions(section.sessions);
final heading = SectionHeadingStyle.of(context);
return ExpansionTile(
// Styled as a section divider, not as another chat row.
title: Text(section.title, style: heading.title),
backgroundColor: heading.background.withValues(alpha: 0.35),
collapsedBackgroundColor: heading.background,
shape: Border(left: BorderSide(color: heading.accent, width: 3)),
collapsedShape: Border(left: BorderSide(color: heading.accent, width: 3)),
initiallyExpanded: true,
// Closed chats start folded away; the live ones start open.
return CollapsibleListSection(
key: ValueKey('chat-section-${section.title}'),
title: section.title,
count: section.sessions.length,
initiallyOpen: section.title != 'Closed',
children: [
for (final group in groups) ...[
if (groups.length > 1)