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
+33 -43
View File
@@ -710,9 +710,10 @@ ArchConnGeometry archConnectorGeometry(
}
}
// 无折点:自动单拐角(先横后竖 / 先竖后横由主方向决定)。
// 无折点:自动单拐角(先横后竖 / 先竖后横按两端射出点的主方向决定,
// 端点位置稳定,不随中心方向抖动)。
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
? <Offset>[a, Offset(b.dx, a.dy), b]
: <Offset>[a, Offset(a.dx, b.dy), b];
@@ -727,7 +728,11 @@ ArchConnGeometry archConnectorGeometry(
);
}
/// 正交走线的两端射出点(从图形边框取点;自由端点原样返回)。
/// 正交走线的两端射出点。
///
/// 稳定优先:端点**朝「保存的端点位置」(用户画线 / 拖拽的一侧)**在边框取点——
/// 不会随两图形中心方向的微小变化而左右乱跳;仅当保存端点接近中心
/// (程序化创建等)时,退回「朝向对方中心象限」的自动取向。
(Offset, Offset) _orthoEnds(
ArchShape? sf,
ArchShape? st,
@@ -736,48 +741,33 @@ ArchConnGeometry archConnectorGeometry(
Offset freeFrom,
Offset freeTo,
) {
final bool horizontalFirst =
(cTo.dx - cFrom.dx).abs() >= (cTo.dy - cFrom.dy).abs();
Offset a;
Offset b;
if (horizontalFirst) {
a = sf == null
? freeFrom
: archBorderPoint(
sf,
Offset(
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,
),
);
if (sf == null) {
a = freeFrom;
} else if ((freeFrom - sf.rect.center).distance < 4) {
a = archBorderPoint(
sf,
Offset(
cTo.dx >= cFrom.dx ? sf.rect.right + 1e5 : sf.rect.left - 1e5,
cTo.dy >= cFrom.dy ? sf.rect.bottom + 1e5 : sf.rect.top - 1e5,
),
);
} else {
a = sf == null
? freeFrom
: archBorderPoint(
sf,
Offset(
cFrom.dx,
cTo.dy >= cFrom.dy ? sf.rect.bottom + 1e5 : sf.rect.top - 1e5,
),
);
b = st == null
? freeTo
: archBorderPoint(
st,
Offset(
cTo.dx,
cTo.dy >= cFrom.dy ? st.rect.top - 1e5 : st.rect.bottom + 1e5,
),
);
a = archNearestBorderPoint(sf, freeFrom);
}
Offset b;
if (st == null) {
b = freeTo;
} else if ((freeTo - st.rect.center).distance < 4) {
b = archBorderPoint(
st,
Offset(
cFrom.dx >= cTo.dx ? st.rect.right + 1e5 : st.rect.left - 1e5,
cFrom.dy >= cTo.dy ? st.rect.bottom + 1e5 : st.rect.top - 1e5,
),
);
} else {
b = archNearestBorderPoint(st, freeTo);
}
return (a, b);
}
+87 -20
View File
@@ -2484,10 +2484,73 @@ Future<String?> showTextEditDialog(
return result;
}
class HelpDialog extends StatelessWidget {
class HelpDialog extends StatefulWidget {
/// 构造帮助中心(左侧垂直导航 + 右侧内容,不再水平滑动)。
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
Widget build(BuildContext context) {
final Tokens t = context.tok;
@@ -2512,24 +2575,28 @@ class HelpDialog extends StatelessWidget {
),
const Divider(height: 22),
Expanded(
child: DefaultTabController(
length: 6,
child: Column(
children: <Widget>[
const TabBar(
isScrollable: true,
tabs: <Widget>[
Tab(text: '首页与模块'),
Tab(text: '时序图 · 动作'),
Tab(text: '时序图 · 视图导出'),
Tab(text: '架构图 · 绘制识别'),
Tab(text: '架构图 · 尺寸导出'),
Tab(text: '界面与快捷键'),
Tab(text: '关于'),
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
// 左侧:垂直导航(窄栏,内容过高时纵向滚动)。
SizedBox(
width: 150,
child: ListView(
children: <Widget>[
for (int i = 0; i < _tabs.length; i++)
_navItem(t, i, _tabs[i]),
],
),
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>[
// 目标:从首页进入正确模块、理解文档与数据位置。
_section(t, <List<String>>[
@@ -2610,8 +2677,8 @@ class HelpDialog extends StatelessWidget {
],
),
),
],
),
),
],
),
),
Align(
+1 -1
View File
@@ -2,7 +2,7 @@
///
/// 应用内更新检查用它判断服务器发布的版本是否更新;
/// **每次发版必须与 pubspec 同步更新**(见 BUILD-NOTES 的发布流程)。
const String kAppVersion = '1.3.7';
const String kAppVersion = '1.3.8';
/// 是否要求授权(License)才能导出。
///