buildDesignSystemTheme function
Convenience helper that applies the resolved theme to child by
wrapping it with both a Theme and BrandThemeScope.
This is the recommended way to apply a brand theme to your app. It sets up all the necessary InheritedWidgets for components to access tokens and the curated design system theme.
Implementation
Widget buildDesignSystemTheme({
required BrandTokens tokens,
required Widget child,
}) {
final themeData = buildThemeData(tokens);
final curated = DesignSystemTheme.fromBrandTokens(tokens);
return BrandThemeScope(
tokens: tokens,
child: DesignSystemThemeScope(
theme: curated,
child: Theme(data: themeData, child: child),
),
);
}