createMaterialMixScope function
Creates a MixScope with Material Design tokens pre-configured.
This method uses a Builder to dynamically access the current Material theme and creates token map with concrete values from the theme.
Implementation
Widget createMaterialMixScope({
Map<MixToken, Object>? additionalTokens,
List<Type>? orderOfModifiers,
required Widget child,
Key? key,
}) {
return Builder(
builder: (context) {
final materialColorTokens = _createMaterialColorTokens(context);
final materialTextStyleTokens = _createMaterialTextStyleTokens(context);
final allMaterialTokens = {
...materialColorTokens,
...materialTextStyleTokens,
};
final tokens = {...allMaterialTokens, ...?additionalTokens};
return MixScope(
key: key,
tokens: tokens,
orderOfModifiers: orderOfModifiers,
child: child,
);
},
);
}