Files
minstrel/flutter_client/lib/theme/theme_extension.dart
T
bvandeusen 1e8b8aaa2d fix(flutter): drop redundant const in nested const contexts
Making the outer FabledSwordTheme(...) and HomeData(...) constructors
const made every inner const redundant — Dart's analyzer fires
unnecessary_const for each. Strip the inner consts so the outer
context owns the const inference.
2026-05-02 19:17:05 -04:00

69 lines
2.1 KiB
Dart

import 'package:flutter/material.dart';
import 'tokens.dart';
class FabledSwordTheme extends ThemeExtension<FabledSwordTheme> {
const FabledSwordTheme({
required this.accent,
required this.obsidian,
required this.iron,
required this.slate,
required this.pewter,
required this.parchment,
required this.vellum,
required this.ash,
required this.moss,
required this.bronze,
required this.oxblood,
required this.warning,
required this.error,
required this.info,
required this.display,
required this.body,
required this.mono,
});
final Color accent;
final Color obsidian, iron, slate, pewter;
final Color parchment, vellum, ash;
final Color moss, bronze, oxblood;
final Color warning, error, info;
final TextStyle display, body, mono;
static FabledSwordTheme fromTokens() => const FabledSwordTheme(
accent: FabledSwordTokens.accent,
obsidian: FabledSwordTokens.obsidian,
iron: FabledSwordTokens.iron,
slate: FabledSwordTokens.slate,
pewter: FabledSwordTokens.pewter,
parchment: FabledSwordTokens.parchment,
vellum: FabledSwordTokens.vellum,
ash: FabledSwordTokens.ash,
moss: FabledSwordTokens.moss,
bronze: FabledSwordTokens.bronze,
oxblood: FabledSwordTokens.oxblood,
warning: FabledSwordTokens.warning,
error: FabledSwordTokens.error,
info: FabledSwordTokens.info,
display: TextStyle(fontFamily: FabledSwordTokens.fontDisplay),
body: TextStyle(fontFamily: FabledSwordTokens.fontBody),
mono: TextStyle(fontFamily: FabledSwordTokens.fontMono),
);
@override
FabledSwordTheme copyWith({
Color? accent,
}) =>
FabledSwordTheme(
accent: accent ?? this.accent,
obsidian: obsidian, iron: iron, slate: slate, pewter: pewter,
parchment: parchment, vellum: vellum, ash: ash,
moss: moss, bronze: bronze, oxblood: oxblood,
warning: warning, error: error, info: info,
display: display, body: body, mono: mono,
);
@override
FabledSwordTheme lerp(ThemeExtension<FabledSwordTheme>? other, double t) => this;
}