resolve static method
CalcThemeData
resolve(
- ThemeSpec spec, {
- bool highContrast = false,
- GlassRendering glass = GlassRendering.standard,
The CalcThemeData for spec. highContrast (platform setting)
selects the plain theme's high-contrast variants; generated themes
get their high-contrast treatment from the accessible lock instead.
glass (glass mode and effects tier from MotionPreferences) is
passed to the families in renderedKeyFaceRegistry: Liquid Glass's
Reduce Transparency solid tint, frosted or full glass, and the other
families' lite-tier artwork.
Implementation
static CalcThemeData resolve(
ThemeSpec spec, {
bool highContrast = false,
GlassRendering glass = GlassRendering.standard,
}) {
// Only Liquid Glass is translucent, so only it reads the glass mode;
// the other rendered families read the effects tier alone (one memo
// entry whatever Reduce Transparency says).
final rendering = switch (spec.family) {
ThemeFamily.liquidGlass => glass,
final f when renderedKeyFaceRegistry.containsKey(f) => GlassRendering(
tier: glass.tier,
),
_ => GlassRendering.standard,
};
final key = (spec, highContrast, rendering);
final hit = _memo.remove(key);
if (hit != null) return _memo[key] = hit;
final data = _memo[key] = _resolve(
spec,
highContrast: highContrast,
glass: rendering,
);
while (_memo.length > memoCapacity) {
_memo.remove(_memo.keys.first);
}
return data;
}