fix(export): 纯白背景 + 2x 像素比渲染(3840×2160),导出更清晰

- 导出专用令牌 exportTokens:无论屏幕主题深浅,SVG/PNG 背景均为纯白、文字深色(印刷/工艺卡导向)

- PNG 按 2 倍像素比渲染:1920×1080 逻辑画布 → 3840×2160 像素,矢量内容在高分屏上锐利

- SVG 背景 rect 同步纯白;export_test 校验尺寸 3840×2160 与左上角纯白像素

- 重建 dist 与签名 APK
This commit is contained in:
admin
2026-10-07 09:44:33 +08:00
parent c1d9f27952
commit 2b04705ba8
4 changed files with 91 additions and 17 deletions
+54 -1
View File
@@ -16,10 +16,14 @@ import '../layout/layout.dart';
import '../model/models.dart';
import '../model/units.dart';
import '../render/bar_painter.dart';
import '../theme/tokens.dart';
/// 导出画布尺寸(固定)。
/// 导出画布尺寸(固定,逻辑单位)。
const Size kExportSize = Size(1920, 1080);
/// 导出渲染像素比:按 2 倍像素渲染(3840×2160),保证高分辨率屏幕下清晰锐利。
const double kExportPixelRatio = 2.0;
/// 内容区(标题下方、图例上方)。
const Rect kExportContentArea = Rect.fromLTRB(48, 128, 1872, 1016);
@@ -79,3 +83,52 @@ String exportSubtitle(Project project, ViewMode mode) {
/// 导出图例(左下角固定)。
String exportLegend(Project project) =>
'时序图设计器 · ${project.name} · 循环 ${tfmt(project.cycle.durationMs, project.units)} = 360°';
/// 导出专用令牌:始终使用浅色、**纯白背景**(印刷 / 工艺卡导向),
/// 文字、语义色与屏幕浅色主题保持一致。
///
/// 无论当前屏幕主题是深是浅,导出的 PNG / SVG 背景都是纯白、文字深色,
/// 避免「导出背景不是纯白」的问题。
Tokens exportTokens(Tokens base) {
return Tokens(
brightness: Brightness.light,
bg: Colors.white,
canvas1: Colors.white,
canvas2: Colors.white,
chrome: base.chrome,
panel: Colors.white,
panel2: Colors.white,
dialog: Colors.white,
line: base.line,
line2: base.line2,
text: base.text,
text2: base.text2,
sub: base.sub,
dim: base.dim,
accent: base.accent,
accent2: base.accent2,
ok: base.ok,
warn: base.warn,
danger: base.danger,
fs: base.fs,
ss: base.ss,
crit: base.crit,
chip: Colors.white,
dial: Colors.white,
arcText: base.arcText,
onAccent: base.onAccent,
ringA: base.ringA,
ringB: base.ringB,
ringEdge: base.ringEdge,
ringLabel: base.ringLabel,
info: Colors.white,
track: base.track,
sel: base.sel,
grid: base.grid,
shadow: base.shadow,
shadowOp: 0.10,
selOutline: base.selOutline,
overlay: base.overlay,
tailOp: base.tailOp,
);
}