ThemeGenerator class

Orchestrates the "generate the opposite of what the dev gave us" flow.

The contract: the dev provides ONE ThemeData. We inspect its brightness. When the OS asks for the opposite, we fetch an AI palette tuned for that opposite brightness. When the OS matches the base, we do nothing — no wasted network call, no forced dark.

Constructors

ThemeGenerator(ThemeAdapter adapter)

Properties

adapter ThemeAdapter
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

generateOpposite(ThemeData base, Brightness systemBrightness, {bool highContrast = false, String? colorBlindMode}) Future<GeneratedTheme?>
Fetch an AI palette targeting the opposite of base. Returns null when:
generateOppositeFromRaw(MorphRawColors raw, Brightness systemBrightness, {bool highContrast = false, String? colorBlindMode}) Future<GeneratedTheme?>
Opposite-generation path that uses the richer MorphRawColors payload (from ColorExtractor) — this is the preferred path when the dev declared MorphColors, because the backend gets more signal (success, warning, outline, textSecondary, …) than just a ThemeData.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

brightnessOf(ThemeData theme) Brightness
Brightness encoded in the theme's colorScheme — the canonical source, ahead of the phasing-out top-level ThemeData.brightness.
needsOpposite(ThemeData base, Brightness systemBrightness) bool
True iff systemBrightness differs from the base's own brightness. False means the dev's theme already matches the OS — skip generation.
opposite(Brightness b) Brightness