withMaterial static method

Widget withMaterial({
  1. Map<MixToken, Object>? tokens,
  2. Map<ColorToken, Color>? colors,
  3. Map<TextStyleToken, TextStyle>? textStyles,
  4. Map<SpaceToken, double>? spaces,
  5. Map<DoubleToken, double>? doubles,
  6. Map<RadiusToken, Radius>? radii,
  7. Map<BreakpointToken, Breakpoint>? breakpoints,
  8. Map<ShadowToken, List<Shadow>>? shadows,
  9. Map<BoxShadowToken, List<BoxShadow>>? boxShadows,
  10. Map<BorderSideToken, BorderSide>? borders,
  11. Map<FontWeightToken, FontWeight>? fontWeights,
  12. List<Type>? orderOfModifiers,
  13. required Widget child,
  14. 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,
  );
}