Flutter: How do you make a card clickable?
Flutter use composition over properties.Wrap the desired widget into a clickable one to achieve what you need.
Some clickable widgets : GestureDetector
, InkWell
, InkResponse
.
GestureDetector( onTap: () => ......, child: Card(...),);
Flutter provides the InkWell Widget. by registering a callback you can decide what happens when user clicks on the card (called tap in flutter). InkWell also implements Material Design ripple effect
Card( child: new InkWell( onTap: () { print("tapped"); }, child: Container( width: 100.0, height: 100.0, ), ),),
I think you can also use InkWell apart from GestureDetector just wrap the card inside InkWell()
Widget
InkWell( onTap: (){ print("Card Clicked"); } child: new Card(),);