I am a flutter beginner. I use a Cupertino switch for creating switches. If I press that switch it should open a container below the switch otherwise the button should stay the same. How to achieve this?
I tried. But I didn’t get it. Can anyone help to resolve this?
Sample code:
Text(
'Gift Wrapping',
style: GoogleFonts.poppins(
color: Color(0xff000000),
fontSize: 14,
fontWeight: FontWeight.w500,
letterSpacing: 0.4),
),
),
Padding(
padding: const EdgeInsets.only(left: 98),
child: Transform.scale(
scale: 1,
child: CupertinoSwitch(
value: _giftwrapping,
thumbColor: Color(0xffffffff),
activeColor: Color(0xff6939ed),
onChanged: (value) {
setState(() {
_giftwrapping = value;
});
},
),
),
),
2
Answers
Try this
You can use the Visibility widget to handle the Container below the Switch.
Here is the full class.