materialAppWrapper function
WidgetWrapper
materialAppWrapper({
- TargetPlatform platform = TargetPlatform.android,
- Iterable<
LocalizationsDelegate> ? localizations, - Iterable<
Locale> ? localeOverrides, - ThemeData? theme,
This materialAppWrapper is a convenience function to wrap your widget in MaterialApp Wraps your widget in MaterialApp, inject custom theme, localizations, override surfaceSize and platform
platform
will override Theme's platform. theme
is required
localizations
is list of LocalizationsDelegate that is required for this test
navigatorObserver
is an interface for observing the behavior of a Navigator.
localeOverrides
will set supported supportedLocales, defaults to Locale('en')
theme
Your app theme
Implementation
WidgetWrapper materialAppWrapper({
TargetPlatform platform = TargetPlatform.android,
Iterable<LocalizationsDelegate<dynamic>>? localizations,
NavigatorObserver? navigatorObserver,
Iterable<Locale>? localeOverrides,
ThemeData? theme,
}) {
return (child) => MaterialApp(
localizationsDelegates: localizations,
supportedLocales: localeOverrides ?? const [Locale('en')],
theme: theme?.copyWith(platform: platform),
debugShowCheckedModeBanner: false,
home: Material(child: child),
navigatorObservers: [
if (navigatorObserver != null) navigatorObserver,
],
);
}