fix(android): 工具栏整体缩小 60%,一排放下全部操作;统一称「安卓版」

- 触屏平台(安卓)工具栏缩放 0.6:按钮/图标/字号/间距与工具栏高度同步缩小,
  并收紧默认 48dp 点按区域,修复顶部工具栏一行显示不全的问题
- 关于页 /「保存位置」/ 文件对话框:去掉「平板版」等叫法,统一为「安卓版」
- README / BUILD-NOTES:同步更名
This commit is contained in:
2026-10-08 10:48:38 +08:00
parent e780513630
commit dafb0b4ba8
5 changed files with 106 additions and 78 deletions
+3 -3
View File
@@ -100,9 +100,9 @@ flutter build windows --release
--- ---
## Android 平板版构建(`dev/android-tablet` 分支) ## 安卓版(Android)构建
面向 1280×800dp(2560×1600)平板、无 license 授权的应用商店分发版。 无 license 授权的应用商店分发版,兼容平板 / 手机等各类安卓设备(基准分辨率 1280×800dp)。
### 环境 ### 环境
@@ -152,7 +152,7 @@ flutter build apk --release # 产物:build\app\outputs\flutter-apk\app-
### 平台差异说明 ### 平台差异说明
- **license**:`LicenseService.init()` 在非 Windows 平台直接判定已授权,Android 版无授权限制。 - **license**:`LicenseService.init()` 在非 Windows 平台直接判定已授权,Android 版无授权限制。
- **文件保存(安卓)**:保存工程 / 导出 SVG / PNG 写入公共目录(平板文件管理器可见), - **文件保存(安卓)**:保存工程 / 导出 SVG / PNG 写入公共目录(系统文件管理器可见),
**位置可在应用内修改**(保存/打开对话框里的「更改位置」): **位置可在应用内修改**(保存/打开对话框里的「更改位置」):
- 基础目录可选 **文档 / 下载 / 图片**,子文件夹名可自定义(默认 `SequenceDiagram`); - 基础目录可选 **文档 / 下载 / 图片**,子文件夹名可自定义(默认 `SequenceDiagram`);
- 设置保存在应用私有目录 `save_location.json`,跨会话生效; - 设置保存在应用私有目录 `save_location.json`,跨会话生效;
+2 -2
View File
@@ -87,11 +87,11 @@ node tools/demo-gen.mjs
Flutter 3.29+(Desktop) · CustomPainter 自绘 · Riverpod · 不可变模型 + Command 撤销栈 · 纯 Dart 几何算法 · 自研 SVG 序列化器 · JSON(`.seq.json`)持久化 · 主题 Token 化(深浅双主题) Flutter 3.29+(Desktop) · CustomPainter 自绘 · Riverpod · 不可变模型 + Command 撤销栈 · 纯 Dart 几何算法 · 自研 SVG 序列化器 · JSON(`.seq.json`)持久化 · 主题 Token 化(深浅双主题)
## Android 平板版(`dev/android-tablet` 分支) ## 安卓版(Android)
- **目标分辨率**:1280×800dp(2560×1600 物理),并动态兼容其它横竖屏分辨率; - **目标分辨率**:1280×800dp(2560×1600 物理),并动态兼容其它横竖屏分辨率;
- **无 license 授权**(面向应用商店分发);包名 `cc.sincos.sequence_diagram`,应用名「时序图设计器」; - **无 license 授权**(面向应用商店分发);包名 `cc.sincos.sequence_diagram`,应用名「时序图设计器」;
- **文件保存**:工程 / SVG / PNG 保存到平板可见的公共目录(默认 `Documents/SequenceDiagram`,可在保存对话框「更改位置」中选择文档/下载/图片 + 自定义子文件夹;Android 10+ 走 MediaStore,无需权限); - **文件保存**:工程 / SVG / PNG 保存到系统公共目录(文件管理器可见,默认 `Documents/SequenceDiagram`,可在保存对话框「更改位置」中选择文档/下载/图片 + 自定义子文件夹;Android 10+ 走 MediaStore,无需权限);
- **导出格式**:固定 **1920×1080**,标题恒定左上、图例恒定左下,内容按包围盒自适应缩放居中(SVG / PNG 一致,exe 与安卓一致); - **导出格式**:固定 **1920×1080**,标题恒定左上、图例恒定左下,内容按包围盒自适应缩放居中(SVG / PNG 一致,exe 与安卓一致);
- **触控手势**:**单指点选选中动作,按住整体拖动移动**;选中后两端显示白色把手,抓把手拖动改时长(抓取目标加大);**双指捏合缩放 / 双指平移**(以捏合焦点为锚点);空白单指不平移;全屏无黑边(状态栏/导航栏区域融入界面); - **触控手势**:**单指点选选中动作,按住整体拖动移动**;选中后两端显示白色把手,抓把手拖动改时长(抓取目标加大);**双指捏合缩放 / 双指平移**(以捏合焦点为锚点);空白单指不平移;全屏无黑边(状态栏/导航栏区域融入界面);
- **正式签名**:release 用独立 keystore 签名(`android/key/release.jks`,见 `BUILD-NOTES.md`),更新安装无需卸载重装; - **正式签名**:release 用独立 keystore 签名(`android/key/release.jks`,见 `BUILD-NOTES.md`),更新安装无需卸载重装;
+1 -1
View File
@@ -59,7 +59,7 @@ class LicenseService {
/// 初始化:读取 MAC 并校验 `license/*.lic`。 /// 初始化:读取 MAC 并校验 `license/*.lic`。
/// ///
/// Android 平板版(应用商店分发)不需要授权:非 Windows 平台直接判定为 /// 安卓版(应用商店分发)不需要授权:非 Windows 平台直接判定为
/// 已授权,跳过 MAC 读取与 .lic 校验。 /// 已授权,跳过 MAC 读取与 .lic 校验。
Future<LicenseInfo> init() async { Future<LicenseInfo> init() async {
if (!Platform.isWindows) { if (!Platform.isWindows) {
+91 -63
View File
@@ -74,6 +74,13 @@ class _AppShellState extends State<AppShell> {
return math.min(340.0, math.max(240.0, w * 0.26)); return math.min(340.0, math.max(240.0, w * 0.26));
} }
/// 工具栏整体缩放系数:触屏平台(安卓 / iOS)缩小到 60%,
/// 一排即可放下全部操作且不影响点按;桌面端保持原尺寸。
double get _toolScale => (Platform.isAndroid || Platform.isIOS) ? 0.6 : 1.0;
/// 工具栏字号:随 [_toolScale] 缩放并保底 9,兼顾紧凑与可读。
double _toolFont(double size) => math.max(9.0, size * _toolScale);
/// 左侧栏是否处于停靠(固定)状态。 /// 左侧栏是否处于停靠(固定)状态。
bool get _leftDocked => _leftVisible && _leftPinned; bool get _leftDocked => _leftVisible && _leftPinned;
/// 右侧栏是否处于停靠(固定)状态。 /// 右侧栏是否处于停靠(固定)状态。
@@ -427,11 +434,13 @@ class _AppShellState extends State<AppShell> {
// ===================== 工具栏(自适应 / 紧凑) ===================== // ===================== 工具栏(自适应 / 紧凑) =====================
/// 构建顶部工具栏:左侧为品牌与文件/编辑操作,右侧为导出、缩放、 /// 构建顶部工具栏:左侧为品牌与文件/编辑操作,右侧为导出、缩放、
/// 单位、侧栏开关与主题切换。根据可用宽度在完整布局与紧凑布局间切换。 /// 单位、侧栏开关与主题切换。根据可用宽度在完整布局与紧凑布局间切换;
/// 触屏平台(安卓)整体缩放 [_toolScale],一排放下全部操作。
Widget _toolbar(Tokens t) { Widget _toolbar(Tokens t) {
final double s = _toolScale;
return Container( return Container(
height: 54, height: 54 * s,
padding: const EdgeInsets.symmetric(horizontal: 6), padding: EdgeInsets.symmetric(horizontal: 6 * s),
decoration: BoxDecoration( decoration: BoxDecoration(
color: t.chrome, color: t.chrome,
border: Border(bottom: BorderSide(color: t.line2)), border: Border(bottom: BorderSide(color: t.line2)),
@@ -470,41 +479,45 @@ class _AppShellState extends State<AppShell> {
if (!compact) { if (!compact) {
// 完整布局:文件 / 编辑操作图标化 + 分段视图切换。 // 完整布局:文件 / 编辑操作图标化 + 分段视图切换。
left = <Widget>[ left = <Widget>[
const AppLogo(size: 32), AppLogo(size: 32 * s),
const SizedBox(width: 10), SizedBox(width: 10 * s),
Column( Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Text('时序图设计器', Text('时序图设计器',
style: TextStyle(color: t.text, fontSize: 14, fontWeight: FontWeight.w700, letterSpacing: 1)), style: TextStyle(
Text('Sequence Diagram Studio', style: TextStyle(color: t.dim, fontSize: 10)), color: t.text,
fontSize: _toolFont(14),
fontWeight: FontWeight.w700,
letterSpacing: 1 * s)),
Text('Sequence Diagram Studio', style: TextStyle(color: t.dim, fontSize: _toolFont(10))),
], ],
), ),
const SizedBox(width: 18), SizedBox(width: 18 * s),
_iconBtn(t, Icons.note_add_outlined, _newProject, tooltip: '新建 Ctrl+N'), _iconBtn(t, Icons.note_add_outlined, _newProject, tooltip: '新建 Ctrl+N'),
_iconBtn(t, Icons.folder_open_outlined, _open, tooltip: '打开 Ctrl+O'), _iconBtn(t, Icons.folder_open_outlined, _open, tooltip: '打开 Ctrl+O'),
_iconBtn(t, Icons.save_outlined, _save, tooltip: '保存 Ctrl+S'), _iconBtn(t, Icons.save_outlined, _save, tooltip: '保存 Ctrl+S'),
const SizedBox(width: 6), SizedBox(width: 6 * s),
_iconBtn(t, Icons.undo, c.canUndo ? c.undo : null, tooltip: '撤销 Ctrl+Z'), _iconBtn(t, Icons.undo, c.canUndo ? c.undo : null, tooltip: '撤销 Ctrl+Z'),
_iconBtn(t, Icons.redo, c.canRedo ? c.redo : null, tooltip: '重做 Ctrl+Y'), _iconBtn(t, Icons.redo, c.canRedo ? c.redo : null, tooltip: '重做 Ctrl+Y'),
const SizedBox(width: 6), SizedBox(width: 6 * s),
_aiBtn(t), _aiBtn(t),
const SizedBox(width: 12), SizedBox(width: 12 * s),
_segmented(t), _segmented(t),
]; ];
right = <Widget>[ right = <Widget>[
// 未授权时导出按钮置灰(授权有效才允许导出)。 // 未授权时导出按钮置灰(授权有效才允许导出)。
_primaryBtn(t, '导出 SVG', c.licensed ? _exportSvg : null), _primaryBtn(t, '导出 SVG', c.licensed ? _exportSvg : null),
const SizedBox(width: 6), SizedBox(width: 6 * s),
_ghost(t, '导出 PNG', c.licensed ? _exportPng : null), _ghost(t, '导出 PNG', c.licensed ? _exportPng : null),
const SizedBox(width: 6), SizedBox(width: 6 * s),
_zoomBox(t), _zoomBox(t),
const SizedBox(width: 6), SizedBox(width: 6 * s),
_iconBtn(t, Icons.crop_free, c.fitView, tooltip: '适应视图'), _iconBtn(t, Icons.crop_free, c.fitView, tooltip: '适应视图'),
const SizedBox(width: 8), SizedBox(width: 8 * s),
_unitDropdown(t), _unitDropdown(t),
const SizedBox(width: 8), SizedBox(width: 8 * s),
sideToggleLeft, sideToggleLeft,
sideToggleRight, sideToggleRight,
_iconBtn(t, Icons.help_outline, () => _iconBtn(t, Icons.help_outline, () =>
@@ -514,29 +527,33 @@ class _AppShellState extends State<AppShell> {
} else { } else {
// 紧凑布局:图标化 + 导出合并为菜单,尽量压缩宽度。 // 紧凑布局:图标化 + 导出合并为菜单,尽量压缩宽度。
left = <Widget>[ left = <Widget>[
const AppLogo(size: 28), AppLogo(size: 28 * s),
const SizedBox(width: 8), SizedBox(width: 8 * s),
Text('时序图设计器', Text('时序图设计器',
style: TextStyle(color: t.text, fontSize: 13, fontWeight: FontWeight.w700, letterSpacing: 0.5)), style: TextStyle(
const SizedBox(width: 8), color: t.text,
fontSize: _toolFont(13),
fontWeight: FontWeight.w700,
letterSpacing: 0.5 * s)),
SizedBox(width: 8 * s),
_iconBtn(t, Icons.note_add_outlined, _newProject, tooltip: '新建 Ctrl+N'), _iconBtn(t, Icons.note_add_outlined, _newProject, tooltip: '新建 Ctrl+N'),
_iconBtn(t, Icons.folder_open_outlined, _open, tooltip: '打开 Ctrl+O'), _iconBtn(t, Icons.folder_open_outlined, _open, tooltip: '打开 Ctrl+O'),
_iconBtn(t, Icons.save_outlined, _save, tooltip: '保存 Ctrl+S'), _iconBtn(t, Icons.save_outlined, _save, tooltip: '保存 Ctrl+S'),
const SizedBox(width: 4), SizedBox(width: 4 * s),
_iconBtn(t, Icons.undo, c.canUndo ? c.undo : null, tooltip: '撤销 Ctrl+Z'), _iconBtn(t, Icons.undo, c.canUndo ? c.undo : null, tooltip: '撤销 Ctrl+Z'),
_iconBtn(t, Icons.redo, c.canRedo ? c.redo : null, tooltip: '重做 Ctrl+Y'), _iconBtn(t, Icons.redo, c.canRedo ? c.redo : null, tooltip: '重做 Ctrl+Y'),
const SizedBox(width: 4), SizedBox(width: 4 * s),
// AI 是核心卖点,紧凑布局下也保留「AI 生成」文字,避免认不出。 // AI 是核心卖点,紧凑布局下也保留「AI 生成」文字,避免认不出。
_aiBtn(t), _aiBtn(t),
const SizedBox(width: 8), SizedBox(width: 8 * s),
_segmented(t, compact: true), _segmented(t, compact: true),
]; ];
right = <Widget>[ right = <Widget>[
// 导出保持两个独立按钮;未授权时置灰。 // 导出保持两个独立按钮;未授权时置灰。
_ghost(t, '导出 SVG', c.licensed ? _exportSvg : null), _ghost(t, '导出 SVG', c.licensed ? _exportSvg : null),
const SizedBox(width: 4), SizedBox(width: 4 * s),
_ghost(t, '导出 PNG', c.licensed ? _exportPng : null), _ghost(t, '导出 PNG', c.licensed ? _exportPng : null),
const SizedBox(width: 4), SizedBox(width: 4 * s),
_zoomBox(t), _zoomBox(t),
_iconBtn(t, Icons.crop_free, c.fitView, tooltip: '适应视图'), _iconBtn(t, Icons.crop_free, c.fitView, tooltip: '适应视图'),
_unitDropdown(t), _unitDropdown(t),
@@ -574,8 +591,8 @@ class _AppShellState extends State<AppShell> {
onTap: onTap, onTap: onTap,
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
child: Container( child: Container(
width: compact ? 96 : 140, width: (compact ? 96 : 140) * _toolScale,
height: 34, height: 34 * _toolScale,
alignment: Alignment.center, alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
color: active ? t.accent.withValues(alpha: 0.16) : Colors.transparent, color: active ? t.accent.withValues(alpha: 0.16) : Colors.transparent,
@@ -586,14 +603,14 @@ class _AppShellState extends State<AppShell> {
style: TextStyle( style: TextStyle(
color: active ? t.accent : t.sub, color: active ? t.accent : t.sub,
fontWeight: active ? FontWeight.w600 : FontWeight.normal, fontWeight: active ? FontWeight.w600 : FontWeight.normal,
fontSize: 12, fontSize: _toolFont(12),
)), )),
), ),
); );
} }
return Container( return Container(
padding: const EdgeInsets.all(3), padding: EdgeInsets.all(3 * _toolScale),
decoration: BoxDecoration( decoration: BoxDecoration(
color: t.panel, color: t.panel,
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
@@ -610,9 +627,10 @@ class _AppShellState extends State<AppShell> {
/// 缩放控件:显示当前百分比并提供缩小 / 放大按钮。 /// 缩放控件:显示当前百分比并提供缩小 / 放大按钮。
Widget _zoomBox(Tokens t) { Widget _zoomBox(Tokens t) {
final double s = _toolScale;
return Container( return Container(
height: 34, height: 34 * s,
padding: const EdgeInsets.symmetric(horizontal: 4), padding: EdgeInsets.symmetric(horizontal: 4 * s),
decoration: BoxDecoration( decoration: BoxDecoration(
color: t.panel, color: t.panel,
borderRadius: BorderRadius.circular(9), borderRadius: BorderRadius.circular(9),
@@ -622,9 +640,9 @@ class _AppShellState extends State<AppShell> {
children: <Widget>[ children: <Widget>[
_miniIcon(t, Icons.remove, () => c.zoomBy(0.9)), _miniIcon(t, Icons.remove, () => c.zoomBy(0.9)),
SizedBox( SizedBox(
width: 52, width: 52 * s,
child: Text('${(c.project.viewState.zoom * 100).round()}%', child: Text('${(c.project.viewState.zoom * 100).round()}%',
textAlign: TextAlign.center, style: TextStyle(color: t.text, fontSize: 11)), textAlign: TextAlign.center, style: TextStyle(color: t.text, fontSize: _toolFont(11))),
), ),
_miniIcon(t, Icons.add, () => c.zoomBy(1.1)), _miniIcon(t, Icons.add, () => c.zoomBy(1.1)),
], ],
@@ -638,17 +656,18 @@ class _AppShellState extends State<AppShell> {
onTap: onTap, onTap: onTap,
borderRadius: BorderRadius.circular(6), borderRadius: BorderRadius.circular(6),
child: Padding( child: Padding(
padding: const EdgeInsets.all(6), padding: EdgeInsets.all(6 * _toolScale),
child: Icon(icon, size: 15, color: t.sub), child: Icon(icon, size: 15 * _toolScale, color: t.sub),
), ),
); );
} }
/// 时间单位下拉框:切换 ms / s / min。 /// 时间单位下拉框:切换 ms / s / min。
Widget _unitDropdown(Tokens t) { Widget _unitDropdown(Tokens t) {
final double s = _toolScale;
return Container( return Container(
height: 34, height: 34 * s,
padding: const EdgeInsets.symmetric(horizontal: 10), padding: EdgeInsets.symmetric(horizontal: 10 * s),
decoration: BoxDecoration( decoration: BoxDecoration(
color: t.panel, color: t.panel,
borderRadius: BorderRadius.circular(9), borderRadius: BorderRadius.circular(9),
@@ -659,8 +678,8 @@ class _AppShellState extends State<AppShell> {
underline: const SizedBox.shrink(), underline: const SizedBox.shrink(),
dropdownColor: t.dialog, dropdownColor: t.dialog,
borderRadius: BorderRadius.circular(9), borderRadius: BorderRadius.circular(9),
style: TextStyle(color: t.accent, fontSize: 11, fontWeight: FontWeight.w600), style: TextStyle(color: t.accent, fontSize: _toolFont(11), fontWeight: FontWeight.w600),
icon: Icon(Icons.keyboard_arrow_down, color: t.accent, size: 18), icon: Icon(Icons.keyboard_arrow_down, color: t.accent, size: 18 * s),
items: TimeUnit.values items: TimeUnit.values
.map((TimeUnit u) => DropdownMenuItem<TimeUnit>(value: u, child: Text(timeUnitLabel(u)))) .map((TimeUnit u) => DropdownMenuItem<TimeUnit>(value: u, child: Text(timeUnitLabel(u))))
.toList(), .toList(),
@@ -679,21 +698,21 @@ class _AppShellState extends State<AppShell> {
onTap: onTap, onTap: onTap,
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
child: Container( child: Container(
width: 32, width: 32 * _toolScale,
height: 26, height: 26 * _toolScale,
alignment: Alignment.center, alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
color: active ? t.accent.withValues(alpha: 0.18) : Colors.transparent, color: active ? t.accent.withValues(alpha: 0.18) : Colors.transparent,
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
border: active ? Border.all(color: t.accent, width: 1.2) : null, border: active ? Border.all(color: t.accent, width: 1.2) : null,
), ),
child: Icon(icon, size: 16, color: active ? t.accent : t.dim), child: Icon(icon, size: 16 * _toolScale, color: active ? t.accent : t.dim),
), ),
); );
} }
return Container( return Container(
padding: const EdgeInsets.all(4), padding: EdgeInsets.all(4 * _toolScale),
decoration: BoxDecoration( decoration: BoxDecoration(
color: t.panel, color: t.panel,
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
@@ -715,73 +734,82 @@ class _AppShellState extends State<AppShell> {
); );
} }
/// 次要(幽灵)样式按钮;[onTap] 为 null 时呈禁用态。 /// 次要(幽灵)样式按钮;[onTap] 为 null 时呈禁用态;尺寸随 [_toolScale] 缩放。
Widget _ghost(Tokens t, String label, VoidCallback? onTap, {IconData? icon}) { Widget _ghost(Tokens t, String label, VoidCallback? onTap, {IconData? icon}) {
final double s = _toolScale;
return Padding( return Padding(
padding: const EdgeInsets.symmetric(horizontal: 3), padding: EdgeInsets.symmetric(horizontal: 3 * s),
child: TextButton.icon( child: TextButton.icon(
onPressed: onTap, onPressed: onTap,
icon: icon == null ? null : Icon(icon, size: 16, color: onTap == null ? t.dim : t.text), icon: icon == null ? null : Icon(icon, size: 16 * s, color: onTap == null ? t.dim : t.text),
label: Text(label, style: TextStyle(fontSize: 11, color: onTap == null ? t.dim : t.text)), label: Text(label, style: TextStyle(fontSize: _toolFont(11), color: onTap == null ? t.dim : t.text)),
style: TextButton.styleFrom( style: TextButton.styleFrom(
backgroundColor: t.panel, backgroundColor: t.panel,
side: BorderSide(color: t.line2), side: BorderSide(color: t.line2),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(9)), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(9)),
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10), padding: EdgeInsets.symmetric(horizontal: 12 * s, vertical: 10 * s),
minimumSize: const Size(0, 34), minimumSize: Size(0, 34 * s),
tapTargetSize: s < 1 ? MaterialTapTargetSize.shrinkWrap : null,
), ),
), ),
); );
} }
/// 主色填充按钮(用于导出等主要动作);[onTap] 为 null 时禁用(置灰)。 /// 主色填充按钮(用于导出等主要动作);[onTap] 为 null 时禁用(置灰);
/// 尺寸随 [_toolScale] 缩放。
Widget _primaryBtn(Tokens t, String label, VoidCallback? onTap) { Widget _primaryBtn(Tokens t, String label, VoidCallback? onTap) {
final bool enabled = onTap != null; final bool enabled = onTap != null;
final double s = _toolScale;
return FilledButton( return FilledButton(
onPressed: onTap, onPressed: onTap,
style: FilledButton.styleFrom( style: FilledButton.styleFrom(
backgroundColor: enabled ? t.accent2 : t.panel2, backgroundColor: enabled ? t.accent2 : t.panel2,
foregroundColor: enabled ? Colors.white : t.dim, foregroundColor: enabled ? Colors.white : t.dim,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(9)), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(9)),
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10), padding: EdgeInsets.symmetric(horizontal: 16 * s, vertical: 10 * s),
minimumSize: const Size(0, 34), minimumSize: Size(0, 34 * s),
tapTargetSize: s < 1 ? MaterialTapTargetSize.shrinkWrap : null,
), ),
child: Text(label, style: const TextStyle(fontSize: 11, fontWeight: FontWeight.w600)), child: Text(label, style: TextStyle(fontSize: _toolFont(11), fontWeight: FontWeight.w600)),
); );
} }
/// AI 生成按钮:打开「自然语言 → 时序图」对话框。 /// AI 生成按钮:打开「自然语言 → 时序图」对话框;尺寸随 [_toolScale] 缩放。
Widget _aiBtn(Tokens t) { Widget _aiBtn(Tokens t) {
final double s = _toolScale;
return Padding( return Padding(
padding: const EdgeInsets.symmetric(horizontal: 3), padding: EdgeInsets.symmetric(horizontal: 3 * s),
child: FilledButton.icon( child: FilledButton.icon(
onPressed: () => showDialog<void>( onPressed: () => showDialog<void>(
context: context, context: context,
builder: (_) => AiGenerateDialog(controller: c), builder: (_) => AiGenerateDialog(controller: c),
), ),
icon: const Icon(Icons.auto_awesome, size: 16), icon: Icon(Icons.auto_awesome, size: 16 * s),
label: const Text('AI 生成', style: TextStyle(fontSize: 12, fontWeight: FontWeight.w700)), label: Text('AI 生成', style: TextStyle(fontSize: _toolFont(12), fontWeight: FontWeight.w700)),
style: FilledButton.styleFrom( style: FilledButton.styleFrom(
backgroundColor: t.accent2, backgroundColor: t.accent2,
foregroundColor: Colors.white, foregroundColor: Colors.white,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(9)), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(9)),
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 8), padding: EdgeInsets.symmetric(horizontal: 10 * s, vertical: 8 * s),
minimumSize: const Size(0, 34), minimumSize: Size(0, 34 * s),
tapTargetSize: MaterialTapTargetSize.shrinkWrap, tapTargetSize: MaterialTapTargetSize.shrinkWrap,
), ),
), ),
); );
} }
/// 图标按钮,可附带 tooltip 与自定义颜色;尺寸紧凑以节省工具栏宽度。 /// 图标按钮,可附带 tooltip 与自定义颜色;尺寸随 [_toolScale] 缩放,
/// 触屏平台收紧点按区域,避免默认 48dp 目标把工具栏撑满。
Widget _iconBtn(Tokens t, IconData icon, VoidCallback? onTap, {String? tooltip, Color? color}) { Widget _iconBtn(Tokens t, IconData icon, VoidCallback? onTap, {String? tooltip, Color? color}) {
final double s = _toolScale;
return IconButton( return IconButton(
onPressed: onTap, onPressed: onTap,
icon: Icon(icon, size: 18, color: onTap == null ? t.dim : (color ?? t.text)), icon: Icon(icon, size: 18 * s, color: onTap == null ? t.dim : (color ?? t.text)),
tooltip: tooltip, tooltip: tooltip,
splashRadius: 16, splashRadius: 16 * s,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
constraints: const BoxConstraints(minWidth: 34, minHeight: 34), constraints: BoxConstraints(minWidth: 34 * s, minHeight: 34 * s),
tapTargetSize: s < 1 ? MaterialTapTargetSize.shrinkWrap : null,
); );
} }
+9 -9
View File
@@ -493,7 +493,7 @@ class _SaveLocationDialogState extends State<SaveLocationDialog> {
), ),
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
Text('保存、导出、打开都使用该目录;位于平板「文件管理」可见的公共存储。', Text('保存、导出、打开都使用该目录;文件位于「文件管理」可见的公共目录。',
style: TextStyle(color: t.dim, fontSize: 11, height: 1.5)), style: TextStyle(color: t.dim, fontSize: 11, height: 1.5)),
], ],
), ),
@@ -605,7 +605,7 @@ class _AndroidFileDialogState extends State<AndroidFileDialog> {
Icon(Icons.folder_outlined, size: 15, color: t.accent), Icon(Icons.folder_outlined, size: 15, color: t.accent),
const SizedBox(width: 6), const SizedBox(width: 6),
Expanded( Expanded(
child: Text('平板存储 / ${AndroidDocs.location()} /', child: Text('保存位置 / ${AndroidDocs.location()} /',
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle(color: t.dim, fontSize: 11)), style: TextStyle(color: t.dim, fontSize: 11)),
@@ -2087,7 +2087,7 @@ class HelpDialog extends StatelessWidget {
} }
/// 「关于」页:软件信息 + 平台 / 授权状态 + 官网入口; /// 「关于」页:软件信息 + 平台 / 授权状态 + 官网入口;
/// 桌面版追加授权指南(MAC 申请 .lic),平板版展示免授权与保存位置说明。 /// Windows 版追加授权指南(MAC 申请 .lic),安卓版展示免授权与保存位置说明。
Widget _about(BuildContext context, Tokens t) { Widget _about(BuildContext context, Tokens t) {
final bool android = AndroidDocs.isAvailable; final bool android = AndroidDocs.isAvailable;
final LicenseInfo info = LicenseService.instance.info; final LicenseInfo info = LicenseService.instance.info;
@@ -2124,7 +2124,7 @@ class HelpDialog extends StatelessWidget {
Text('时序图设计器 · Sequence Diagram Studio', Text('时序图设计器 · Sequence Diagram Studio',
style: TextStyle(color: t.text, fontSize: 15, fontWeight: FontWeight.w700)), style: TextStyle(color: t.text, fontSize: 15, fontWeight: FontWeight.w700)),
const SizedBox(height: 4), const SizedBox(height: 4),
Text('V1.0.2(${android ? 'Android 平板版' : 'Windows 桌面版'})', Text('V1.0.2(${android ? '安卓版' : 'Windows 版'})',
style: TextStyle(color: t.dim, fontSize: 12)), style: TextStyle(color: t.dim, fontSize: 12)),
], ],
), ),
@@ -2135,7 +2135,7 @@ class HelpDialog extends StatelessWidget {
row('设计人', '呆头鹅'), row('设计人', '呆头鹅'),
row( row(
'授权状态', '授权状态',
android ? '已授权(平板版免授权)' : lic, android ? '已授权(安卓版免授权)' : lic,
vc: (android || info.valid) ? t.ok : t.danger, vc: (android || info.valid) ? t.ok : t.danger,
), ),
if (!android) if (!android)
@@ -2193,7 +2193,7 @@ class HelpDialog extends StatelessWidget {
), ),
) )
else else
// 平板版说明:免授权 + 保存位置 + 反馈方式。 // 安卓版说明:免授权 + 保存位置 + 反馈方式。
Container( Container(
padding: const EdgeInsets.all(12), padding: const EdgeInsets.all(12),
decoration: BoxDecoration( decoration: BoxDecoration(
@@ -2206,14 +2206,14 @@ class HelpDialog extends StatelessWidget {
children: <Widget>[ children: <Widget>[
Row( Row(
children: <Widget>[ children: <Widget>[
Icon(Icons.tablet_android, size: 16, color: t.accent), Icon(Icons.android, size: 16, color: t.accent),
const SizedBox(width: 6), const SizedBox(width: 6),
Text('平板版说明', style: TextStyle(color: t.accent, fontSize: 12.5, fontWeight: FontWeight.w600)), Text('安卓版说明', style: TextStyle(color: t.accent, fontSize: 12.5, fontWeight: FontWeight.w600)),
], ],
), ),
const SizedBox(height: 8), const SizedBox(height: 8),
guideLine('本版面向应用商店分发,无需授权,全部功能可用。'), guideLine('本版面向应用商店分发,无需授权,全部功能可用。'),
guideLine('保存 / 导出文件位于平板「文件管理」可见的公共目录(默认 Documents/SequenceDiagram,' guideLine('保存 / 导出文件位于「文件管理」可见的公共目录(默认 Documents/SequenceDiagram,'
'可在保存对话框中更改位置)。'), '可在保存对话框中更改位置)。'),
guideLine('帮助与反馈:官网 sincos.cc 或邮箱 liuyu65@126.com。'), guideLine('帮助与反馈:官网 sincos.cc 或邮箱 liuyu65@126.com。'),
], ],