feat: 产品更名「时序图设计器」+ 亮色图标 + 工具栏适配 1920x1080 + 对话框等比缩放 + 默认周期 3.6s
- 产品名:时序图设计器 Sequence Diagram Studio(窗口标题/帮助关于/README/RC/素材同步) - 图标改为亮色渐变+白色时钟,深色任务栏下清晰可见 - 工具栏新增紧凑布局(图标化/导出菜单),1920x1080 及 150% 缩放(1280 逻辑宽)下完整显示 - 对话框以 1920x1080 为基准等比放大(<=1.75x),更小窗口不缩小 - 默认循环周期 2400ms -> 3600ms(3.6s = 360°) - 重新构建 dist
This commit is contained in:
+149
-81
@@ -307,86 +307,127 @@ class _AppShellState extends State<AppShell> {
|
||||
),
|
||||
child: LayoutBuilder(
|
||||
builder: (BuildContext ctx, BoxConstraints cons) {
|
||||
// 响应式断点:窄于 1960 时使用紧凑布局(图标化、隐藏次要信息)。
|
||||
final bool compact = cons.maxWidth < 1960;
|
||||
// 左侧工具组:品牌、文件操作、撤销重做、编辑与视图切换。
|
||||
final List<Widget> left = <Widget>[
|
||||
const AppLogo(size: 32),
|
||||
const SizedBox(width: 10),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text('时序图工作台',
|
||||
style: TextStyle(color: t.text, fontSize: 14, fontWeight: FontWeight.w700, letterSpacing: 1)),
|
||||
if (!compact)
|
||||
Text('Sequence Diagram Studio', style: TextStyle(color: t.dim, fontSize: 10)),
|
||||
],
|
||||
),
|
||||
SizedBox(width: compact ? 12 : 18),
|
||||
_ghost(t, '新建', _newProject),
|
||||
_ghost(t, '打开', _open),
|
||||
_ghost(t, '保存', _save),
|
||||
const SizedBox(width: 6),
|
||||
_ghost(t, '撤销', c.canUndo ? c.undo : null, icon: Icons.undo),
|
||||
_ghost(t, '重做', c.canRedo ? c.redo : null, icon: Icons.redo),
|
||||
const SizedBox(width: 6),
|
||||
_addBtn(t, '添加动作', () => c.addAction(startAngle: 0)),
|
||||
_toggleBtn(t, '编辑', Icons.edit, () {
|
||||
final Action? a = c.selected;
|
||||
if (a != null) {
|
||||
showDialog<void>(context: context, builder: (_) => ActionEditorDialog(controller: c, action: a));
|
||||
// 响应式断点:宽于 1760 用完整布局;否则用紧凑布局,
|
||||
// 保证在 1920×1080(含 150% 缩放下的 1280 逻辑宽度)也能全部显示。
|
||||
final bool compact = cons.maxWidth < 1760;
|
||||
// 侧栏开关(两种布局共用)。
|
||||
final Widget sideToggleLeft = _iconBtn(t, Icons.view_sidebar_outlined, () => setState(() {
|
||||
if (_leftVisible) {
|
||||
_leftVisible = false;
|
||||
_leftHover = false;
|
||||
} else {
|
||||
_leftVisible = true;
|
||||
if (!_leftPinned) _leftHover = true;
|
||||
}
|
||||
}), tooltip: '显示 / 隐藏左侧栏');
|
||||
final Widget sideToggleRight = Transform(
|
||||
alignment: Alignment.center,
|
||||
transform: Matrix4.diagonal3Values(-1.0, 1.0, 1.0),
|
||||
child: _iconBtn(t, Icons.view_sidebar_outlined, () => setState(() {
|
||||
if (_rightVisible) {
|
||||
_rightVisible = false;
|
||||
_rightHover = false;
|
||||
} else {
|
||||
_rightVisible = true;
|
||||
if (!_rightPinned) _rightHover = true;
|
||||
}
|
||||
}),
|
||||
_aiBtn(t),
|
||||
const SizedBox(width: 12),
|
||||
_segmented(t),
|
||||
];
|
||||
// 右侧工具组:导出、缩放、单位、文件状态、侧栏开关与主题。
|
||||
final List<Widget> right = <Widget>[
|
||||
_primaryBtn(t, '导出 SVG', _exportSvg),
|
||||
const SizedBox(width: 6),
|
||||
_ghost(t, '导出 PNG', _exportPng),
|
||||
const SizedBox(width: 6),
|
||||
_zoomBox(t),
|
||||
const SizedBox(width: 6),
|
||||
if (compact)
|
||||
_iconBtn(t, Icons.crop_free, c.fitView, tooltip: '适应视图')
|
||||
else
|
||||
}), tooltip: '显示 / 隐藏右侧栏'),
|
||||
);
|
||||
|
||||
final List<Widget> left;
|
||||
final List<Widget> right;
|
||||
if (!compact) {
|
||||
// 完整布局:文字按钮 + 文件状态胶囊。
|
||||
left = <Widget>[
|
||||
const AppLogo(size: 32),
|
||||
const SizedBox(width: 10),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text('时序图设计器',
|
||||
style: TextStyle(color: t.text, fontSize: 14, fontWeight: FontWeight.w700, letterSpacing: 1)),
|
||||
Text('Sequence Diagram Studio', style: TextStyle(color: t.dim, fontSize: 10)),
|
||||
],
|
||||
),
|
||||
const SizedBox(width: 18),
|
||||
_ghost(t, '新建', _newProject),
|
||||
_ghost(t, '打开', _open),
|
||||
_ghost(t, '保存', _save),
|
||||
const SizedBox(width: 6),
|
||||
_ghost(t, '撤销', c.canUndo ? c.undo : null, icon: Icons.undo),
|
||||
_ghost(t, '重做', c.canRedo ? c.redo : null, icon: Icons.redo),
|
||||
const SizedBox(width: 6),
|
||||
_addBtn(t, '添加动作', () => c.addAction(startAngle: 0)),
|
||||
_toggleBtn(t, '编辑', Icons.edit, () {
|
||||
final Action? a = c.selected;
|
||||
if (a != null) {
|
||||
showDialog<void>(context: context, builder: (_) => ActionEditorDialog(controller: c, action: a));
|
||||
}
|
||||
}),
|
||||
_aiBtn(t),
|
||||
const SizedBox(width: 12),
|
||||
_segmented(t),
|
||||
];
|
||||
right = <Widget>[
|
||||
_primaryBtn(t, '导出 SVG', _exportSvg),
|
||||
const SizedBox(width: 6),
|
||||
_ghost(t, '导出 PNG', _exportPng),
|
||||
const SizedBox(width: 6),
|
||||
_zoomBox(t),
|
||||
const SizedBox(width: 6),
|
||||
_ghost(t, '适应视图', c.fitView),
|
||||
const SizedBox(width: 8),
|
||||
_unitDropdown(t),
|
||||
if (!compact) ...<Widget>[
|
||||
const SizedBox(width: 8),
|
||||
_unitDropdown(t),
|
||||
const SizedBox(width: 8),
|
||||
fileChip,
|
||||
],
|
||||
const SizedBox(width: 8),
|
||||
_iconBtn(t, Icons.view_sidebar_outlined, () => setState(() {
|
||||
if (_leftVisible) {
|
||||
_leftVisible = false;
|
||||
_leftHover = false;
|
||||
} else {
|
||||
_leftVisible = true;
|
||||
if (!_leftPinned) _leftHover = true;
|
||||
}
|
||||
}), tooltip: '显示 / 隐藏左侧栏'),
|
||||
Transform(
|
||||
alignment: Alignment.center,
|
||||
transform: Matrix4.diagonal3Values(-1.0, 1.0, 1.0),
|
||||
child: _iconBtn(t, Icons.view_sidebar_outlined, () => setState(() {
|
||||
if (_rightVisible) {
|
||||
_rightVisible = false;
|
||||
_rightHover = false;
|
||||
} else {
|
||||
_rightVisible = true;
|
||||
if (!_rightPinned) _rightHover = true;
|
||||
const SizedBox(width: 8),
|
||||
sideToggleLeft,
|
||||
sideToggleRight,
|
||||
_iconBtn(t, Icons.help_outline, () =>
|
||||
showDialog<void>(context: context, builder: (_) => const HelpDialog()), tooltip: '帮助 F1'),
|
||||
_themeToggle(t),
|
||||
];
|
||||
} else {
|
||||
// 紧凑布局:图标化 + 导出合并为菜单,尽量压缩宽度。
|
||||
left = <Widget>[
|
||||
const AppLogo(size: 28),
|
||||
const SizedBox(width: 8),
|
||||
Text('时序图设计器',
|
||||
style: TextStyle(color: t.text, fontSize: 13, fontWeight: FontWeight.w700, letterSpacing: 0.5)),
|
||||
const SizedBox(width: 8),
|
||||
_iconBtn(t, Icons.note_add_outlined, _newProject, tooltip: '新建 Ctrl+N'),
|
||||
_iconBtn(t, Icons.folder_open_outlined, _open, tooltip: '打开 Ctrl+O'),
|
||||
_iconBtn(t, Icons.save_outlined, _save, tooltip: '保存 Ctrl+S'),
|
||||
const SizedBox(width: 4),
|
||||
_iconBtn(t, Icons.undo, c.canUndo ? c.undo : null, tooltip: '撤销 Ctrl+Z'),
|
||||
_iconBtn(t, Icons.redo, c.canRedo ? c.redo : null, tooltip: '重做 Ctrl+Y'),
|
||||
const SizedBox(width: 4),
|
||||
_iconBtn(t, Icons.add_circle_outline, () => c.addAction(startAngle: 0), tooltip: '添加动作', color: t.ok),
|
||||
_iconBtn(t, Icons.edit, () {
|
||||
final Action? a = c.selected;
|
||||
if (a != null) {
|
||||
showDialog<void>(context: context, builder: (_) => ActionEditorDialog(controller: c, action: a));
|
||||
}
|
||||
}), tooltip: '显示 / 隐藏右侧栏'),
|
||||
),
|
||||
_iconBtn(t, Icons.help_outline, () =>
|
||||
showDialog<void>(context: context, builder: (_) => const HelpDialog()), tooltip: '帮助 F1'),
|
||||
_themeToggle(t),
|
||||
];
|
||||
}, tooltip: '编辑', color: t.accent),
|
||||
_iconBtn(t, Icons.auto_awesome, () =>
|
||||
showDialog<void>(context: context, builder: (_) => AiGenerateDialog(controller: c)),
|
||||
tooltip: 'AI 生成', color: t.accent2),
|
||||
const SizedBox(width: 8),
|
||||
_segmented(t, compact: true),
|
||||
];
|
||||
right = <Widget>[
|
||||
_exportMenuBtn(t),
|
||||
_zoomBox(t),
|
||||
_iconBtn(t, Icons.crop_free, c.fitView, tooltip: '适应视图'),
|
||||
_unitDropdown(t),
|
||||
sideToggleLeft,
|
||||
sideToggleRight,
|
||||
_iconBtn(t, Icons.help_outline, () =>
|
||||
showDialog<void>(context: context, builder: (_) => const HelpDialog()), tooltip: '帮助 F1'),
|
||||
_themeToggle(t),
|
||||
];
|
||||
}
|
||||
// 用「最小宽度 = 视口宽度」约束让内容铺满整条工具栏:
|
||||
// 空间足够时 Spacer 把右侧工具组顶到最右(不再留空白);
|
||||
// 空间不足时横向滚动,避免溢出。
|
||||
@@ -405,14 +446,16 @@ class _AppShellState extends State<AppShell> {
|
||||
}
|
||||
|
||||
/// 视图模式分段控件:条形节拍 / 圆周节拍一键切换。
|
||||
Widget _segmented(Tokens t) {
|
||||
///
|
||||
/// [compact] 为真时使用更窄的宽度,适配 1920×1080 等较小窗口。
|
||||
Widget _segmented(Tokens t, {bool compact = false}) {
|
||||
final bool bar = c.project.viewState.mode == ViewMode.bar;
|
||||
Widget seg(String label, bool active, VoidCallback onTap) {
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
child: Container(
|
||||
width: 140,
|
||||
width: compact ? 96 : 140,
|
||||
height: 34,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
@@ -647,13 +690,38 @@ class _AppShellState extends State<AppShell> {
|
||||
);
|
||||
}
|
||||
|
||||
/// 图标按钮,可附带 tooltip。
|
||||
Widget _iconBtn(Tokens t, IconData icon, VoidCallback? onTap, {String? tooltip}) {
|
||||
/// 图标按钮,可附带 tooltip 与自定义颜色;尺寸紧凑以节省工具栏宽度。
|
||||
Widget _iconBtn(Tokens t, IconData icon, VoidCallback? onTap, {String? tooltip, Color? color}) {
|
||||
return IconButton(
|
||||
onPressed: onTap,
|
||||
icon: Icon(icon, size: 19, color: onTap == null ? t.dim : t.text),
|
||||
icon: Icon(icon, size: 18, color: onTap == null ? t.dim : (color ?? t.text)),
|
||||
tooltip: tooltip,
|
||||
splashRadius: 18,
|
||||
splashRadius: 16,
|
||||
padding: EdgeInsets.zero,
|
||||
constraints: const BoxConstraints(minWidth: 34, minHeight: 34),
|
||||
);
|
||||
}
|
||||
|
||||
/// 导出菜单按钮:一个图标弹出「导出 SVG / PNG」,节省工具栏宽度。
|
||||
Widget _exportMenuBtn(Tokens t) {
|
||||
return PopupMenuButton<String>(
|
||||
tooltip: '导出 SVG / PNG',
|
||||
color: t.dialog,
|
||||
onSelected: (String v) {
|
||||
if (v == 'svg') {
|
||||
_exportSvg();
|
||||
} else {
|
||||
_exportPng();
|
||||
}
|
||||
},
|
||||
itemBuilder: (BuildContext ctx) => const <PopupMenuEntry<String>>[
|
||||
PopupMenuItem<String>(value: 'svg', child: Text('导出 SVG')),
|
||||
PopupMenuItem<String>(value: 'png', child: Text('导出 PNG')),
|
||||
],
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(7),
|
||||
child: Icon(Icons.download, size: 18, color: t.accent2),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user