feat(flutter): FabledSwordTheme ThemeExtension + Material 3 ThemeData
Widgets read tokens via Theme.of(ctx).extension<FabledSwordTheme>(). Material 3 ColorScheme bound to FabledSword tokens. Body text uses GoogleFonts.interTextTheme() so the fonts work without bundling .ttf files (offline-from-cold-launch is a separate question once #357 lands).
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
import 'theme_extension.dart';
|
||||
import 'tokens.dart';
|
||||
|
||||
ThemeData buildThemeData() {
|
||||
final fs = FabledSwordTheme.fromTokens();
|
||||
final colorScheme = ColorScheme.dark(
|
||||
surface: fs.iron,
|
||||
onSurface: fs.parchment,
|
||||
primary: fs.accent,
|
||||
onPrimary: fs.parchment,
|
||||
secondary: fs.moss,
|
||||
error: fs.error,
|
||||
);
|
||||
|
||||
return ThemeData(
|
||||
useMaterial3: true,
|
||||
colorScheme: colorScheme,
|
||||
scaffoldBackgroundColor: fs.obsidian,
|
||||
textTheme: GoogleFonts.interTextTheme().apply(
|
||||
bodyColor: fs.parchment,
|
||||
displayColor: fs.parchment,
|
||||
),
|
||||
fontFamily: FabledSwordTokens.fontBody,
|
||||
extensions: <ThemeExtension<dynamic>>[fs],
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user