plainThemeSpec function
The M2 plain theme as a ThemeSpec (family plain, id 0). Resolving
it returns exactly PlainTheme.of(brightness).
Implementation
ThemeSpec plainThemeSpec(Brightness brightness) {
final dark = brightness == Brightness.dark;
final t = PlainTheme.of(brightness);
int c(Color color) => color.toARGB32();
KeyColors k(KeyStyle s) => KeyColors(
face: c(s.fill),
label: c(s.label),
edge: c(s.outline ?? s.fill),
);
return ThemeSpec(
seed: 0,
family: ThemeFamily.plain,
engineVersion: 1,
variant: ThemeVariant.hero,
brightness: dark ? ThemeBrightness.dark : ThemeBrightness.light,
palette: Palette(
background: c(t.background),
surface: c(t.background),
displayText: c(t.displayText),
previewText: c(t.previewText),
error: c(t.errorText),
caret: c(t.caret),
focusRing: c(t.focusRing),
accent: c(t.equalsKey.fill),
digit: k(t.digitKey),
operator: k(t.operatorKey),
equals: k(t.equalsKey),
function: k(t.functionKey),
shadow: 0x00000000,
highlight: 0x00000000,
seedColor: c(t.equalsKey.fill),
),
keyShape: const KeyShapeSpec(kind: KeyShapeKind.roundedRect),
keyStyle: const KeyStyleSpec(
kind: KeyStyleKind.flat,
stateLayerPermille: 120,
),
type: const TypeSpec(
displayFont: FontIds.platform,
keyFont: FontIds.platform,
keyWeight: 400,
operatorWeight: 600,
),
background: BackgroundSpec(
kind: BackgroundKind.solid,
colors: List.unmodifiable([c(t.background)]),
),
motion: const MotionSpec(
verb: PressVerb.morph,
scheme: MotionScheme.standard,
pressIn: SpringTokens.effectsFast,
release: SpringTokens.effectsDefault,
scalePermille: 950,
entry: EntryStyle.pop,
impact: ImpactStyle.light,
),
sound: SoundPackId.softTap,
name: 'Plain',
nonColourOperatorCue: OperatorCue.weight,
);
}