After upgrading Flutter version I am getting this error in background color
ThemeData(
...
...
...
backgroundColor: Colors.white,
...
...
...);
FOR THE REMAINING PARTS
I was using
backgroundColor: Theme.of(context).backgroundColor,
–>
I converted to
backgroundColor:
Theme.of(context).colorScheme.secondary,
(Because I saw a solution on the internet, old one was giving a mistake)
How can I solve my problem? It seems that problem is about flutter version upgrading. What do you think? Any help will be appreciated.
flutter doctor:
[✓] Flutter (Channel stable, 3.24.3, on macOS 14.4.1 darwin-arm64, locale tr-TR)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0-rc3)
[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.3)
[✓] VS Code (version 1.92.1)
[✓] Connected device (4 available)
[✓] Network resources
2
Answers
Use colorScheme.background instead.
This feature was deprecated after v3.3.0-0.5.pre.
example
Use
scaffoldBackgroundColor: Colors.white
instead ofbackgroundColor
if you need to change the color of scaffold. If you want to know more about the parameters of ThemeData you canCtrl+click
in windows orCmd+click
on mac on widget you want to know more.