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,26 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'package:minstrel/theme/theme_data.dart';
|
||||
import 'package:minstrel/theme/theme_extension.dart';
|
||||
import 'package:minstrel/theme/tokens.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Theme exposes FabledSwordTheme with expected accent', (tester) async {
|
||||
late FabledSwordTheme captured;
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: buildThemeData(),
|
||||
home: Builder(
|
||||
builder: (ctx) {
|
||||
captured = Theme.of(ctx).extension<FabledSwordTheme>()!;
|
||||
return const SizedBox.shrink();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
expect(captured.accent, FabledSwordTokens.accent);
|
||||
expect(captured.parchment, FabledSwordTokens.parchment);
|
||||
expect(captured.body.fontFamily, FabledSwordTokens.fontBody);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user