The default switch for stock Android looks as follows:
However, on some Android flavors such as MIUI, the switch looks like this in their native apps:
How can I achieve this native behavior for all Android flavors (Samsung, MIUI, Huawei, Sony, etc.) with Flutter?
CodePudding user response:
You can use the below snippet for Switch Button like Android:
Flexible(
child: SwitchListTile(
title: const Text(
'<Put Your Text>',
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.bold)),
value: isSwitch,
onChanged: (value) {
setState(() {
isSwitch = value;
});
},
activeColor: Colors.white,
activeTrackColor:
CustomColors.switchActiveColor,
inactiveThumbColor:
CustomColors.switchDisableCircleColor,
inactiveTrackColor:
CustomColors.switchDisableColor,
contentPadding: const EdgeInsets.all(0),
),
flex: 1)
isSwitch is bool flag to manage on/off
CodePudding user response:
Can you help me add payment to Huawei app