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:
@@ -0,0 +1,67 @@
|
||||
// 平板版演示截图生成:把整个应用外壳在 1280×800(平板横屏基准)下渲染为 PNG。
|
||||
// 运行方式:flutter test --update-goldens test\tablet_screenshots_test.dart
|
||||
// 输出:demo/tablet-*.png
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:sequence_diagram/model/models.dart';
|
||||
import 'package:sequence_diagram/state/app_controller.dart';
|
||||
import 'package:sequence_diagram/theme/tokens.dart';
|
||||
import 'package:sequence_diagram/ui/app_shell.dart';
|
||||
|
||||
import 'helpers.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('generate tablet demo screenshots', (WidgetTester tester) async {
|
||||
await tester.runAsync(() => loadZhFonts());
|
||||
|
||||
tester.view.physicalSize = const Size(1280, 800);
|
||||
tester.view.devicePixelRatio = 1.0;
|
||||
addTearDown(tester.view.reset);
|
||||
|
||||
final AppController c = AppController(project: demoTiming());
|
||||
addTearDown(c.dispose);
|
||||
|
||||
Widget shell(Tokens t) => RepaintBoundary(
|
||||
key: const ValueKey<String>('shot'),
|
||||
child: MaterialApp(
|
||||
theme: buildTheme(t),
|
||||
home: AppShell(controller: c),
|
||||
),
|
||||
);
|
||||
|
||||
Future<void> shot(String path) async {
|
||||
await tester.pump();
|
||||
await expectLater(find.byKey(const ValueKey<String>('shot')), matchesGoldenFile(path));
|
||||
}
|
||||
|
||||
await tester.pumpWidget(shell(Tokens.light));
|
||||
await shot('../demo/tablet-bar-light.png');
|
||||
|
||||
// 展开左右侧栏(浮层)并钉住,展示停靠布局。
|
||||
await tester.tap(find.byIcon(Icons.chevron_right).first);
|
||||
await tester.pump();
|
||||
if (tester.any(find.byIcon(Icons.push_pin_outlined))) {
|
||||
await tester.tap(find.byIcon(Icons.push_pin_outlined).first);
|
||||
await tester.pump();
|
||||
}
|
||||
await tester.tap(find.byIcon(Icons.chevron_left).first);
|
||||
await tester.pump();
|
||||
if (tester.any(find.byIcon(Icons.push_pin_outlined))) {
|
||||
await tester.tap(find.byIcon(Icons.push_pin_outlined).first);
|
||||
await tester.pump();
|
||||
}
|
||||
await shot('../demo/tablet-bar-light-panels.png');
|
||||
|
||||
// 圆周视图(浅色,含停靠侧栏)。
|
||||
c.setViewMode(ViewMode.circular);
|
||||
await shot('../demo/tablet-circular-light.png');
|
||||
|
||||
// 深色主题:条形与圆周。
|
||||
c.toggleTheme();
|
||||
await tester.pumpWidget(shell(Tokens.dark));
|
||||
c.setViewMode(ViewMode.bar);
|
||||
await shot('../demo/tablet-bar-dark.png');
|
||||
c.setViewMode(ViewMode.circular);
|
||||
await shot('../demo/tablet-circular-dark.png');
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user