ui: one row height and one trailing line in the sidebar, and a dsh-Go activity cap
- The project header is a ListTile now, like a session row: both are 72 high (title + subtitle). A Material 3 list tile ends at 24, so the band's 8px inset gets 16 more, putting the project + and the session ⋮ on one line (a widget test asserts both the heights and the x centres). - The running status is a full-width stadium like dsh-Go's activity strip: title and current-step summary on the left, a tabular m:ss clock on the right, translucent surface, 36 minimum height. The spinner inside is gone; the cap's top edge is where the future input-box pet will perch. - 0.3.20 (320).
This commit is contained in:
1 parent
6ced914757
commit
73af9d851b
6 files changed
+200
-132
No files matched your search
@@ -298,16 +298,58 @@ class _SessionListPaneState extends State<SessionListPane> {
|
||||
Widget _groupHeader(_SessionGroup group, {required bool collapsed}) {
|
||||
final theme = Theme.of(context);
|
||||
final scheme = theme.colorScheme;
|
||||
final radius = BorderRadius.circular(10);
|
||||
// A tinted band, at least a session row's height: a project reads as a
|
||||
// section, not as another row.
|
||||
// A ListTile with a title and a subtitle has the session rows' height and
|
||||
// trailing slot; only the tinted band and the folder mark it as a project.
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(8, 10, 8, 2),
|
||||
padding: const EdgeInsets.fromLTRB(8, 8, 8, 2),
|
||||
child: Material(
|
||||
color: scheme.surfaceContainerHighest.withValues(alpha: 0.5),
|
||||
borderRadius: radius,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: InkWell(
|
||||
child: ListTile(
|
||||
// The band already insets by 8. A Material 3 list tile ends at 24
|
||||
// (start 16), so 16 here makes the + line up with the session
|
||||
// rows' ⋮.
|
||||
contentPadding: const EdgeInsets.only(left: 8, right: 16),
|
||||
leading: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(collapsed ? Icons.chevron_right : Icons.expand_more,
|
||||
size: 18, color: scheme.onSurfaceVariant),
|
||||
const SizedBox(width: 2),
|
||||
Icon(Icons.folder_outlined, size: 16, color: scheme.primary),
|
||||
],
|
||||
),
|
||||
title: Text(
|
||||
group.label.isEmpty ? '未命名项目' : group.label,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: scheme.onSurface,
|
||||
),
|
||||
),
|
||||
subtitle: group.path.isEmpty
|
||||
? null
|
||||
: Text(
|
||||
group.path,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 11.5, color: theme.hintColor),
|
||||
),
|
||||
// A fixed 48 slot, like the session rows' menu: both keys then sit
|
||||
// on the same vertical line.
|
||||
trailing: SizedBox(
|
||||
width: 48,
|
||||
height: 48,
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.add, size: 20),
|
||||
padding: EdgeInsets.zero,
|
||||
tooltip: '在此项目新会话',
|
||||
onPressed: () => _newSession(directory: group.path),
|
||||
),
|
||||
),
|
||||
onTap: () => setState(() {
|
||||
if (collapsed) {
|
||||
_collapsed.remove(group.key);
|
||||
@@ -315,56 +357,6 @@ class _SessionListPaneState extends State<SessionListPane> {
|
||||
_collapsed.add(group.key);
|
||||
}
|
||||
}),
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(minHeight: 56),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(10, 10, 4, 10),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(collapsed ? Icons.chevron_right : Icons.expand_more,
|
||||
size: 18, color: scheme.onSurfaceVariant),
|
||||
const SizedBox(width: 6),
|
||||
Icon(Icons.folder_outlined,
|
||||
size: 16, color: scheme.primary),
|
||||
const SizedBox(width: 6),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
group.label.isEmpty ? '未命名项目' : group.label,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 13.5,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: scheme.onSurface),
|
||||
),
|
||||
if (group.path.isNotEmpty)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 2),
|
||||
child: Text(
|
||||
group.path,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 11, color: theme.hintColor),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.add, size: 18),
|
||||
tooltip: '在此项目新会话',
|
||||
visualDensity: VisualDensity.compact,
|
||||
onPressed: () => _newSession(directory: group.path),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -565,42 +557,47 @@ class _SessionListPaneState extends State<SessionListPane> {
|
||||
}
|
||||
|
||||
Widget _menu(Session session, {required bool archived}) {
|
||||
return PopupMenuButton<String>(
|
||||
icon: const Icon(Icons.more_vert, size: 18),
|
||||
onSelected: (value) {
|
||||
switch (value) {
|
||||
case 'rename':
|
||||
_rename(session);
|
||||
break;
|
||||
case 'pin':
|
||||
_app.togglePin(session);
|
||||
break;
|
||||
case 'archive':
|
||||
_archive(session, archived);
|
||||
break;
|
||||
case 'delete':
|
||||
_confirmDelete(session);
|
||||
break;
|
||||
case 'copy':
|
||||
Clipboard.setData(ClipboardData(text: session.id));
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('已复制会话 ID')));
|
||||
break;
|
||||
}
|
||||
},
|
||||
itemBuilder: (_) => [
|
||||
if (!archived) ...[
|
||||
const PopupMenuItem(value: 'rename', child: Text('重命名')),
|
||||
// The same 48 slot as the project header's +, so the keys line up.
|
||||
return SizedBox(
|
||||
width: 48,
|
||||
height: 48,
|
||||
child: PopupMenuButton<String>(
|
||||
icon: const Icon(Icons.more_vert, size: 18),
|
||||
onSelected: (value) {
|
||||
switch (value) {
|
||||
case 'rename':
|
||||
_rename(session);
|
||||
break;
|
||||
case 'pin':
|
||||
_app.togglePin(session);
|
||||
break;
|
||||
case 'archive':
|
||||
_archive(session, archived);
|
||||
break;
|
||||
case 'delete':
|
||||
_confirmDelete(session);
|
||||
break;
|
||||
case 'copy':
|
||||
Clipboard.setData(ClipboardData(text: session.id));
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('已复制会话 ID')));
|
||||
break;
|
||||
}
|
||||
},
|
||||
itemBuilder: (_) => [
|
||||
if (!archived) ...[
|
||||
const PopupMenuItem(value: 'rename', child: Text('重命名')),
|
||||
PopupMenuItem(
|
||||
value: 'pin',
|
||||
child: Text(session.isPinned ? '取消置顶' : '置顶')),
|
||||
],
|
||||
PopupMenuItem(
|
||||
value: 'pin',
|
||||
child: Text(session.isPinned ? '取消置顶' : '置顶')),
|
||||
value: 'archive',
|
||||
child: Text(archived ? '取消归档' : '归档')),
|
||||
const PopupMenuItem(value: 'delete', child: Text('删除')),
|
||||
const PopupMenuItem(value: 'copy', child: Text('复制会话 ID')),
|
||||
],
|
||||
PopupMenuItem(
|
||||
value: 'archive',
|
||||
child: Text(archived ? '取消归档' : '归档')),
|
||||
const PopupMenuItem(value: 'delete', child: Text('删除')),
|
||||
const PopupMenuItem(value: 'copy', child: Text('复制会话 ID')),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user