From 0a0ea3c0ecb8dc87d7566d8f085f5d04748a45e3 Mon Sep 17 00:00:00 2001 From: liuyu65 Date: Thu, 8 Oct 2026 15:27:27 +0800 Subject: [PATCH] =?UTF-8?q?feat(ui):=20=E7=BB=9F=E4=B8=80=E4=B8=A4?= =?UTF-8?q?=E4=B8=AA=E8=A7=86=E5=9B=BE=E7=9A=84=E7=BC=96=E8=BE=91=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E6=A0=8F=EF=BC=9B=E7=BC=A9=E5=B0=8F=E5=8F=B3=E4=B8=8B?= =?UTF-8?q?=E8=A7=92=E9=A2=84=E8=A7=88=E5=8D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 编辑工具统一为 7 个按钮(添加/编辑/复制/删除/层+/层−/对齐),两视图同一套组件 - 条形视图:位置保持左下角,按钮缩至原 60%(约 40×34,单手可点) - 圆周视图:工具栏由右中移到右上角,按钮尺寸与条形视图一致,不再遮挡预览 - 右下角预览卡缩小:宽 190→150,圆周预览高 150→112,条形预览行距 12→9 - 版本号 1.0.9+10 --- BUILD-NOTES.md | 2 +- README.md | 6 +- lib/ui/canvas_overlays.dart | 183 +++++++++++++----------------------- lib/ui/dialogs.dart | 2 +- pubspec.yaml | 2 +- 5 files changed, 73 insertions(+), 122 deletions(-) diff --git a/BUILD-NOTES.md b/BUILD-NOTES.md index 0bb80df..08e6eef 100644 --- a/BUILD-NOTES.md +++ b/BUILD-NOTES.md @@ -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 图标由 diff --git a/README.md b/README.md index 793c13e..03aabee 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/lib/ui/canvas_overlays.dart b/lib/ui/canvas_overlays.dart index a4b065e..ca41fcb 100644 --- a/lib/ui/canvas_overlays.dart +++ b/lib/ui/canvas_overlays.dart @@ -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: [ - Text('编辑工具', style: TextStyle(color: t.sub, fontSize: 12, fontWeight: FontWeight.w600)), - const SizedBox(height: 10), - Row( - children: [ - _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(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 buttons = [ + _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(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 spaced = []; + 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: [ - 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: [ - 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: [ - 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(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: [ @@ -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: [ @@ -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), diff --git a/lib/ui/dialogs.dart b/lib/ui/dialogs.dart index 0980546..1692fa7 100644 --- a/lib/ui/dialogs.dart +++ b/lib/ui/dialogs.dart @@ -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)), ], ), diff --git a/pubspec.yaml b/pubspec.yaml index f0a6122..b517b4a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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