OudsThemeTweak class

Modifies the current OUDS theme configuration and applies it to the given child.

This widget allows you to temporarily override the theme mode for a specific subtree without affecting the rest of your application. It's useful for:

  • Preview/demo screens showing both light and dark themes side-by-side
  • Specific UI sections that need forced light/dark mode (e.g., video player always dark)
  • Theme switching animations or transitions
  • Component showcases in design systems

Important Notes:

  • This widget must be nested within an OudsTheme widget
  • Multiple OudsThemeTweak widgets can be nested (inner tweak takes precedence)
  • The tweak only affects the visual appearance; logical theme queries via OudsTheme.modeOf will reflect the tweaked mode within the subtree
  • Use OudsTheme.isOudsInDarkTheme to check the effective theme mode (respects tweaks)

Parameters:

Example usage:

Accessing the tweaked theme:

OudsThemeTweak(
  tweak: OudsThemeTweakType.invert,
  child: MyComponentPreview(),
  ),
)

Force Light theme preview:

OudsThemeTweak(
  tweak: OudsThemeTweakType.forceLight,
  child: MyComponentPreview(),
),

Force Dark theme preview:

OudsThemeTweak(
  tweak: OudsThemeTweakType.forceDark,
  child: MyComponentPreview(),
),
Inheritance

Constructors

OudsThemeTweak({Key? key, required OudsThemeTweakType tweak, required Widget child})
const

Properties

child Widget
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tweak OudsThemeTweakType
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

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