How to change background color according to system background using ColorScheme in ThemeData in flutter?
I expect to change background color according to background of system. I know there are other ways. But I want if it is possible to do this using ColorScheme in ThemeData
2
Answers
The Material Design team has provided a package to create color schemes based on the platform’s implementation of dynamic color, which is called dynamic_color.
It comes with
DynamicColorBuilder
which provides a light and darkColorScheme
based on the system’s color implementation (which is wallpaper color for Android).To use it, simply add the package using the
flutter pub add dynamic_color
command, import the pacakge in your Dart file, and use the builder: