diff --git a/demo/arch-done-dark.png b/demo/arch-done-dark.png index b8bee78..729b5d7 100644 Binary files a/demo/arch-done-dark.png and b/demo/arch-done-dark.png differ diff --git a/demo/arch-done-light.png b/demo/arch-done-light.png index 8b9bdb7..d1f3026 100644 Binary files a/demo/arch-done-light.png and b/demo/arch-done-light.png differ diff --git a/demo/arch-ink-light.png b/demo/arch-ink-light.png index 0e7905c..4565d7c 100644 Binary files a/demo/arch-ink-light.png and b/demo/arch-ink-light.png differ diff --git a/demo/arch-menu-light.png b/demo/arch-menu-light.png index 5680aea..ad5d058 100644 Binary files a/demo/arch-menu-light.png and b/demo/arch-menu-light.png differ diff --git a/demo/arch-sketch-light.png b/demo/arch-sketch-light.png index 43f4a63..556325b 100644 Binary files a/demo/arch-sketch-light.png and b/demo/arch-sketch-light.png differ diff --git a/demo/arch-symbols-light.png b/demo/arch-symbols-light.png index 485bb64..559b719 100644 Binary files a/demo/arch-symbols-light.png and b/demo/arch-symbols-light.png differ diff --git a/demo/home-light.png b/demo/home-light.png index baf1d8b..6c07d82 100644 Binary files a/demo/home-light.png and b/demo/home-light.png differ diff --git a/demo/tablet-bar-crowded-light.png b/demo/tablet-bar-crowded-light.png index 6f70f74..18d4877 100644 Binary files a/demo/tablet-bar-crowded-light.png and b/demo/tablet-bar-crowded-light.png differ diff --git a/demo/tablet-bar-dark.png b/demo/tablet-bar-dark.png index 4b47780..3ac1c7b 100644 Binary files a/demo/tablet-bar-dark.png and b/demo/tablet-bar-dark.png differ diff --git a/demo/tablet-bar-light-panels.png b/demo/tablet-bar-light-panels.png index b7fc9fa..b47e0e5 100644 Binary files a/demo/tablet-bar-light-panels.png and b/demo/tablet-bar-light-panels.png differ diff --git a/demo/tablet-bar-light.png b/demo/tablet-bar-light.png index 31df933..e94d610 100644 Binary files a/demo/tablet-bar-light.png and b/demo/tablet-bar-light.png differ diff --git a/demo/tablet-bar-slots-light.png b/demo/tablet-bar-slots-light.png index 7a588b1..b5a4a72 100644 Binary files a/demo/tablet-bar-slots-light.png and b/demo/tablet-bar-slots-light.png differ diff --git a/demo/tablet-circular-dark.png b/demo/tablet-circular-dark.png index 20268cd..404c141 100644 Binary files a/demo/tablet-circular-dark.png and b/demo/tablet-circular-dark.png differ diff --git a/demo/tablet-circular-light.png b/demo/tablet-circular-light.png index a29320b..996cf98 100644 Binary files a/demo/tablet-circular-light.png and b/demo/tablet-circular-light.png differ diff --git a/demo/tablet-circular-slots-light.png b/demo/tablet-circular-slots-light.png index 156e4a8..5d4d1a6 100644 Binary files a/demo/tablet-circular-slots-light.png and b/demo/tablet-circular-slots-light.png differ diff --git a/demo/tablet-flow-dark.png b/demo/tablet-flow-dark.png index 37369ef..360db13 100644 Binary files a/demo/tablet-flow-dark.png and b/demo/tablet-flow-dark.png differ diff --git a/demo/tablet-flow-export-menu-light.png b/demo/tablet-flow-export-menu-light.png index e78cc06..dc55d0c 100644 Binary files a/demo/tablet-flow-export-menu-light.png and b/demo/tablet-flow-export-menu-light.png differ diff --git a/demo/tablet-flow-light.png b/demo/tablet-flow-light.png index 78115dd..13a5d19 100644 Binary files a/demo/tablet-flow-light.png and b/demo/tablet-flow-light.png differ diff --git a/demo/tablet-flow-selected-light.png b/demo/tablet-flow-selected-light.png index 0a9b95c..082b0a8 100644 Binary files a/demo/tablet-flow-selected-light.png and b/demo/tablet-flow-selected-light.png differ diff --git a/demo/tablet-flow-slots-light.png b/demo/tablet-flow-slots-light.png index 1325a20..7742a98 100644 Binary files a/demo/tablet-flow-slots-light.png and b/demo/tablet-flow-slots-light.png differ diff --git a/lib/state/app_controller.dart b/lib/state/app_controller.dart index 4d89fc0..5b5a4db 100644 --- a/lib/state/app_controller.dart +++ b/lib/state/app_controller.dart @@ -1486,6 +1486,21 @@ class AppController extends ChangeNotifier { archFit(); } + /// 识别当前墨迹(不载入示例):把画布上待识别的笔迹逐笔转化。 + /// + /// 顶部「识别(N)」按钮与手动确认识别模式使用;没有墨迹时只给提示。 + void archRecognizeInk() { + if (arch.strokes.isEmpty) { + _status = '没有待识别的墨迹(先用「手绘」画几笔)'; + notifyListeners(); + return; + } + _archSelIds = const []; + _archPlayToken++; + _status = '识别中:逐笔转化(${arch.strokes.length} 笔)…'; + notifyListeners(); + } + /// 清空架构图。 void archClear() { _archSelIds = const []; diff --git a/lib/ui/app_shell.dart b/lib/ui/app_shell.dart index 3f62872..9227f7c 100644 --- a/lib/ui/app_shell.dart +++ b/lib/ui/app_shell.dart @@ -1225,7 +1225,7 @@ class _AppShellState extends State { border: Border.all(color: t.line2), ), child: InkWell( - onTap: c.arch.strokes.isEmpty ? null : c.archPlayDemo, + onTap: c.arch.strokes.isEmpty ? null : c.archRecognizeInk, borderRadius: BorderRadius.circular(9), child: Container( height: 34 * _toolScale, diff --git a/lib/ui/arch_panel.dart b/lib/ui/arch_panel.dart index 703d2d2..890ad83 100644 --- a/lib/ui/arch_panel.dart +++ b/lib/ui/arch_panel.dart @@ -16,7 +16,6 @@ import 'package:flutter/material.dart'; import '../arch/arch_models.dart'; import '../arch/arch_painter.dart'; -import '../arch/arch_samples.dart'; import '../library/symbol_library.dart'; import '../persistence/android_docs.dart'; import '../sketch/sketch_models.dart'; @@ -348,69 +347,26 @@ class ArchLeftBody extends StatelessWidget { Text('影响新绘制的图形;选中图形后点色块可直接换色(支持多选)。', style: TextStyle(color: t.dim, fontSize: 10, height: 1.5)), const SizedBox(height: 14), - _sec(t, '示例场景'), - const SizedBox(height: 8), - Row( - children: [ - Expanded( - child: OutlinedButton( - onPressed: () => c.archLoadDemo(ArchDemoKind.ink), - style: _btnStyle(), - child: const Text('手绘稿'), + SizedBox( + width: double.infinity, + child: TextButton.icon( + onPressed: c.archClear, + icon: const Icon(Icons.delete_sweep_outlined, size: 15), + label: const Text('清空画布'), + style: TextButton.styleFrom( + foregroundColor: t.danger, + visualDensity: VisualDensity.compact, + textStyle: const TextStyle( + fontSize: 11.5, + fontFamily: 'Microsoft YaHei UI', + fontFamilyFallback: [ + 'Microsoft YaHei', + 'Segoe UI', + 'sans-serif', + ], ), ), - const SizedBox(width: 8), - Expanded( - child: FilledButton( - onPressed: c.archPlayDemo, - style: FilledButton.styleFrom( - visualDensity: VisualDensity.compact, - textStyle: const TextStyle( - fontSize: 11.5, - fontFamily: 'Microsoft YaHei UI', - fontFamilyFallback: [ - 'Microsoft YaHei', - 'Segoe UI', - 'sans-serif', - ], - ), - ), - child: const Text('识别墨迹 ▶'), - ), - ), - ], - ), - const SizedBox(height: 8), - Row( - children: [ - Expanded( - child: OutlinedButton( - onPressed: () => c.archLoadDemo(ArchDemoKind.done), - style: _btnStyle(), - child: const Text('完成图'), - ), - ), - const SizedBox(width: 8), - Expanded( - child: TextButton( - onPressed: c.archClear, - style: TextButton.styleFrom( - foregroundColor: t.danger, - visualDensity: VisualDensity.compact, - textStyle: const TextStyle( - fontSize: 11.5, - fontFamily: 'Microsoft YaHei UI', - fontFamilyFallback: [ - 'Microsoft YaHei', - 'Segoe UI', - 'sans-serif', - ], - ), - ), - child: const Text('清空画布'), - ), - ), - ], + ), ), const SizedBox(height: 14), Container( @@ -543,20 +499,6 @@ class ArchLeftBody extends StatelessWidget { ), ); } - - /// 小尺寸描边按钮样式。 - ButtonStyle _btnStyle() => OutlinedButton.styleFrom( - visualDensity: VisualDensity.compact, - textStyle: const TextStyle( - fontSize: 11.5, - fontFamily: 'Microsoft YaHei UI', - fontFamilyFallback: [ - 'Microsoft YaHei', - 'Segoe UI', - 'sans-serif', - ], - ), - ); } /// 架构图右侧栏主体:选中对象属性(支持多选)。 @@ -662,31 +604,6 @@ class ArchRightBody extends StatelessWidget { style: TextStyle(color: t.sub, fontSize: 11), ), const SizedBox(height: 8), - Row( - children: [ - _mini(t, '编辑文字', () => _editText(context, c, s)), - const SizedBox(width: 6), - _mini(t, '上移一层', () => c.moveArchZ(s, 1)), - const SizedBox(width: 6), - _mini(t, '下移一层', () => c.moveArchZ(s, -1)), - ], - ), - const SizedBox(height: 6), - Row( - children: [ - if (s.type == ArchShapeType.polyline || - s.type == ArchShapeType.curve) ...[ - _mini( - t, - s.type == ArchShapeType.polyline ? '平滑为曲线' : '折线化', - () => _togglePolyCurve(c, s), - ), - const SizedBox(width: 6), - ], - _mini(t, '删除(Del)', c.removeArchSelection, danger: true), - ], - ), - const SizedBox(height: 10), Row( children: [ Text('尺寸 · mm(点数值直接修改)', @@ -771,6 +688,31 @@ class ArchRightBody extends StatelessWidget { ], ), ), + const SizedBox(height: 8), + Row( + children: [ + _mini(t, '编辑文字', () => _editText(context, c, s)), + const SizedBox(width: 6), + _mini(t, '上移一层', () => c.moveArchZ(s, 1)), + const SizedBox(width: 6), + _mini(t, '下移一层', () => c.moveArchZ(s, -1)), + ], + ), + const SizedBox(height: 6), + Row( + children: [ + if (s.type == ArchShapeType.polyline || + s.type == ArchShapeType.curve) ...[ + _mini( + t, + s.type == ArchShapeType.polyline ? '平滑为曲线' : '折线化', + () => _togglePolyCurve(c, s), + ), + const SizedBox(width: 6), + ], + _mini(t, '删除(Del)', c.removeArchSelection, danger: true), + ], + ), ]) else if (cn != null) _card(t, [ diff --git a/lib/ui/brand_menu.dart b/lib/ui/brand_menu.dart index f8cd515..bf95529 100644 --- a/lib/ui/brand_menu.dart +++ b/lib/ui/brand_menu.dart @@ -48,6 +48,9 @@ class BrandMenuButton extends StatelessWidget { } /// 构建按钮。 + /// + /// 与工具栏「手绘 / 选择」等分段按钮**等高同形**(圆角矩形): + /// 固定高度 34×scale、圆角 10、内容垂直居中。 @override Widget build(BuildContext context) { final Tokens t = context.tok; @@ -62,8 +65,9 @@ class BrandMenuButton extends StatelessWidget { borderRadius: radius, hoverColor: t.accent.withValues(alpha: 0.08), child: Container( - // 高度只由内容决定:去掉上下留白(按钮高度 = 内容高度)。 - padding: EdgeInsets.only(left: 9 * scale, right: 9 * scale), + height: 34 * scale, + padding: EdgeInsets.symmetric(horizontal: 9 * scale), + alignment: Alignment.center, decoration: BoxDecoration( borderRadius: radius, border: Border.all(color: t.line2), @@ -71,7 +75,7 @@ class BrandMenuButton extends StatelessWidget { child: Row( mainAxisSize: MainAxisSize.min, children: [ - AppLogo(size: (compact ? 22 : 24) * scale), + AppLogo(size: 20 * scale), SizedBox(width: 7 * scale), Column( mainAxisSize: MainAxisSize.min, diff --git a/lib/ui/dialogs.dart b/lib/ui/dialogs.dart index 1b6a9d5..b7c6acd 100644 --- a/lib/ui/dialogs.dart +++ b/lib/ui/dialogs.dart @@ -2479,7 +2479,8 @@ Future showTextEditDialog( ); }, ); - ctrl.dispose(); + // 等对话框退场动画结束后再释放输入控制器(动画期间组件仍会引用它)。 + Future.delayed(const Duration(milliseconds: 400), ctrl.dispose); return result; } diff --git a/lib/version.dart b/lib/version.dart index 322fb2d..ba83148 100644 --- a/lib/version.dart +++ b/lib/version.dart @@ -2,7 +2,7 @@ /// /// 应用内更新检查用它判断服务器发布的版本是否更新; /// **每次发版必须与 pubspec 同步更新**(见 BUILD-NOTES 的发布流程)。 -const String kAppVersion = '1.3.6'; +const String kAppVersion = '1.3.7'; /// 是否要求授权(License)才能导出。 /// diff --git a/pubspec.yaml b/pubspec.yaml index 8b1bef2..4882729 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.3.6+28 +version: 1.3.7+29 environment: sdk: ^3.13.3 diff --git a/release/notes/RELEASE_NOTES_v1.3.7.md b/release/notes/RELEASE_NOTES_v1.3.7.md new file mode 100644 index 0000000..8650b2f --- /dev/null +++ b/release/notes/RELEASE_NOTES_v1.3.7.md @@ -0,0 +1,27 @@ +# V1.3.7 更新内容 + +> ⚠️ 本版为 1.3.5 / 1.3.6 之后的修复增强版。新功能仍可能存在较多 bug 与问题, +> 遇到问题欢迎反馈(开发者邮箱 liuyu65@126.com / 微信 online-goose)。 + +## 安卓体验修复(本版重点) + +- **左上角 logo 按钮**:与「手绘 / 选择」等工具按钮**等高同形** + (圆角矩形、固定高度),不再出现"两头圆"的矮胶囊外观; +- **顶部「识别(N)」按钮**:现在**只识别你刚画的墨迹**——不再误载入示例场景; +- **移除「示例场景」入口**(手绘稿 / 完成图 / 识别演示):保留「清空画布」; +- **「尺寸 · mm」移到属性卡最上方**(选中图形即可看到): + 宽度 / 高度 / 长度 / 直径点数值直接修改,几何按比例缩放; + 「标注全部」在画布上显示尺寸标签,双击标签也可改值; +- **修复**:文本 / 数值编辑对话框在退场动画期间释放输入控制器导致的偶发异常 + (安卓上编辑尺寸、文字、标签时更容易命中)。 + +## 说明:安卓桌面显示旧名称怎么办 + +安装包名称已为 **EDC|易得设计**。若桌面/应用列表仍显示旧名(如"时序图设计"), +这是**桌面启动器缓存了旧标签**,不是安装包问题:请**卸载后重新安装一次**, +或重启手机刷新桌面缓存;在应用内「关于」页可核对当前版本号是否为 1.3.7。 + +## 其它 + +- 更新通道:仓库 `admin/EasyDesignCollection`(旧地址 301 兼容老客户端); +- 下载 / 上传统一限速 320KB/s;安卓包约 53MB(≈3 分钟)/ Windows 整包约 12MB(≈40 秒)。 diff --git a/test/arch_panel_test.dart b/test/arch_panel_test.dart new file mode 100644 index 0000000..56412f6 --- /dev/null +++ b/test/arch_panel_test.dart @@ -0,0 +1,47 @@ +// 架构图属性面板回归:选中图形后「尺寸 · mm」可见、可改值驱动几何。 +import 'package:flutter/material.dart' hide Action; +import 'package:flutter_test/flutter_test.dart'; +import 'package:sequence_diagram/arch/arch_models.dart'; +import 'package:sequence_diagram/model/models.dart'; +import 'package:sequence_diagram/state/app_controller.dart'; +import 'package:sequence_diagram/theme/tokens.dart'; +import 'package:sequence_diagram/ui/arch_panel.dart'; + +void main() { + testWidgets('选中图元后右栏出现「尺寸 · mm」,改值直接缩放几何', + (WidgetTester tester) async { + final AppController c = AppController(project: Project.demo()); + c.addArchShape(const ArchShape( + id: 'S1', + type: ArchShapeType.symbol, + symbolId: 'pe-ground', + rect: Rect.fromLTWH(100, 100, 80, 150), + )); + c.selectArch('S1'); + await tester.pumpWidget(MaterialApp( + theme: buildTheme(Tokens.light), + home: Scaffold( + body: SingleChildScrollView(child: ArchRightBody(controller: c)), + ), + )); + await tester.pump(); + + expect(find.textContaining('尺寸 · mm'), findsOneWidget); + expect(find.textContaining('标注全部'), findsOneWidget); + expect(find.text('80.0 mm'), findsOneWidget); + expect(find.text('150.0 mm'), findsOneWidget); + + // 点宽度值 → 弹出改值对话框 → 输入 160 → 几何宽变 160。 + await tester.tap(find.text('80.0 mm')); + await tester.pumpAndSettle(); + expect(find.textContaining('编辑宽度'), findsOneWidget); + await tester.enterText(find.byType(TextField), '160'); + await tester.tap(find.text('确定')); + await tester.pumpAndSettle(); + expect(c.arch.shapeById('S1')!.rect.width, 160); + + // 清理:先卸载组件树,再释放控制器(避免已释放断言)。 + await tester.pumpWidget(const SizedBox()); + c.dispose(); + }); +} diff --git a/test/arch_test.dart b/test/arch_test.dart index 4890d32..117bc92 100644 --- a/test/arch_test.dart +++ b/test/arch_test.dart @@ -835,6 +835,24 @@ void main() { expect(c.archAutoRecognize, isFalse); expect(c.status, contains('手动')); }); + + test('识别按钮只识别当前墨迹(不载入示例)', () { + final AppController c = AppController(project: Project.demo()); + addTearDown(c.dispose); + c.archClear(); + final int t0 = c.archPlayToken; + c.archRecognizeInk(); + expect(c.archPlayToken, t0, reason: '没有墨迹时不应触发识别'); + expect(c.arch.strokes, isEmpty); + expect(c.arch.shapes, isEmpty, reason: '不得载入示例图形'); + c.addArchStroke(const ArchStroke( + id: 'K1', + pts: [Offset(0, 0), Offset(10, 0), Offset(10, 10)], + )); + c.archRecognizeInk(); + expect(c.archPlayToken, t0 + 1); + expect(c.arch.strokes.length, 1, reason: '识别前墨迹保持不动'); + }); }); }