3 Commits

33 changed files with 372 additions and 175 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 149 KiB

After

Width:  |  Height:  |  Size: 149 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 KiB

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 KiB

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 KiB

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 KiB

After

Width:  |  Height:  |  Size: 149 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 KiB

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 121 KiB

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 175 KiB

After

Width:  |  Height:  |  Size: 174 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 170 KiB

After

Width:  |  Height:  |  Size: 170 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 KiB

After

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 133 KiB

After

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 95 KiB

+24 -34
View File
@@ -710,9 +710,10 @@ ArchConnGeometry archConnectorGeometry(
} }
} }
// 无折点:自动单拐角(先横后竖 / 先竖后横由主方向决定)。 // 无折点:自动单拐角(先横后竖 / 先竖后横按两端射出点的主方向决定,
// 端点位置稳定,不随中心方向抖动)。
final bool horizontalFirst = final bool horizontalFirst =
(cTo.dx - cFrom.dx).abs() >= (cTo.dy - cFrom.dy).abs(); (b.dx - a.dx).abs() >= (b.dy - a.dy).abs();
final List<Offset> pts = horizontalFirst final List<Offset> pts = horizontalFirst
? <Offset>[a, Offset(b.dx, a.dy), b] ? <Offset>[a, Offset(b.dx, a.dy), b]
: <Offset>[a, Offset(a.dx, b.dy), b]; : <Offset>[a, Offset(a.dx, b.dy), b];
@@ -727,7 +728,11 @@ ArchConnGeometry archConnectorGeometry(
); );
} }
/// 正交走线的两端射出点(从图形边框取点;自由端点原样返回)。 /// 正交走线的两端射出点。
///
/// 稳定优先:端点**朝「保存的端点位置」(用户画线 / 拖拽的一侧)**在边框取点——
/// 不会随两图形中心方向的微小变化而左右乱跳;仅当保存端点接近中心
/// (程序化创建等)时,退回「朝向对方中心象限」的自动取向。
(Offset, Offset) _orthoEnds( (Offset, Offset) _orthoEnds(
ArchShape? sf, ArchShape? sf,
ArchShape? st, ArchShape? st,
@@ -736,48 +741,33 @@ ArchConnGeometry archConnectorGeometry(
Offset freeFrom, Offset freeFrom,
Offset freeTo, Offset freeTo,
) { ) {
final bool horizontalFirst =
(cTo.dx - cFrom.dx).abs() >= (cTo.dy - cFrom.dy).abs();
Offset a; Offset a;
Offset b; if (sf == null) {
if (horizontalFirst) { a = freeFrom;
a = sf == null } else if ((freeFrom - sf.rect.center).distance < 4) {
? freeFrom a = archBorderPoint(
: archBorderPoint(
sf, sf,
Offset( Offset(
cTo.dx >= cFrom.dx ? sf.rect.right + 1e5 : sf.rect.left - 1e5, cTo.dx >= cFrom.dx ? sf.rect.right + 1e5 : sf.rect.left - 1e5,
cFrom.dy,
),
);
b = st == null
? freeTo
: archBorderPoint(
st,
Offset(
cTo.dx >= cFrom.dx ? st.rect.left - 1e5 : st.rect.right + 1e5,
cTo.dy,
),
);
} else {
a = sf == null
? freeFrom
: archBorderPoint(
sf,
Offset(
cFrom.dx,
cTo.dy >= cFrom.dy ? sf.rect.bottom + 1e5 : sf.rect.top - 1e5, cTo.dy >= cFrom.dy ? sf.rect.bottom + 1e5 : sf.rect.top - 1e5,
), ),
); );
b = st == null } else {
? freeTo a = archNearestBorderPoint(sf, freeFrom);
: archBorderPoint( }
Offset b;
if (st == null) {
b = freeTo;
} else if ((freeTo - st.rect.center).distance < 4) {
b = archBorderPoint(
st, st,
Offset( Offset(
cTo.dx, cFrom.dx >= cTo.dx ? st.rect.right + 1e5 : st.rect.left - 1e5,
cTo.dy >= cFrom.dy ? st.rect.top - 1e5 : st.rect.bottom + 1e5, cFrom.dy >= cTo.dy ? st.rect.bottom + 1e5 : st.rect.top - 1e5,
), ),
); );
} else {
b = archNearestBorderPoint(st, freeTo);
} }
return (a, b); return (a, b);
} }
+15
View File
@@ -1486,6 +1486,21 @@ class AppController extends ChangeNotifier {
archFit(); archFit();
} }
/// 识别当前墨迹(不载入示例):把画布上待识别的笔迹逐笔转化。
///
/// 顶部「识别(N)」按钮与手动确认识别模式使用;没有墨迹时只给提示。
void archRecognizeInk() {
if (arch.strokes.isEmpty) {
_status = '没有待识别的墨迹(先用「手绘」画几笔)';
notifyListeners();
return;
}
_archSelIds = const <String>[];
_archPlayToken++;
_status = '识别中:逐笔转化(${arch.strokes.length} 笔)…';
notifyListeners();
}
/// 清空架构图。 /// 清空架构图。
void archClear() { void archClear() {
_archSelIds = const <String>[]; _archSelIds = const <String>[];
+1 -1
View File
@@ -1225,7 +1225,7 @@ class _AppShellState extends State<AppShell> {
border: Border.all(color: t.line2), border: Border.all(color: t.line2),
), ),
child: InkWell( child: InkWell(
onTap: c.arch.strokes.isEmpty ? null : c.archPlayDemo, onTap: c.arch.strokes.isEmpty ? null : c.archRecognizeInk,
borderRadius: BorderRadius.circular(9), borderRadius: BorderRadius.circular(9),
child: Container( child: Container(
height: 34 * _toolScale, height: 34 * _toolScale,
+30 -88
View File
@@ -16,7 +16,6 @@ import 'package:flutter/material.dart';
import '../arch/arch_models.dart'; import '../arch/arch_models.dart';
import '../arch/arch_painter.dart'; import '../arch/arch_painter.dart';
import '../arch/arch_samples.dart';
import '../library/symbol_library.dart'; import '../library/symbol_library.dart';
import '../persistence/android_docs.dart'; import '../persistence/android_docs.dart';
import '../sketch/sketch_models.dart'; import '../sketch/sketch_models.dart';
@@ -348,52 +347,12 @@ class ArchLeftBody extends StatelessWidget {
Text('影响新绘制的图形;选中图形后点色块可直接换色(支持多选)。', Text('影响新绘制的图形;选中图形后点色块可直接换色(支持多选)。',
style: TextStyle(color: t.dim, fontSize: 10, height: 1.5)), style: TextStyle(color: t.dim, fontSize: 10, height: 1.5)),
const SizedBox(height: 14), const SizedBox(height: 14),
_sec(t, '示例场景'), SizedBox(
const SizedBox(height: 8), width: double.infinity,
Row( child: TextButton.icon(
children: <Widget>[
Expanded(
child: OutlinedButton(
onPressed: () => c.archLoadDemo(ArchDemoKind.ink),
style: _btnStyle(),
child: const Text('手绘稿'),
),
),
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: <String>[
'Microsoft YaHei',
'Segoe UI',
'sans-serif',
],
),
),
child: const Text('识别墨迹 ▶'),
),
),
],
),
const SizedBox(height: 8),
Row(
children: <Widget>[
Expanded(
child: OutlinedButton(
onPressed: () => c.archLoadDemo(ArchDemoKind.done),
style: _btnStyle(),
child: const Text('完成图'),
),
),
const SizedBox(width: 8),
Expanded(
child: TextButton(
onPressed: c.archClear, onPressed: c.archClear,
icon: const Icon(Icons.delete_sweep_outlined, size: 15),
label: const Text('清空画布'),
style: TextButton.styleFrom( style: TextButton.styleFrom(
foregroundColor: t.danger, foregroundColor: t.danger,
visualDensity: VisualDensity.compact, visualDensity: VisualDensity.compact,
@@ -407,11 +366,8 @@ class ArchLeftBody extends StatelessWidget {
], ],
), ),
), ),
child: const Text('清空画布'),
), ),
), ),
],
),
const SizedBox(height: 14), const SizedBox(height: 14),
Container( Container(
padding: const EdgeInsets.all(10), padding: const EdgeInsets.all(10),
@@ -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: <String>[
'Microsoft YaHei',
'Segoe UI',
'sans-serif',
],
),
);
} }
/// 架构图右侧栏主体:选中对象属性(支持多选)。 /// 架构图右侧栏主体:选中对象属性(支持多选)。
@@ -662,31 +604,6 @@ class ArchRightBody extends StatelessWidget {
style: TextStyle(color: t.sub, fontSize: 11), style: TextStyle(color: t.sub, fontSize: 11),
), ),
const SizedBox(height: 8), const SizedBox(height: 8),
Row(
children: <Widget>[
_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: <Widget>[
if (s.type == ArchShapeType.polyline ||
s.type == ArchShapeType.curve) ...<Widget>[
_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( Row(
children: <Widget>[ children: <Widget>[
Text('尺寸 · mm(点数值直接修改)', Text('尺寸 · mm(点数值直接修改)',
@@ -771,6 +688,31 @@ class ArchRightBody extends StatelessWidget {
], ],
), ),
), ),
const SizedBox(height: 8),
Row(
children: <Widget>[
_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: <Widget>[
if (s.type == ArchShapeType.polyline ||
s.type == ArchShapeType.curve) ...<Widget>[
_mini(
t,
s.type == ArchShapeType.polyline ? '平滑为曲线' : '折线化',
() => _togglePolyCurve(c, s),
),
const SizedBox(width: 6),
],
_mini(t, '删除(Del)', c.removeArchSelection, danger: true),
],
),
]) ])
else if (cn != null) else if (cn != null)
_card(t, <Widget>[ _card(t, <Widget>[
+7 -3
View File
@@ -48,6 +48,9 @@ class BrandMenuButton extends StatelessWidget {
} }
/// 构建按钮。 /// 构建按钮。
///
/// 与工具栏「手绘 / 选择」等分段按钮**等高同形**(圆角矩形):
/// 固定高度 34×scale、圆角 10、内容垂直居中。
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final Tokens t = context.tok; final Tokens t = context.tok;
@@ -62,8 +65,9 @@ class BrandMenuButton extends StatelessWidget {
borderRadius: radius, borderRadius: radius,
hoverColor: t.accent.withValues(alpha: 0.08), hoverColor: t.accent.withValues(alpha: 0.08),
child: Container( child: Container(
// 高度只由内容决定:去掉上下留白(按钮高度 = 内容高度)。 height: 34 * scale,
padding: EdgeInsets.only(left: 9 * scale, right: 9 * scale), padding: EdgeInsets.symmetric(horizontal: 9 * scale),
alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: radius, borderRadius: radius,
border: Border.all(color: t.line2), border: Border.all(color: t.line2),
@@ -71,7 +75,7 @@ class BrandMenuButton extends StatelessWidget {
child: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
AppLogo(size: (compact ? 22 : 24) * scale), AppLogo(size: 20 * scale),
SizedBox(width: 7 * scale), SizedBox(width: 7 * scale),
Column( Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
+86 -18
View File
@@ -2479,14 +2479,78 @@ Future<String?> showTextEditDialog(
); );
}, },
); );
ctrl.dispose(); // 等对话框退场动画结束后再释放输入控制器(动画期间组件仍会引用它)。
Future<void>.delayed(const Duration(milliseconds: 400), ctrl.dispose);
return result; return result;
} }
class HelpDialog extends StatelessWidget { class HelpDialog extends StatefulWidget {
/// 构造帮助中心(左侧垂直导航 + 右侧内容,不再水平滑动)。
const HelpDialog({super.key}); const HelpDialog({super.key});
/// 渲染帮助中心:标签栏 + 各标签页的内容列表。 /// 创建状态。
@override
State<HelpDialog> createState() => _HelpDialogState();
}
/// 帮助中心状态:记录当前分页(左侧垂直导航索引)。
class _HelpDialogState extends State<HelpDialog> {
int _tab = 0;
/// 分页标题(与内容顺序一致)。
static const List<String> _tabs = <String>[
'首页与模块',
'时序图 · 动作',
'时序图 · 视图导出',
'架构图 · 绘制识别',
'架构图 · 尺寸导出',
'界面与快捷键',
'关于',
];
/// 左侧垂直导航条目。
Widget _navItem(Tokens t, int index, String label) {
final bool active = _tab == index;
return InkWell(
onTap: () => setState(() => _tab = index),
borderRadius: BorderRadius.circular(8),
child: Container(
margin: const EdgeInsets.only(bottom: 6),
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 9),
decoration: BoxDecoration(
color: active
? t.accent.withValues(alpha: 0.14)
: Colors.transparent,
borderRadius: BorderRadius.circular(8),
border: Border.all(
color: active ? t.accent : Colors.transparent,
),
),
child: Row(
children: <Widget>[
Icon(
active ? Icons.chevron_right : Icons.circle,
size: active ? 15 : 6,
color: active ? t.accent : t.dim,
),
const SizedBox(width: 8),
Expanded(
child: Text(
label,
style: TextStyle(
color: active ? t.accent : t.sub,
fontSize: 12,
fontWeight: active ? FontWeight.w700 : FontWeight.w500,
),
),
),
],
),
),
);
}
/// 渲染帮助中心:左侧分页导航 + 右侧内容(垂直滚动)。
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final Tokens t = context.tok; final Tokens t = context.tok;
@@ -2511,24 +2575,28 @@ class HelpDialog extends StatelessWidget {
), ),
const Divider(height: 22), const Divider(height: 22),
Expanded( Expanded(
child: DefaultTabController( child: Row(
length: 6, crossAxisAlignment: CrossAxisAlignment.stretch,
child: Column(
children: <Widget>[ children: <Widget>[
const TabBar( // 左侧:垂直导航(窄栏,内容过高时纵向滚动)。
isScrollable: true, SizedBox(
tabs: <Widget>[ width: 150,
Tab(text: '首页与模块'), child: ListView(
Tab(text: '时序图 · 动作'), children: <Widget>[
Tab(text: '时序图 · 视图导出'), for (int i = 0; i < _tabs.length; i++)
Tab(text: '架构图 · 绘制识别'), _navItem(t, i, _tabs[i]),
Tab(text: '架构图 · 尺寸导出'),
Tab(text: '界面与快捷键'),
Tab(text: '关于'),
], ],
), ),
),
const SizedBox(width: 12),
Container(width: 1, color: t.line2),
const SizedBox(width: 12),
// 右侧:当前分页内容(垂直滚动)。
Expanded( Expanded(
child: TabBarView( child: SingleChildScrollView(
key: ValueKey<int>(_tab),
child: IndexedStack(
index: _tab,
children: <Widget>[ children: <Widget>[
// 目标:从首页进入正确模块、理解文档与数据位置。 // 目标:从首页进入正确模块、理解文档与数据位置。
_section(t, <List<String>>[ _section(t, <List<String>>[
@@ -2609,8 +2677,8 @@ class HelpDialog extends StatelessWidget {
], ],
), ),
), ),
],
), ),
],
), ),
), ),
Align( Align(
+1 -1
View File
@@ -2,7 +2,7 @@
/// ///
/// 应用内更新检查用它判断服务器发布的版本是否更新; /// 应用内更新检查用它判断服务器发布的版本是否更新;
/// **每次发版必须与 pubspec 同步更新**(见 BUILD-NOTES 的发布流程)。 /// **每次发版必须与 pubspec 同步更新**(见 BUILD-NOTES 的发布流程)。
const String kAppVersion = '1.3.6'; const String kAppVersion = '1.3.8';
/// 是否要求授权(License)才能导出。 /// 是否要求授权(License)才能导出。
/// ///
+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 # 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 # 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. # of the product and file versions while build-number is used as the build suffix.
version: 1.3.6+28 version: 1.3.8+30
environment: environment:
sdk: ^3.13.3 sdk: ^3.13.3
+27
View File
@@ -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 秒)。
+28
View File
@@ -0,0 +1,28 @@
# V1.3.8 更新内容
> ⚠️ 1.3.5 大版本的后续修复增强版。新功能仍可能存在较多 bug 与问题,
> 遇到问题欢迎反馈(开发者邮箱 liuyu65@126.com / 微信 online-goose)。
## 帮助中心:改为垂直排列(不再水平滑动)
- 帮助窗口改为**左侧垂直导航 + 右侧内容**:七个分页(首页与模块 / 时序图 ·
动作 / 时序图 · 视图导出 / 架构图 · 绘制识别 / 架构图 · 尺寸导出 /
界面与快捷键 / **关于**)纵向排列,点击即切换,不需要再左右滑动;
- 修复一处分页控制器长度不一致的问题(可能导致「关于」分页在部分情况下
点不开)。
## 连线端点捕捉稳定性修复("乱飘")
- 连线端点改为**按用户实际画线 / 拖拽的一侧**在图形边框上取点——
不再随两图形中心方向的微小变化在"右边 / 下边"之间乱跳;
- 只有程序化创建(端点恰在图形中心)时才退回"朝向对方"的自动取向;
- 自动单拐角方向也随之以实际端点为准,走线更符合直觉。
## 其它(1.3.7 修复回顾,如未更新过请一并获取)
- 安卓 logo 按钮与手绘按钮等高同形;「识别(N)」只识别当前墨迹;
移除示例场景入口;「尺寸 · mm」移到属性卡最上方;
- 修复编辑对话框在退场动画期间释放输入控制器导致的偶发异常。
> 安卓桌面若仍显示旧名称(如"时序图设计"):属桌面启动器缓存,
> 卸载后重新安装一次即可;应用内「关于」页可核对版本号为 1.3.8。
+24 -4
View File
@@ -84,8 +84,16 @@ if ($rel -and $rel.id) {
[System.IO.File]::WriteAllText($tmp, $payload, (New-Object System.Text.UTF8Encoding($false))) [System.IO.File]::WriteAllText($tmp, $payload, (New-Object System.Text.UTF8Encoding($false)))
Write-Host "创建 Release v$Version ..." Write-Host "创建 Release v$Version ..."
$resp = curl.exe -s --max-time 300 -X POST -H "Content-Type: application/json" --data-binary "@$tmp" -u $Auth "$Server/api/v1/repos/$Owner/$Repo/releases" $resp = curl.exe -s --max-time 300 -X POST -H "Content-Type: application/json" --data-binary "@$tmp" -u $Auth "$Server/api/v1/repos/$Owner/$Repo/releases"
$rel = $resp | ConvertFrom-Json # 响应解析容错:偶发 JSON 解析异常时按 tag 重新查询(创建可能已成功)。
if (-not $rel.id) { throw "创建 Release 失败:$resp" } $rel = $null
try { $rel = $resp | ConvertFrom-Json } catch { $rel = $null }
if (-not $rel -or -not $rel.id) {
curl.exe -s --max-time 300 -o $tagFile "$Server/api/v1/repos/$Owner/$Repo/releases/tags/v$Version" | Out-Null
try {
$rel = [System.IO.File]::ReadAllText($tagFile, [System.Text.Encoding]::UTF8) | ConvertFrom-Json
} catch { $rel = $null }
}
if (-not $rel -or -not $rel.id) { throw "创建 Release 失败:$resp" }
} }
Write-Host "Release id = $($rel.id)" Write-Host "Release id = $($rel.id)"
@@ -106,8 +114,20 @@ function Upload-Asset([string]$path) {
} catch {} } catch {}
Write-Host "上传附件:$name (限速 $UploadLimit)..." Write-Host "上传附件:$name (限速 $UploadLimit)..."
$r = curl.exe -s --limit-rate $UploadLimit -X POST -F "attachment=@$path" -u $Auth "$Server/api/v1/repos/$Owner/$Repo/releases/$($rel.id)/assets?name=$name" $r = curl.exe -s --limit-rate $UploadLimit -X POST -F "attachment=@$path" -u $Auth "$Server/api/v1/repos/$Owner/$Repo/releases/$($rel.id)/assets?name=$name"
$asset = $r | ConvertFrom-Json # 解析容错:异常时按 tag 复核附件是否已存在(上传可能已成功)。
if (-not $asset.name) { throw "上传失败:$r" } $asset = $null
try { $asset = $r | ConvertFrom-Json } catch { $asset = $null }
if (-not $asset -or -not $asset.name) {
curl.exe -s --max-time 300 -o $curFile "$Server/api/v1/repos/$Owner/$Repo/releases/tags/v$Version" | Out-Null
$okName = $false
try {
$cur2 = [System.IO.File]::ReadAllText($curFile, [System.Text.Encoding]::UTF8) | ConvertFrom-Json
foreach ($a in $cur2.assets) {
if ($a.name -eq $name) { $okName = $true; $asset = $a }
}
} catch {}
if (-not $okName) { throw "上传失败:$r" }
}
Write-Host " 完成:$($asset.browser_download_url)" Write-Host " 完成:$($asset.browser_download_url)"
} }
Upload-Asset $ApkPath Upload-Asset $ApkPath
+47
View File
@@ -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();
});
}
+56
View File
@@ -801,6 +801,44 @@ void main() {
.reduce((double x, double y) => x < y ? x : y); .reduce((double x, double y) => x < y ? x : y);
expect(dmin, lessThan(2), reason: '路径应经过拖拽的角点'); expect(dmin, lessThan(2), reason: '路径应经过拖拽的角点');
}); });
test('端点捕捉稳定:按保存的画线侧取边框点(不随中心方向乱跳)', () {
const ArchShape a = ArchShape(
id: 'A',
type: ArchShapeType.rect,
rect: Rect.fromLTWH(0, 0, 100, 100),
);
const ArchShape b = ArchShape(
id: 'B',
type: ArchShapeType.rect,
rect: Rect.fromLTWH(300, 140, 100, 100),
);
final ArchDoc doc =
ArchDoc.empty.copyWith(shapes: <ArchShape>[a, b]);
final ArchConnector c1 = ArchConnector(
id: 'C1',
fromId: 'A',
from: const Offset(0, 50),
toId: 'B',
to: const Offset(350, 190),
);
// 从 A 的左侧画线:置左边中点 → 起点应留在左侧(目标在右下也不跳)。
final ArchConnGeometry g1 = archConnectorGeometry(doc, c1);
expect(g1.pts.first.dx, closeTo(0, 1));
// 从 A 的右侧画线:置右边中点 → 起点应留在右侧。
final ArchConnGeometry g2 =
archConnectorGeometry(doc, c1.copyWith(from: const Offset(100, 50)));
expect(g2.pts.first.dx, closeTo(100, 1));
// 保存端点为图形中心(程序化创建):退回朝向对方,且落在边框上。
final ArchConnGeometry g3 =
archConnectorGeometry(doc, c1.copyWith(from: a.rect.center));
final Offset p = g3.pts.first;
final bool onBorder = (p.dx - a.rect.left).abs() < 1 ||
(p.dx - a.rect.right).abs() < 1 ||
(p.dy - a.rect.top).abs() < 1 ||
(p.dy - a.rect.bottom).abs() < 1;
expect(onBorder, isTrue);
});
}); });
group('橡皮擦', () { group('橡皮擦', () {
@@ -835,6 +873,24 @@ void main() {
expect(c.archAutoRecognize, isFalse); expect(c.archAutoRecognize, isFalse);
expect(c.status, contains('手动')); 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>[Offset(0, 0), Offset(10, 0), Offset(10, 10)],
));
c.archRecognizeInk();
expect(c.archPlayToken, t0 + 1);
expect(c.arch.strokes.length, 1, reason: '识别前墨迹保持不动');
});
}); });
} }