How to change color of floating action button on theme change ? in flutter and also How can I find out what the current theme is in the app? in flutter
To get Current theme
ThemeData theme = Theme.of(context);
To change Theme
ThemeData(
//to change primary color
primarySwatch: Colors.red,
//to change only floating action button theme
floatingActionButtonTheme: FloatingActionButtonThemeData(
backgroundColor: ,
foregroundColor: ,
),
);
to get current device theme is Dark theme or not
final brightnessValue = MediaQuery.of(context).platformBrightness;
bool isDark = brightnessValue == Brightness.dark;