var _switchValue = false;
Switch(
activeThumbImage: AssetImage(‘images/bird.png’,),
inactiveThumbColor: Colors.green,
inactiveTrackColor: Colors.orange,
activeColor: Colors.red,
activeTrackColor: Colors.blue,
value: _switchValue,
onChanged: (value) {
setState(() {
_switchValue = value;
});
})
效果图
3.1 构造方法
const SwitchListTile({
Key? key,
required this.value,
required this.onChanged,
this.tileColor,
this.activeColor,
this.activeTrackColor,
this.inactiveThumbColor,
t