feat(client): 三套 ThemeData 构建(挂 AppTokens,B 为 dark)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-06-24 21:40:51 +08:00
parent c5818b4e51
commit b69b3acaaf
2 changed files with 42 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
import 'package:flutter/material.dart';
import 'app_tokens.dart';
import 'app_tokens.g.dart';
ThemeData buildTheme(String key) {
final t = appTokensOf(key);
final brightness = t.isDark ? Brightness.dark : Brightness.light;
final scheme = ColorScheme.fromSeed(
seedColor: t.primary,
brightness: brightness,
).copyWith(
primary: t.primary,
onPrimary: t.onPrimary,
surface: t.surface,
error: t.danger,
);
return ThemeData(
useMaterial3: true,
brightness: brightness,
colorScheme: scheme,
scaffoldBackgroundColor: t.bg,
fontFamily: null, // 系统中文字体;字号梯度后续在组件层接入
extensions: <ThemeExtension<dynamic>>[t],
);
}