Docs: https://api.flutter.dev/flutter/material/Switch-class.html
How do I change the border Color when the Switch is turned off? In Material 3, when it is on, the border color is the same as the Switch background color, but when it is off, it has a border. How do I change it in Material 3?
Code:
Switch(
trackColor: (miniVerbose)
? const MaterialStatePropertyAll(Colors.greenAccent)
: const MaterialStatePropertyAll(Colors.orange),
value: miniVerbose,
onChanged: (value) {
setState(() {
miniVerbose = value;
});
},
),
3
Answers
use this code:
Switch:
just updated Vivek code and wrap switch with Theme widget for single button, below is updated code-