appBuilder static method
Create a new ThemeData from the given data, but with updated properties from the currently simulated device.
Implementation
static Widget appBuilder(BuildContext context, Widget? child) {
if (!_isEnabled(context)) {
return child!;
}
final theme = Theme.of(context);
final isInitializedAndEnabled = context.select(
(DevicePreviewStore store) => store.state.maybeMap(
initialized: (initialized) => initialized.data.isEnabled,
orElse: () => false,
),
);
if (!isInitializedAndEnabled) {
return child!;
}
return Theme(
data: theme.copyWith(
platform: platform(context),
visualDensity: visualDensity(context),
),
child: child!,
);
}