feat(ui): 统一两个视图的编辑工具栏;缩小右下角预览卡

- 编辑工具统一为 7 个按钮(添加/编辑/复制/删除/层+/层−/对齐),两视图同一套组件
- 条形视图:位置保持左下角,按钮缩至原 60%(约 40×34,单手可点)
- 圆周视图:工具栏由右中移到右上角,按钮尺寸与条形视图一致,不再遮挡预览
- 右下角预览卡缩小:宽 190→150,圆周预览高 150→112,条形预览行距 12→9
- 版本号 1.0.9+10
This commit is contained in:
2026-10-08 15:27:27 +08:00
parent f1df91782d
commit 0a0ea3c0ec
5 changed files with 73 additions and 122 deletions
+1 -1
View File
@@ -127,7 +127,7 @@ flutter pub get
flutter build apk --release # 产物:build\app\outputs\flutter-apk\app-release.apk
```
- 发布包归档:`release\sequence_diagram_android_v1.0.8_release.apk`(**本地保留,不入库**;exe 的 `dist\` 同理)。
- 发布包归档:`release\sequence_diagram_android_v1.0.9_release.apk`(**本地保留,不入库**;exe 的 `dist\` 同理)。
- 上架应用商店时建议在 `android\app\build.gradle.kts` 配置正式签名后再构建 AAB:
`flutter build appbundle --release`。
- 应用名「时序图设计」、包名 `cc.sincos.sequence_diagram`、launcher 图标由
+3 -3
View File
@@ -9,7 +9,7 @@
- **深色 / 浅色双主题**:右上角 ☀ / ☾ 一键切换,语义颜色不变,导出 SVG 与屏幕一致
- **导出 SVG**:矢量、分层、带语义 `id` / `data-*` 元数据,可直接进工艺卡与 MES
## 正式版 V1.0.8
## 正式版 V1.0.9
**可运行的 Flutter Windows 桌面正式版**(源码在 `lib/`),设计人:呆头鹅。
@@ -97,7 +97,7 @@ Flutter 3.29+(Desktop) · CustomPainter 自绘 · Riverpod · 不可变模
- **正式签名**:release 用独立 keystore 签名(`android/key/release.jks`,见 `BUILD-NOTES.md`),更新安装无需卸载重装;
- **构建**:JDK 17 + Android SDK 36(详见 `BUILD-NOTES.md`),Gradle 与 Maven 已配置国内镜像:
```bash
flutter build apk --release # 产物 → release/sequence_diagram_android_v1.0.8_release.apk
flutter build apk --release # 产物 → release/sequence_diagram_android_v1.0.9_release.apk
```
- **自测**:`test/tablet_layout_test.dart` 覆盖 1280×800、2560×1600、960×600、800×480、竖屏 800×1280、600×960 等 7 种分辨率的无溢出回归;
- **demo 图**:`demo/tablet-*.png`(由 `test/tablet_screenshots_test.dart` 生成)。
@@ -113,6 +113,6 @@ Flutter 3.29+(Desktop) · CustomPainter 自绘 · Riverpod · 不可变模
- **软件**:时序图设计 · Sequence Diagram Studio
- **设计人**:呆头鹅
- **版本**:V1.0.8
- **版本**:V1.0.9
- **版权**:Copyright © 2026 呆头鹅。保留所有权利。
- **架构文档**:[`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) · **使用帮助**:[`docs/HELP.md`](docs/HELP.md)
+67 -116
View File
@@ -130,12 +130,12 @@ class CanvasOverlays extends StatelessWidget {
? _BarPreviewCard(t: t, c: c)
: _CircularPreviewCard(t: t, c: c),
),
// 圆周视图右侧浮动工具栏(添加/编辑/复制/删除/改层/对齐)。
// 圆周视图右上角浮动工具栏(与条形视图同一套工具与按钮尺寸)。
if (showPanels && circular)
Positioned(
right: right - 2,
top: 120,
child: _FloatingToolbar(t: t, c: c),
right: right,
top: 70,
child: _EditTools(t: t, c: c, vertical: true),
),
],
);
@@ -611,68 +611,88 @@ class _CycleStatsDialog extends StatelessWidget {
}
}
/// 条形视图编辑工具条:添加 / 编辑 / 复制 / 删除 / 对齐。
/// 编辑工具栏(条形 / 圆周视图共用):
/// 添加 / 编辑 / 复制 / 删除 / 层+ / 层− / 对齐。
///
/// - [vertical] 为真时纵向排列(圆周视图右上角),否则横向排列(条形视图左下角);
/// - 按钮尺寸统一为原「编辑工具」条的 60%(约 40×34px),单手可点且尽量不遮挡画布。
class _EditTools extends StatelessWidget {
const _EditTools({required this.t, required this.c});
const _EditTools({required this.t, required this.c, this.vertical = false});
/// 主题令牌。
final Tokens t;
/// 全局应用控制器。
final AppController c;
/// 是否纵向排列(圆周视图用)。
final bool vertical;
/// 渲染一组横向排列的编辑工具按钮。
/// 按钮宽度(像素)——原 66 的 60%。
static const double _bw = 40;
/// 按钮高度(像素)——原 56 的 60%。
static const double _bh = 34;
/// 按钮间距(像素)。
static const double _gap = 5;
/// 渲染工具栏;横向 ↔ 纵向由 [vertical] 决定。
@override
Widget build(BuildContext context) {
return _Card(
t: t,
width: 390,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text('编辑工具', style: TextStyle(color: t.sub, fontSize: 12, fontWeight: FontWeight.w600)),
const SizedBox(height: 10),
Row(
children: <Widget>[
_tool(t, Icons.add, '添加动作', t.ok, t.onAccent, () => c.addAction(startAngle: 0)),
const SizedBox(width: 8),
_tool(t, Icons.edit, '编辑', t.accent, t.onAccent, () {
final Action? a = c.selected;
if (a != null) showDialog<void>(context: context, builder: (_) => ActionEditorDialog(controller: c, action: a));
}),
const SizedBox(width: 8),
_tool(t, Icons.copy, '复制', t.panel, t.sub, c.duplicateSelected, border: t.line2),
const SizedBox(width: 8),
_tool(t, Icons.delete_outline, '删除', t.panel, t.sub,
() => c.selectedId != null ? c.deleteAction(c.selectedId!) : null,
border: t.line2),
const SizedBox(width: 8),
_tool(t, Icons.align_horizontal_left, '对齐', t.panel, t.sub, c.alignPhase, border: t.line2),
],
),
],
final List<Widget> buttons = <Widget>[
_tool(Icons.add, '添加', t.ok, t.onAccent, () => c.addAction(startAngle: 0)),
_tool(Icons.edit, '编辑', t.accent, t.onAccent, () {
final Action? a = c.selected;
if (a != null) showDialog<void>(context: context, builder: (_) => ActionEditorDialog(controller: c, action: a));
}),
_tool(Icons.copy, '复制', t.panel, t.sub, c.duplicateSelected, border: t.line2),
_tool(Icons.delete_outline, '删除', t.panel, t.sub,
() => c.selectedId != null ? c.deleteAction(c.selectedId!) : null, border: t.line2),
_tool(Icons.keyboard_arrow_up, '层+', t.panel, t.sub,
() => c.selectedId != null ? c.changeLayer(c.selectedId!, 1) : null, border: t.line2),
_tool(Icons.keyboard_arrow_down, '层−', t.panel, t.sub,
() => c.selectedId != null ? c.changeLayer(c.selectedId!, -1) : null, border: t.line2),
_tool(Icons.align_horizontal_left, '对齐', t.panel, t.sub, c.alignPhase, border: t.line2),
];
final List<Widget> spaced = <Widget>[];
for (int i = 0; i < buttons.length; i++) {
if (i > 0) {
spaced.add(SizedBox(width: vertical ? 0 : _gap, height: vertical ? _gap : 0));
}
spaced.add(buttons[i]);
}
return Container(
padding: const EdgeInsets.all(5),
decoration: BoxDecoration(
color: t.panel.withValues(alpha: 0.96),
borderRadius: BorderRadius.circular(vertical ? 12 : 10),
border: Border.all(color: t.line2),
),
child: vertical
? Column(mainAxisSize: MainAxisSize.min, children: spaced)
: Row(mainAxisSize: MainAxisSize.min, children: spaced),
);
}
/// 渲染单个带图标与文字的工具按钮。
Widget _tool(Tokens t, IconData icon, String label, Color bg, Color fg, VoidCallback onTap, {Color? border}) {
/// 渲染单个工具按钮(图标 + 文字)。
Widget _tool(IconData icon, String label, Color bg, Color fg, VoidCallback onTap, {Color? border}) {
return InkWell(
onTap: onTap,
borderRadius: BorderRadius.circular(9),
borderRadius: BorderRadius.circular(8),
child: Container(
width: 66,
height: 56,
width: _bw,
height: _bh,
decoration: BoxDecoration(
color: bg,
borderRadius: BorderRadius.circular(9),
borderRadius: BorderRadius.circular(8),
border: Border.all(color: border ?? bg),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Icon(icon, size: 19, color: fg),
const SizedBox(height: 4),
Text(label, style: TextStyle(color: fg, fontSize: 10, fontWeight: FontWeight.w600)),
Icon(icon, size: 12, color: fg),
const SizedBox(height: 1),
Text(label,
style: TextStyle(color: fg, fontSize: 8.5, fontWeight: FontWeight.w600, height: 1.0)),
],
),
),
@@ -680,75 +700,6 @@ class _EditTools extends StatelessWidget {
}
}
/// 圆周视图右侧浮动工具栏:纵向排列的编辑按钮。
class _FloatingToolbar extends StatelessWidget {
const _FloatingToolbar({required this.t, required this.c});
/// 主题令牌。
final Tokens t;
/// 全局应用控制器。
final AppController c;
/// 渲染纵向排列的浮动工具按钮组。
@override
Widget build(BuildContext context) {
/// 渲染单个浮动工具按钮。
Widget item(IconData icon, String label, Color bg, Color fg, VoidCallback onTap, {Color? border}) {
return Padding(
padding: const EdgeInsets.only(bottom: 6),
child: InkWell(
onTap: onTap,
borderRadius: BorderRadius.circular(10),
child: Container(
width: 46,
height: 46,
decoration: BoxDecoration(
color: bg,
borderRadius: BorderRadius.circular(10),
border: Border.all(color: border ?? bg),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Icon(icon, size: 17, color: fg),
const SizedBox(height: 1),
Text(label, style: TextStyle(color: fg, fontSize: 10, fontWeight: FontWeight.w600)),
],
),
),
),
);
}
return Container(
padding: const EdgeInsets.all(6),
decoration: BoxDecoration(
color: t.panel.withValues(alpha: 0.96),
borderRadius: BorderRadius.circular(14),
border: Border.all(color: t.line2),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
item(Icons.add, '添加', t.ok, t.onAccent, () => c.addAction(startAngle: 0)),
item(Icons.edit, '编辑', t.accent, t.onAccent, () {
final Action? a = c.selected;
if (a != null) showDialog<void>(context: context, builder: (_) => ActionEditorDialog(controller: c, action: a));
}),
item(Icons.copy, '复制', t.panel2, t.sub, c.duplicateSelected, border: t.line),
item(Icons.delete_outline, '删除', t.panel2, t.sub,
() => c.selectedId != null ? c.deleteAction(c.selectedId!) : null, border: t.line),
item(Icons.keyboard_arrow_up, '层+', t.panel2, t.sub,
() => c.selectedId != null ? c.changeLayer(c.selectedId!, 1) : null, border: t.line),
item(Icons.keyboard_arrow_down, '层−', t.panel2, t.sub,
() => c.selectedId != null ? c.changeLayer(c.selectedId!, -1) : null, border: t.line),
item(Icons.align_horizontal_left, '对齐', t.panel2, t.sub, c.alignPhase, border: t.line),
],
),
);
}
}
/// 条形节拍缩略预览卡(在圆周视图右下角显示);点击切换到条形视图。
class _BarPreviewCard extends StatelessWidget {
const _BarPreviewCard({required this.t, required this.c});
@@ -767,7 +718,7 @@ class _BarPreviewCard extends StatelessWidget {
borderRadius: BorderRadius.circular(10),
child: _Card(
t: t,
width: 190,
width: 150,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
@@ -783,7 +734,7 @@ class _BarPreviewCard extends StatelessWidget {
const SizedBox(height: 6),
SizedBox(
width: double.infinity,
height: project.actions.length * 12.0 + 14,
height: project.actions.length * 9.0 + 12,
child: CustomPaint(
size: Size.infinite,
painter: _MiniBarPainter(project, t),
@@ -867,7 +818,7 @@ class _CircularPreviewCard extends StatelessWidget {
borderRadius: BorderRadius.circular(10),
child: _Card(
t: t,
width: 190,
width: 150,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
@@ -883,7 +834,7 @@ class _CircularPreviewCard extends StatelessWidget {
const SizedBox(height: 6),
SizedBox(
width: double.infinity,
height: 150,
height: 112,
child: CustomPaint(
size: Size.infinite,
painter: _MiniCircularPainter(project, t),
+1 -1
View File
@@ -2124,7 +2124,7 @@ class HelpDialog extends StatelessWidget {
Text('时序图设计 · Sequence Diagram Studio',
style: TextStyle(color: t.text, fontSize: 15, fontWeight: FontWeight.w700)),
const SizedBox(height: 4),
Text('V1.0.8(${android ? '安卓版' : 'Windows 版'})',
Text('V1.0.9(${android ? '安卓版' : 'Windows 版'})',
style: TextStyle(color: t.dim, fontSize: 12)),
],
),
+1 -1
View File
@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.8+9
version: 1.0.9+10
environment:
sdk: ^3.13.3