style: align sidebar tree chevrons and give titles more room
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).
This commit is contained in:
1 parent
9cbd97d532
commit
0f850b6191
6 files changed
+83
-14
No files matched your search
@@ -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));
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user