I have a Slidable
widget with a Card
child and was wondering is it possible for me to open the Slidable
when I tapped on the Card
? I have tried using SlidableController
but this class seems buggy as it keeps returning null for me. Besides, I also tried using the groupTag
property in Slidable
but it also not working on my project. The below is the sample code and hoping if anyone could help:
Container(
decoration: ShapeDecoration(
// imitating card shape
shape: Theme.of(context).cardTheme.shape ??
// material 3 default card shape
const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(12.0)),
),
// using card color (this is default card color)
color: Theme.of(context).cardColor,
),
child: Slidable(
endActionPane: ActionPane(
motion: const DrawerMotion(),
children: [
Expanded(
child: Container(
decoration: const BoxDecoration(
borderRadius: BorderRadius.only(
bottomRight: Radius.circular(10),
topRight: Radius.circular(10),
),
color: Colors.purple,
),
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
IconButton(
onPressed: () {},
icon: const Icon(
Icons.local_phone_rounded,
color: Colors.white,
),
),
IconButton(
onPressed: () {},
icon: const Icon(
Icons.mail_outlined,
color: Colors.white,
),
),
IconButton(
onPressed: () {},
icon: const Icon(
Icons.mail_outlined,
color: Colors.white,
),
),
],
),
),
)
],
),
child: const Card(
margin: EdgeInsets.zero,
elevation: 0,
child: ListTile(
dense: true,
leading: Icon(Icons.supervised_user_circle, size: 50),
title: Text('KOO KIAN KEAT'),
subtitle: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [Text('----')],
),
),
),
),
),
2
Answers
Following the documentation:
You can do something like
So, put your card inside a Inkwell widget
Please use below code for your issue