1.3.8:帮助中心改垂直导航(修复关于页控制器长度);连线端点捕捉按画线侧取点不再乱飘

This commit is contained in:
2026-10-11 13:03:16 +08:00
parent 3210ac50d8
commit 0ecaac0930
11 changed files with 188 additions and 65 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: 120 KiB

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 149 KiB

After

Width:  |  Height:  |  Size: 149 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 62 KiB

+33 -43
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, cTo.dy >= cFrom.dy ? sf.rect.bottom + 1e5 : sf.rect.top - 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 { } else {
a = sf == null a = archNearestBorderPoint(sf, freeFrom);
? freeFrom }
: archBorderPoint( Offset b;
sf, if (st == null) {
Offset( b = freeTo;
cFrom.dx, } else if ((freeTo - st.rect.center).distance < 4) {
cTo.dy >= cFrom.dy ? sf.rect.bottom + 1e5 : sf.rect.top - 1e5, b = archBorderPoint(
), st,
); Offset(
b = st == null cFrom.dx >= cTo.dx ? st.rect.right + 1e5 : st.rect.left - 1e5,
? freeTo cFrom.dy >= cTo.dy ? st.rect.bottom + 1e5 : st.rect.top - 1e5,
: archBorderPoint( ),
st, );
Offset( } else {
cTo.dx, b = archNearestBorderPoint(st, freeTo);
cTo.dy >= cFrom.dy ? st.rect.top - 1e5 : st.rect.bottom + 1e5,
),
);
} }
return (a, b); return (a, b);
} }
+87 -20
View File
@@ -2484,10 +2484,73 @@ Future<String?> showTextEditDialog(
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;
@@ -2512,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( SizedBox(
isScrollable: true, width: 150,
tabs: <Widget>[ 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: '界面与快捷键'),
Tab(text: '关于'),
], ],
), ),
Expanded( ),
child: TabBarView( const SizedBox(width: 12),
Container(width: 1, color: t.line2),
const SizedBox(width: 12),
// 右侧:当前分页内容(垂直滚动)。
Expanded(
child: SingleChildScrollView(
key: ValueKey<int>(_tab),
child: IndexedStack(
index: _tab,
children: <Widget>[ children: <Widget>[
// 目标:从首页进入正确模块、理解文档与数据位置。 // 目标:从首页进入正确模块、理解文档与数据位置。
_section(t, <List<String>>[ _section(t, <List<String>>[
@@ -2610,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.7'; 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.7+29 version: 1.3.8+30
environment: environment:
sdk: ^3.13.3 sdk: ^3.13.3
+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。
+38
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('橡皮擦', () {