feat(android): 平板版适配(1280×800dp,免授权,应用商店分发)

- flutter create 增加 android 平台:包名 cc.sincos.sequence_diagram,应用名「时序图设计器」,minSdk 24 / targetSdk 36

- 多分辨率动态兼容:触屏侧栏默认贴边把手(点把手直接停靠),面板宽度随屏宽压缩,窄屏双侧栏停靠不溢出

- 免授权:LicenseService 非 Windows 平台直接判定已授权

- 移动端存储/文件浏览器适配(无 APPDATA/盘符/桌面);edge-to-edge + SafeArea + 文本缩放固定 1.0

- launcher 图标沿用「环序」标志(tools/gen-android-icons.py);Gradle 腾讯镜像 + Maven 阿里镜像

- 自测:7 种分辨率无溢出回归(test/tablet_layout_test.dart)+ 平板截图(demo/tablet-*.png)

- 产物:release/sequence_diagram_tablet_v1.0.1_release.apk(universal,50.3MB)
This commit is contained in:
admin
2026-10-06 21:04:38 +08:00
parent f5412ee99d
commit fad82a30d8
37 changed files with 772 additions and 42 deletions
+80 -25
View File
@@ -64,6 +64,18 @@ class _AppShellState extends State<AppShell> {
AppController get c => widget.controller;
// ---- 由上述三态派生的侧栏呈现方式 ----
/// 左侧栏宽度:随屏幕宽度动态压缩(300 → 200),窄屏双侧栏停靠也不溢出。
double get _leftPanelWidth {
final double w = MediaQuery.sizeOf(context).width;
return math.min(300.0, math.max(200.0, w * 0.24));
}
/// 右侧栏宽度:随屏幕宽度动态压缩(340 → 240),窄屏双侧栏停靠也不溢出。
double get _rightPanelWidth {
final double w = MediaQuery.sizeOf(context).width;
return math.min(340.0, math.max(240.0, w * 0.26));
}
/// 左侧栏是否处于停靠(固定)状态。
bool get _leftDocked => _leftVisible && _leftPinned;
/// 右侧栏是否处于停靠(固定)状态。
@@ -84,6 +96,27 @@ class _AppShellState extends State<AppShell> {
c.addListener(_onChange);
}
/// 是否已完成一次按平台 / 屏幕宽度的默认布局初始化。
bool _layoutInited = false;
/// 首次构建时按平台与屏幕宽度设定侧栏默认状态(动态兼容不同分辨率):
/// - 触屏平台(Android / iOS):默认收起为贴边轨道,给画布让出完整宽度;
/// - 桌面窄窗口(< 1500 逻辑宽):同样默认收起,避免两侧栏挤占画布。
@override
void didChangeDependencies() {
super.didChangeDependencies();
if (_layoutInited) return;
_layoutInited = true;
final bool touch = Platform.isAndroid || Platform.isIOS;
final double w = MediaQuery.of(context).size.width;
if (touch || w < 1500) {
_leftVisible = false;
_rightVisible = false;
_leftPinned = false;
_rightPinned = false;
}
}
/// 取消订阅并释放资源。
@override
void dispose() {
@@ -733,10 +766,19 @@ class _AppShellState extends State<AppShell> {
onTap: () => setState(() {
if (left) {
_leftVisible = true;
if (!_leftPinned) _leftHover = true;
if (Platform.isAndroid || Platform.isIOS) {
// 触屏平台:点把手直接停靠展开(无悬停概念)。
_leftPinned = true;
} else if (!_leftPinned) {
_leftHover = true;
}
} else {
_rightVisible = true;
if (!_rightPinned) _rightHover = true;
if (Platform.isAndroid || Platform.isIOS) {
_rightPinned = true;
} else if (!_rightPinned) {
_rightHover = true;
}
}
}),
child: Container(
@@ -784,7 +826,7 @@ class _AppShellState extends State<AppShell> {
Widget _leftPanel(Tokens t, {bool floating = false}) {
final bool bar = c.project.viewState.mode == ViewMode.bar;
return Container(
width: 300,
width: _leftPanelWidth,
decoration: BoxDecoration(
color: t.panel,
border: floating ? Border.all(color: t.line2) : Border(right: BorderSide(color: t.line)),
@@ -1073,15 +1115,22 @@ class _AppShellState extends State<AppShell> {
),
),
const SizedBox(width: 6),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
Text(
bar ? '${a0.toStringAsFixed(0)}° – ${math.min(a1, 360).toStringAsFixed(0)}°' : 'L${li + 1}',
style: TextStyle(color: t.sub, fontSize: 11),
),
Text('${acts.length} 个动作', style: TextStyle(color: t.dim, fontSize: 10)),
],
Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
Text(
bar ? '${a0.toStringAsFixed(0)}° – ${math.min(a1, 360).toStringAsFixed(0)}°' : 'L${li + 1}',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(color: t.sub, fontSize: 11),
),
Text('${acts.length} 个动作',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(color: t.dim, fontSize: 10)),
],
),
),
const SizedBox(width: 6),
InkWell(
@@ -1156,18 +1205,24 @@ class _AppShellState extends State<AppShell> {
),
),
const SizedBox(width: 6),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
Text(
bar
? '${a.startAngle.toStringAsFixed(0)}° – ${math.min(a.endAngle, 360).toStringAsFixed(0)}°'
: 'L${a.layer + 1}',
style: TextStyle(color: t.sub, fontSize: 10),
),
Text(tfmt(a.durationAngle / 360 * c.project.cycle.durationMs, c.project.units),
style: TextStyle(color: t.dim, fontSize: 10)),
],
Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
Text(
bar
? '${a.startAngle.toStringAsFixed(0)}° – ${math.min(a.endAngle, 360).toStringAsFixed(0)}°'
: 'L${a.layer + 1}',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(color: t.sub, fontSize: 10),
),
Text(tfmt(a.durationAngle / 360 * c.project.cycle.durationMs, c.project.units),
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(color: t.dim, fontSize: 10)),
],
),
),
const SizedBox(width: 6),
InkWell(
@@ -1331,7 +1386,7 @@ class _AppShellState extends State<AppShell> {
final Action? a = c.selected;
final bool bar = c.project.viewState.mode == ViewMode.bar;
return Container(
width: 340,
width: _rightPanelWidth,
decoration: BoxDecoration(
color: t.panel,
border: floating ? Border.all(color: t.line2) : Border(left: BorderSide(color: t.line)),