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
+157
-89
No files matched your search
@@ -5,6 +5,15 @@
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## 0.3.20 侧栏项目/会话行等高与右对齐、活动条改为 dsh-Go 胶囊(分支 `flutter`)
|
||||||
|
|
||||||
|
| 项 | 结果 |
|
||||||
|
| --- | --- |
|
||||||
|
| 侧栏等高 | 项目分组头改用与会话行相同的 `ListTile`(标题 + 副标题),两者高度都是 72;分组的 8px 外边距由 ListTile 的内边距补偿,`+` 与会话的 `⋮` 落在同一竖线上 |
|
||||||
|
| 活动条 | 改为 dsh-Go 风格的全宽胶囊:左侧「标题 + 步骤摘要」,右侧等宽数字计时 `m:ss`(不足一分钟也显示 `0:03`),半透明 surface 背景,最小高度 36;去掉条内的转圈。胶囊顶边就是之后输入框宠物的栖息位置 |
|
||||||
|
| 版本 | **0.3.20(code 320)** |
|
||||||
|
---
|
||||||
|
|
||||||
## 0.3.19 输入框环居中、运行状态条、侧栏项目层级与 Windows 路径(分支 `flutter`)
|
## 0.3.19 输入框环居中、运行状态条、侧栏项目层级与 Windows 路径(分支 `flutter`)
|
||||||
|
|
||||||
| 项 | 结果 |
|
| 项 | 结果 |
|
||||||
|
|||||||
@@ -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
|
feature set as the earlier Asuka/Go and MyGo attempts, reimplemented in
|
||||||
Flutter to compare mobile UI maturity.
|
Flutter to compare mobile UI maturity.
|
||||||
|
|
||||||
Status: 0.3.19 — servers (passwordless / password login, HTTP/HTTPS and
|
Status: 0.3.20 — servers (passwordless / password login, HTTP/HTTPS and
|
||||||
SOCKS5/socks5h proxy, self-signed certificates and pinning), session list with search and live
|
SOCKS5/socks5h proxy, self-signed certificates and pinning), session list with search and live
|
||||||
events, chat with streaming Markdown and full history paging, tool steps
|
events, chat with streaming Markdown and full history paging, tool steps
|
||||||
grouped per turn (icon, one-line summary, foldable run) with image previews, a
|
grouped per turn (icon, one-line summary, foldable run) with image previews, a
|
||||||
|
|||||||
@@ -1380,57 +1380,72 @@ class _ChatScreenState extends State<ChatScreen> {
|
|||||||
if (start <= 0) return '';
|
if (start <= 0) return '';
|
||||||
final secs =
|
final secs =
|
||||||
((DateTime.now().millisecondsSinceEpoch - start) / 1000).round();
|
((DateTime.now().millisecondsSinceEpoch - start) / 1000).round();
|
||||||
if (secs <= 0) return '';
|
if (secs <= 0) return '0:00';
|
||||||
if (secs < 60) return '$secs 秒';
|
|
||||||
return '${secs ~/ 60}:${(secs % 60).toString().padLeft(2, '0')}';
|
return '${secs ~/ 60}:${(secs % 60).toString().padLeft(2, '0')}';
|
||||||
}
|
}
|
||||||
|
|
||||||
/// dsh-Go's activity strip: the current step and its clock, above the input.
|
/// dsh-Go's activity cap: a stadium above the input with the current step
|
||||||
|
/// on the left and its clock on the right. Its top edge is where the
|
||||||
|
/// input-box pet will later perch.
|
||||||
Widget _activityStrip() {
|
Widget _activityStrip() {
|
||||||
final theme = Theme.of(context);
|
final theme = Theme.of(context);
|
||||||
final scheme = theme.colorScheme;
|
final scheme = theme.colorScheme;
|
||||||
final act = _activity();
|
final act = _activity();
|
||||||
final elapsed = _elapsedSince(_runningStart());
|
final elapsed = _elapsedSince(_runningStart());
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(14, 2, 14, 2),
|
// The same 8px side margin as the composer, so the two capsules agree.
|
||||||
|
padding: const EdgeInsets.fromLTRB(8, 4, 8, 4),
|
||||||
|
child: Container(
|
||||||
|
constraints: const BoxConstraints(minHeight: 36),
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 6),
|
||||||
|
decoration: ShapeDecoration(
|
||||||
|
color: scheme.surfaceContainerHighest.withValues(alpha: 0.7),
|
||||||
|
shape: const StadiumBorder(),
|
||||||
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
|
||||||
width: 13,
|
|
||||||
height: 13,
|
|
||||||
child: CircularProgressIndicator(
|
|
||||||
strokeWidth: 1.7,
|
|
||||||
color: scheme.primary,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 8),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text.rich(
|
child: Row(
|
||||||
TextSpan(children: [
|
children: [
|
||||||
TextSpan(
|
Text(
|
||||||
text: act.title,
|
act.title,
|
||||||
style: TextStyle(
|
style: theme.textTheme.labelMedium?.copyWith(
|
||||||
fontSize: 12.5,
|
fontSize: 13,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
color: scheme.onSurface,
|
color: scheme.onSurface,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (act.detail.isNotEmpty)
|
if (act.detail.isNotEmpty) ...[
|
||||||
TextSpan(
|
const SizedBox(width: 6),
|
||||||
text: ' · ${act.detail}',
|
Flexible(
|
||||||
style: TextStyle(fontSize: 12, color: theme.hintColor),
|
child: Text(
|
||||||
),
|
act.detail,
|
||||||
if (elapsed.isNotEmpty)
|
|
||||||
TextSpan(
|
|
||||||
text: ' · $elapsed',
|
|
||||||
style: TextStyle(fontSize: 12, color: theme.hintColor),
|
|
||||||
),
|
|
||||||
]),
|
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
|
softWrap: false,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
|
style: theme.textTheme.bodySmall?.copyWith(
|
||||||
|
fontSize: 12,
|
||||||
|
color: scheme.onSurfaceVariant,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (elapsed.isNotEmpty) ...[
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Text(
|
||||||
|
elapsed,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
color: theme.hintColor,
|
||||||
|
fontFeatures: const [FontFeature.tabularFigures()],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -298,16 +298,58 @@ class _SessionListPaneState extends State<SessionListPane> {
|
|||||||
Widget _groupHeader(_SessionGroup group, {required bool collapsed}) {
|
Widget _groupHeader(_SessionGroup group, {required bool collapsed}) {
|
||||||
final theme = Theme.of(context);
|
final theme = Theme.of(context);
|
||||||
final scheme = theme.colorScheme;
|
final scheme = theme.colorScheme;
|
||||||
final radius = BorderRadius.circular(10);
|
// A ListTile with a title and a subtitle has the session rows' height and
|
||||||
// A tinted band, at least a session row's height: a project reads as a
|
// trailing slot; only the tinted band and the folder mark it as a project.
|
||||||
// section, not as another row.
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(8, 10, 8, 2),
|
padding: const EdgeInsets.fromLTRB(8, 8, 8, 2),
|
||||||
child: Material(
|
child: Material(
|
||||||
color: scheme.surfaceContainerHighest.withValues(alpha: 0.5),
|
color: scheme.surfaceContainerHighest.withValues(alpha: 0.5),
|
||||||
borderRadius: radius,
|
borderRadius: BorderRadius.circular(10),
|
||||||
clipBehavior: Clip.antiAlias,
|
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(() {
|
onTap: () => setState(() {
|
||||||
if (collapsed) {
|
if (collapsed) {
|
||||||
_collapsed.remove(group.key);
|
_collapsed.remove(group.key);
|
||||||
@@ -315,56 +357,6 @@ class _SessionListPaneState extends State<SessionListPane> {
|
|||||||
_collapsed.add(group.key);
|
_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,7 +557,11 @@ class _SessionListPaneState extends State<SessionListPane> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _menu(Session session, {required bool archived}) {
|
Widget _menu(Session session, {required bool archived}) {
|
||||||
return PopupMenuButton<String>(
|
// 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),
|
icon: const Icon(Icons.more_vert, size: 18),
|
||||||
onSelected: (value) {
|
onSelected: (value) {
|
||||||
switch (value) {
|
switch (value) {
|
||||||
@@ -601,6 +597,7 @@ class _SessionListPaneState extends State<SessionListPane> {
|
|||||||
const PopupMenuItem(value: 'delete', child: Text('删除')),
|
const PopupMenuItem(value: 'delete', child: Text('删除')),
|
||||||
const PopupMenuItem(value: 'copy', child: Text('复制会话 ID')),
|
const PopupMenuItem(value: 'copy', child: Text('复制会话 ID')),
|
||||||
],
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ name: openchamber
|
|||||||
description: "A lightweight OpenChamber client for phones."
|
description: "A lightweight OpenChamber client for phones."
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
|
|
||||||
version: 0.3.19+319
|
version: 0.3.20+320
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.14.0
|
sdk: ^3.14.0
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:openchamber/api/models.dart';
|
||||||
|
import 'package:openchamber/screens/sessions_screen.dart';
|
||||||
|
import 'package:openchamber/state.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
testWidgets('the project band matches a session row and keeps the keys in line',
|
||||||
|
(tester) async {
|
||||||
|
final app = AppState();
|
||||||
|
final now = DateTime.now().millisecondsSinceEpoch;
|
||||||
|
app.sessions = [
|
||||||
|
Session(
|
||||||
|
id: 's1',
|
||||||
|
title: '标签页拖拽与分屏',
|
||||||
|
agent: 'build',
|
||||||
|
location: Location(r'C:\msys64\home\Gary\Sources\pineapple-notepad'),
|
||||||
|
created: now,
|
||||||
|
updated: now,
|
||||||
|
),
|
||||||
|
];
|
||||||
|
addTearDown(app.dispose);
|
||||||
|
|
||||||
|
await tester.pumpWidget(MaterialApp(
|
||||||
|
home: Scaffold(body: SessionListPane(app: app)),
|
||||||
|
));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
|
// A Windows path names the folder, not the whole path.
|
||||||
|
expect(find.text('pineapple-notepad'), findsOneWidget);
|
||||||
|
|
||||||
|
final header = find.ancestor(
|
||||||
|
of: find.text('pineapple-notepad'),
|
||||||
|
matching: find.byType(ListTile),
|
||||||
|
);
|
||||||
|
final row = find.ancestor(
|
||||||
|
of: find.text('标签页拖拽与分屏'),
|
||||||
|
matching: find.byType(ListTile),
|
||||||
|
);
|
||||||
|
expect(tester.getSize(header).height, tester.getSize(row).height);
|
||||||
|
|
||||||
|
// The project's + and the session's ⋮ share one vertical line.
|
||||||
|
final add = tester.getCenter(find.byTooltip('在此项目新会话'));
|
||||||
|
final menu = tester.getCenter(find.byIcon(Icons.more_vert));
|
||||||
|
expect(add.dx, closeTo(menu.dx, 0.5));
|
||||||
|
});
|
||||||
|
}
|
||||||
Reference in new issue
Block a user