ThemeModifier class final

A content modifier that applies theme data to a content subtree.

Features:

  • Theme mode specification
  • Integration with ThemeService
  • Subtree theme overrides
  • Fallback handling

Example:

// Apply light theme to content
final content = Card(
  title: 'My Card',
  modifiers: [
    ContentModifier(
      configuration: ThemeModifier(mode: ThemeMode.light),
    ),
  ],
);

// Apply dark theme to content
final content = Group(
  items: [myCard, myDivider],
  modifiers: [
    ContentModifier(
      configuration: ThemeModifier(mode: ThemeMode.dark),
    ),
  ],
);

The modifier:

  • Gets theme data from ThemeService
  • Wraps content in a Theme widget
  • Falls back to original content if no theme data
  • Affects all descendants of the modified content
Inheritance
  • Object
  • ContentModifierConfiguration
  • ThemeModifier
Annotations
  • @JsonSerializable.new()

Constructors

ThemeModifier({ThemeMode mode = ThemeMode.light})
ThemeModifier.fromJson(Map<String, dynamic> json)
factory

Properties

hashCode → int
The hash code for this object.
no setterinherited
mode → ThemeMode
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
schemaType → String
The schema type of the content item.
finalinherited

Methods

build(BuildContext context, Widget child, ContentItem content) → Widget
Builds the modifier widget tree for the given content item.
override
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 Properties

typeDescriptor → TypeDescriptor<ThemeModifier>
final

Constants

schemaName → const String