stryder-dev / flutter_platform_widgets

Target the specific design of Material for Android and Cupertino for iOS widgets through a common set of Platform aware widgets
MIT License
1.57k stars 171 forks source link

PlatformTheme inside Consumer #455

Open WeighingDog opened 5 months ago

WeighingDog commented 5 months ago

Hi. I need to wrap PlatformTheme inside a theme Consumer to change primary color of theme based on button press. Is it correct? It's like PlatformTheme.of(context)?.themeMode assegnation does not work properly.

Consumer2<AppThemeData, AppLanguageProvider>( builder: (context, theme, locale, child) => PlatformTheme( themeMode: initialThemeMode, materialLightTheme: AppThemeData.materialLightTheme, materialDarkTheme: AppThemeData.materialDarkTheme, cupertinoLightTheme: theme.cupertinoCustomLightTheme, cupertinoDarkTheme: AppThemeData.cupertinoDarkTheme, matchCupertinoSystemChromeBrightness: true, onThemeModeChanged: (themeMode) { print(themeMode); theme.setThemeMode(themeMode); },