Repository navigation
Switch widget color doesn't use ColorScheme #93709
Description
Looks like Switch widget still needs deprecated accentColor to be defined in ThemeData in order to not use the default color on Android. In my project I defined a whole ColorScheme to not use deprecated color values in ThemeData and saw that Switch ignores secondary defined in the app theme. I can only change color by adding accentColor property.
Attached a sample project with fully defined ColorScheme and Switch not following it.
This is how Switch looks with just ColorScheme defined:

This is how Switch should look like and how it looks when I add accentColor to ThemeData:

Steps to Reproduce
- Create new project
- Define full
ColorScheme(with all defined colors) - Add
Switchwidget and observe that it has the default Material blue color on Android.
Expected results: Switch follows secondary color as it is suggested in deprecation message for accentColor
Actual results: Switch has default Material blue color on Android
Code sample
flutter doctor output
// Attaching only Flutter related info, since other is irrelevant for the issue
[✓] Flutter (Channel stable, 2.5.3, on macOS 11.6.1 20G224 darwin-x64, locale en-UA)
• Flutter version 2.5.3 at /Users/vb/Development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 18116933e7 (5 weeks ago), 2021-10-15 10:46:35 -0700
• Engine revision d3ea636dc5
• Dart version 2.14.4
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone (PR merged)
Activity
[-]Switch widget color doesn't follow defined ColorScheme[/-][+]Switch widget color doesn't follow defined ColorScheme on Android[/+]darshankawar commentedon Nov 17, 2021
Thanks for the report. I see the same behavior.
stable, master flutter doctor -v
/cc @HansMuller
[-]Switch widget color doesn't follow defined ColorScheme on Android[/-][+]`Switch` widget color doesn't use `ColorScheme`[/+]github-actions commentedon Aug 17, 2022
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.