From 0f850b6191e59c3bcea125ae9388de3bd496db0c Mon Sep 17 00:00:00 2001 From: Wang Zichong Date: Mon, 23 Nov 2026 21:37:16 +0800 Subject: [PATCH] style: align sidebar tree chevrons and give titles more room MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The project band no longer adds inner padding, so its folder chevron and + sit on the same two vertical lines as the session rows' subagent chevron and ⋮. Every session row now reserves the same 18px chevron column, so a session without subagents starts its title exactly where a parent does, and the compact left/right insets leave the title more width. 0.4.11 (411). --- PLAN.md | 12 ++++++++ README.md | 2 +- lib/screens/sessions_screen.dart | 27 +++++++++++------ lib/version.dart | 2 +- pubspec.yaml | 2 +- test/sidebar_rows_test.dart | 52 +++++++++++++++++++++++++++++++- 6 files changed, 83 insertions(+), 14 deletions(-) diff --git a/PLAN.md b/PLAN.md index 360fd03..e88fc26 100644 --- a/PLAN.md +++ b/PLAN.md @@ -5,6 +5,18 @@ --- +## 0.4.11 侧栏对齐调整(分支 `flutter`) + +| 项 | 结果 | +| --- | --- | +| 折叠箭头对齐 | 项目分组带内部 contentPadding 归零(外层仍为 8):分组折叠箭头与有子代理会话行的箭头在同一条竖线上 | +| 左右边距 | 会话行左右均为 8;项目带的 + 与会话行的 ⋮ 也都在右侧 8 的同一竖线上,标题可用宽度更大 | +| 标题起点 | 所有顶层会话行都保留固定 18px 的箭头列(无子代理时留空),标题横向起点一致;子代理行缩进 32 并保留竖线 | +| 测试 | 新增「分组箭头/子代理箭头同列、有无子代理的标题同起点」用例;52 项全过 | +| 版本 | **0.4.11(code 411)** | + +--- + ## 0.4.10 子代理树折叠、Agent Task 行与只读输入(分支 `flutter`) | 项 | 结果 | diff --git a/README.md b/README.md index 62c0a71..0812342 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Android first. This branch (`flutter`) is a framework evaluation: the same feature set as the earlier Asuka/Go and MyGo attempts, reimplemented in Flutter to compare mobile UI maturity. -Status: 0.4.10 — servers (passwordless / password login, HTTP/HTTPS and +Status: 0.4.11 — servers (passwordless / password login, HTTP/HTTPS and SOCKS5/socks5h proxy, self-signed certificates and pinning, or a pairing link over the OpenChamber private relay with end-to-end encryption; the pairing link is pasted or scanned with the camera), session list with search and live diff --git a/lib/screens/sessions_screen.dart b/lib/screens/sessions_screen.dart index 1392b43..f7f4793 100644 --- a/lib/screens/sessions_screen.dart +++ b/lib/screens/sessions_screen.dart @@ -315,10 +315,11 @@ class _SessionListPaneState extends State { // Compact like a session row: two dense lines in a 56px band. dense: true, minTileHeight: 56, - // 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), + // The band already insets by 8, the same as a session row's + // content padding. No padding inside it then makes the folder + // chevron and the + share one vertical line with the session rows' + // chevron and ⋮. + contentPadding: EdgeInsets.zero, leading: Row( mainAxisSize: MainAxisSize.min, children: [ @@ -576,16 +577,22 @@ class _SessionListPaneState extends State { // Compact: both the project band and a session row are 56 high. dense: true, minTileHeight: 56, + // A fixed chevron column for every session row: rows without + // subagents keep the same title start as rows with them. A short gap + // after it keeps the title space wide. + contentPadding: child + ? const EdgeInsets.only(left: 32, right: 8) + : const EdgeInsets.only(left: 8, right: 8), + horizontalTitleGap: 8, selected: selected, selectedTileColor: scheme.primary.withValues(alpha: 0.10), leading: child - ? Icon(Icons.smart_toy_outlined, - size: 16, color: scheme.onSurfaceVariant) + ? null : children.isEmpty - ? null + ? const SizedBox(width: 18) : SizedBox( - width: 32, - height: 32, + width: 18, + height: 40, child: IconButton( icon: Icon( expanded @@ -596,7 +603,7 @@ class _SessionListPaneState extends State { padding: EdgeInsets.zero, visualDensity: VisualDensity.compact, constraints: - const BoxConstraints(minWidth: 32, minHeight: 32), + const BoxConstraints(minWidth: 18, minHeight: 40), onPressed: () => setState(() { if (expanded) { _expandedChildren.remove(session.id); diff --git a/lib/version.dart b/lib/version.dart index 0a72600..88c3be1 100644 --- a/lib/version.dart +++ b/lib/version.dart @@ -1,2 +1,2 @@ /// The app version sent to the server in pairing and relay handshakes. -const appVersion = '0.4.10'; +const appVersion = '0.4.11'; diff --git a/pubspec.yaml b/pubspec.yaml index 119647b..24ac033 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: openchamber description: "A lightweight OpenChamber client for phones." publish_to: 'none' -version: 0.4.10+410 +version: 0.4.11+411 environment: sdk: ^3.14.0 diff --git a/test/sidebar_rows_test.dart b/test/sidebar_rows_test.dart index ed9e2e8..4656cef 100644 --- a/test/sidebar_rows_test.dart +++ b/test/sidebar_rows_test.dart @@ -82,7 +82,7 @@ void main() { await tester.tap(find.byTooltip('展开子代理')); await tester.pump(); expect(find.text('输出 hello'), findsOneWidget); - expect(find.byIcon(Icons.smart_toy_outlined), findsOneWidget); + expect(find.textContaining('子代理 · general'), findsOneWidget); await tester.tap(find.text('输出 hello')); await tester.pump(); @@ -131,4 +131,54 @@ void main() { final menu = tester.getCenter(find.byIcon(Icons.more_vert)); expect(add.dx, closeTo(menu.dx, 0.5)); }); + + testWidgets('tree chevrons line up with the folder chevron and titles start alike', + (tester) async { + final app = AppState(); + final now = DateTime.now().millisecondsSinceEpoch; + app.sessions = [ + Session( + id: 'parent', + title: '子代理输出 hello', + agent: 'build', + location: Location(r'C:\msys64\home\Gary\Sources\pineapple-notepad'), + created: now, + updated: now, + ), + Session( + id: 'child', + parentID: 'parent', + title: '输出 hello', + agent: 'general', + location: Location(r'C:\msys64\home\Gary\Sources\pineapple-notepad'), + created: now - 500, + updated: now - 500, + ), + Session( + id: 'plain', + title: '无子代理的会话', + agent: 'build', + location: Location(r'C:\msys64\home\Gary\Sources\pineapple-notepad'), + created: now - 1000, + updated: now - 1000, + ), + ]; + addTearDown(app.dispose); + + await tester.pumpWidget(MaterialApp( + home: Scaffold(body: SessionListPane(app: app)), + )); + await tester.pumpAndSettle(); + + // The folder chevron and a parent's subagent chevron are on one line. + final folder = tester.getCenter(find.byIcon(Icons.expand_more).first); + final tree = tester.getCenter(find.byTooltip('展开子代理')); + expect(tree.dx, closeTo(folder.dx, 0.5)); + + // A session without subagents keeps the chevron column, so its title + // starts where a parent's does and loses no width. + final parentTitle = tester.getTopLeft(find.text('子代理输出 hello')).dx; + final plainTitle = tester.getTopLeft(find.text('无子代理的会话')).dx; + expect(plainTitle, closeTo(parentTitle, 0.5)); + }); }