GestureDetector onTap Card
As Card
is "a sheet of Material", you probably want to use InkWell
, which includes Material highlight and splash effects, based on the closest Material
ancestor.
return Card(
child: InkWell(
onTap: () {
// Function is executed on tap.
},
child: ..,
),
);
You should really be wrapping the child in InkWell instead of the Card:
return Card(
child: InkWell(onTap: () {},
child: Text("hello")));
This will make the splash animation appear correctly inside the card rather than outside of it.