ControlRoot constructor
- ThemeConfig<
ControlTheme> ? theme, - CrossTransition? transition,
- AppState initState = AppState.init,
- List<
AppStateBuilder> states = const [], - required AppWidgetBuilder app,
- Future onSetupChanged(
- ControlRootSetup setup
Root Widget of whole app. Initializes Control and handles localization and theme changes. Notifies about AppState changes and animates Widget swapping.
debug
- Runtime debug value. This value is also provided to BaseLocalization
. Default value is kDebugMode.
theme - Custom config for ControlTheme. Map of supported themes, default theme and custom ControlTheme builder.
initState - Initial app state. Default value is AppState.init.
states - List of app states. AppState.main is by default considered as main home Widget. Use AppState.main.build
to create app state. Change state by calling Control.root().setAppState
.
transition - Custom transition between app states. Default transition is set to CrossTransitions.fade
.
app - Builder of App - return WidgetsApp is expected (MaterialApp, CupertinoApp). Provides ControlRootSetup and home Widget. Use setup.key
as App key to prevent unnecessary rebuilds and disposes !
initAsync
- Custom async
function to execute during ControlFactory initialization. Don't overwhelm this function - it's just for loading core settings before 'home' widget is shown.
Implementation
const ControlRoot({
this.theme,
this.transition,
this.initState = AppState.init,
this.states = const [],
required this.app,
this.onSetupChanged,
}) : super(key: ControlRootScope._rootKey);