I have two images in flutter which is use for pin and unpin the data in list view so my program is that when i click on pin image than unpin image should be hide and when i click unpin image than pin image should hide. so how to implement this thing in flutter.
here is my demo code
class PinUnpinData extends StatefulWidget {
@override
_PinUnpinDataState createState() => _PinUnpinDataState();
}
class _PinUnpinDataState extends State<PinUnpinData> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,
title: Text(
"Pin-Unpin",
style: TextStyle(fontSize: 20, color: Colors.white),
),
),
backgroundColor: Colors.white,
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
InkWell(
onTap: () {
},
child: Padding(
padding: const EdgeInsets.all(20),
child: Image.asset(
"assets/images/pin.png",
height: 20,
width: 20,
),
)),
InkWell(
onTap: () {},
child: Padding(
padding: const EdgeInsets.all(20),
child: Image.asset(
"assets/images/unpin.png",
height: 20,
width: 20,
),
))
],
),
),
);
}
}