I’m currently on the latest version of Flutter and Dart, but in my project, I want to use the old design of Flutter switches.
Current switch:
Old switch:
I tried using almost every attribute provided by Switch class in Flutter but couldn’t get it back to the old design.
I’ve also searched pub.dev for relevant package but found none which can do this.
3
Answers
The new switch design is due to Android updating its switch style. If you want
your switch to look like the old UI you should create a custom styled switch and make it look however you want.
e.g.
The new switch is following
material 3 design
, you can disable it for the whole app inMaterialApp's themeData
.Or if you still want to use the old design of the switch but want to keep the material 3 design for the app. try the following approach:
By default Material3 design is applied to Theme as well as Widgets:
So to use
Switch
or any other widget with old theme you can wrap your widget withTheme
and indata
property setdata: ThemeData(useMaterial3: false)
by setting
useMateria3: false
old theme will be used