MixScope class

Provides Mix design tokens and configuration to descendant widgets.

Exposes type-safe design tokens, modifier ordering, and token resolution. Uses InheritedModel with aspects: tokens and modifierOrder.

Inheritance

Constructors

MixScope({Map<MixToken, Object>? tokens, Map<ColorToken, Color>? colors, Map<TextStyleToken, TextStyle>? textStyles, Map<SpaceToken, double>? spaces, Map<DoubleToken, double>? doubles, Map<RadiusToken, Radius>? radii, Map<BreakpointToken, Breakpoint>? breakpoints, Map<ShadowToken, List<Shadow>>? shadows, Map<BoxShadowToken, List<BoxShadow>>? boxShadows, Map<BorderSideToken, BorderSide>? borders, Map<FontWeightToken, FontWeight>? fontWeights, List<Type>? orderOfModifiers, required Widget child, Key? key})
Creates a MixScope with the provided tokens and modifier ordering.
factory
MixScope.empty({required Widget child, Key? key})
Creates an empty MixScope with no tokens or modifier ordering.
const

Properties

child Widget
The widget below this widget in the tree.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
orderOfModifiers List<Type>?
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tokens Map<MixToken, Object>?
Returns the raw token map provided to this scope.
no setter

Methods

createElement() InheritedModelElement<String>
Inflates this configuration to a concrete instance.
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
getToken<T>(MixToken<T> token, BuildContext _) → T
Resolves token to its concrete value.
isSupportedAspect(Object aspect) bool
Returns true if this model supports the given aspect.
inherited
merge(MixScope other) MixScope
Returns a new MixScope by merging this scope with other.
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
updateShouldNotify(covariant MixScope oldWidget) bool
Whether the framework should notify widgets that inherit from this widget.
override
updateShouldNotifyDependent(covariant MixScope oldWidget, Set<String> dependencies) bool
Return true if the changes between this model and oldWidget match any of the dependencies.
override

Operators

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

Static Methods

combine({required Iterable<MixScope> scopes, required Widget child, Key? key}) MixScope
Combines multiple MixScope instances into a single scope.
maybeOf(BuildContext context, [String? aspect]) MixScope?
Returns the current MixScope, or null if not found.
of(BuildContext context, [String? aspect]) MixScope
Returns the current MixScope from the widget tree.
tokenOf<T>(MixToken<T> token, BuildContext context) → T
Resolves a token value from the nearest MixScope.
withMaterial({Map<MixToken, Object>? tokens, Map<ColorToken, Color>? colors, Map<TextStyleToken, TextStyle>? textStyles, Map<SpaceToken, double>? spaces, Map<DoubleToken, double>? doubles, Map<RadiusToken, Radius>? radii, Map<BreakpointToken, Breakpoint>? breakpoints, Map<ShadowToken, List<Shadow>>? shadows, Map<BoxShadowToken, List<BoxShadow>>? boxShadows, Map<BorderSideToken, BorderSide>? borders, Map<FontWeightToken, FontWeight>? fontWeights, List<Type>? orderOfModifiers, required Widget child, Key? key}) Widget
Creates a widget with Material Design tokens pre-configured.