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
+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(