Inside my app.dart I have my BlocProviders:
return MultiBlocProvider(
providers: [
BlocProvider(
create: (context) => SysUiCubit(context: context, "currentTheme: currentTheme"),
), child: MaterialApp(
theme: AppTheme.lightTheme.copyWith(brightness: Brightness.light),
darkTheme: AppTheme.darkTheme.copyWith(brightness: Brightness.dark),
themeMode: themeService.getSysMode ? ThemeMode.system : (themeService.getDarkMode ? ThemeMode.dark : ThemeMode.light),
and after my BlocProviders I have the MaterialApp. The problem is: For the SysUiCubit I need the state of the current theme like I tried to visualize inside the quotation mark. The easiest way would be to have the MaterialApp before my BlocProvider, but I think this isn't possible - isn't it? To understand the use case: Inside my SysUiCubit I have a
factory SysUiState.initial(BuildContext context){
return const SysUiState(systemUiOverlayStyle: SystemUiOverlayStyle.dark);
}
Where I want to add an Overlaystyle dependent from the current theme. So as you can guess, to realize that inside the init state, the theme mode must already be set. Any advice how I can do this?
I believe you added systemUiOverlayStyle as a required parameter I would suggest trying this solution:
let me know if you got my points.