screenWidget static method

Widget screenWidget(
  1. BuildContext context, {
  2. required Widget child,
})

Wraps child with the screen background as a full-size Stack.

Use this as the Scaffold body when the background may be a widget (e.g. an animated gradient) rather than a plain BoxDecoration:

Scaffold(
  body: AppBackgroundStyles.screenWidget(context,
    child: CustomScrollView(...),
  ),
)

Implementation

static Widget screenWidget(BuildContext context, {required Widget child}) {
  final data = <String, dynamic>{
    'name': 'screen_widget',
    'context': context,
    'child': child,
  };
  final result = MooseScope.hookRegistryOf(context)
      .execute<dynamic>('styles:background', data);
  if (result is Widget) return result;
  // Fallback — plain DecoratedBox with the screen BoxDecoration.
  return DecoratedBox(
    decoration: screen(context),
    child: SizedBox.expand(child: child),
  );
}