withMaterial static method
Widget
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< ? shadows,Shadow> > - Map<
BoxShadowToken, List< ? boxShadows,BoxShadow> > - Map<
BorderSideToken, BorderSide> ? borders, - Map<
FontWeightToken, FontWeight> ? fontWeights, - List<
Type> ? orderOfModifiers, - required Widget child,
- Key? key,
Creates a widget with Material Design tokens pre-configured.
Implementation
static Widget 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,
// Additional token maps (list-based)
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,
}) {
final allCustomTokens = <MixToken, Object>{
...?tokens,
...?colors?.cast<MixToken, Object>(),
...?textStyles?.cast<MixToken, Object>(),
...?spaces?.cast<MixToken, Object>(),
...?doubles?.cast<MixToken, Object>(),
...?radii?.cast<MixToken, Object>(),
...?breakpoints?.cast<MixToken, Object>(),
...?shadows?.cast<MixToken, Object>(),
...?boxShadows?.cast<MixToken, Object>(),
...?borders?.cast<MixToken, Object>(),
...?fontWeights?.cast<MixToken, Object>(),
};
return createMaterialMixScope(
key: key,
additionalTokens: allCustomTokens.isEmpty ? null : allCustomTokens,
orderOfModifiers: orderOfModifiers,
child: child,
);
}