apply method
Wraps the child widget in the full layrz_ui theme context.
Applies the same nesting layers as the nesting LayrzApp installs at the root (minus app-level concerns like ScrollConfiguration and custom builder callbacks):
- LayrzTheme — propagates the theme data to all descendants
- DefaultTextStyle — installs the base text style
- IconTheme — configures icon sizing and colour
- ColoredBox — paints the background colour
This ensures that previewed widgets have access to LayrzTheme.of and the
tokens extension method, and that colours, typography, and icon rendering
all match the production app.
Implementation
@override
Widget apply(BuildContext context, Widget child) {
return LayrzTheme(
data: data,
child: DefaultTextStyle(
style: data.textStyle,
child: IconTheme(
data: data.iconTheme,
child: ColoredBox(
color: data.backgroundColor,
child: child,
),
),
),
);
}