LevelThemes class

Maps game levels to themes so colors change as the player levels up.

Each level uses the next palette in palettes, wrapping around after the last one. Themes are built once, so the same level always returns the same TetrisTheme instance.

final levelThemes = LevelThemes(base: darkTetrisTheme);

LevelThemeBuilder(
  game: game,
  levelThemes: levelThemes,
  builder: (context, theme, _) => TetrisBoard(game: game, theme: theme),
);

Constructors

LevelThemes({required TetrisTheme base, List<LevelPalette>? palettes, int levelsPerPalette = 1, bool? recolorBoard})
When recolorBoard is null, board colors are replaced only if base has a dark board, so the built-in dark palettes do not clash with light themes' text styles.

Properties

base → TetrisTheme
Theme the palettes are applied on top of; supplies text styles, border width, radius and any colors a palette leaves out.
final
hashCode → int
The hash code for this object.
no setterinherited
levelsPerPalette → int
How many consecutive levels share a palette.
final
palettes → List<LevelPalette>
Palettes in level order.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

forLevel(int level) → TetrisTheme
Theme for level (1-based).
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