If you want a better UX while clicking the Card
, I suggest you add InkWell
as the Card
's child. This gives the true Material 3 effect when clicking the Card
. The code snippet below would do just that:
return Card(
child: InkWell(
borderRadius: BorderRadius.circular(12.0),
onTap: () {},
child: Column(
children: [
Text(
'This is a Clickable Card!',
style: TextStyle(fontSize: 20.0),
),
Text('Try This Out!'),
],
),
),
);
As long as onTap
is not null (having (){} is enough to make it not null), you will end up with the desired splash effect, AND you'll have a clickable Card
. Also, the current Card
widget in Flutter 3.7.10 comes with borderRadius: BorderRadius.circular(12.0)
. Therefore, it is necessary to add the same property to InkWell
for a better UX.