I have a ListTile
. If I just write an empty onTap
function it will show the ripple effect when I tap on it. But if I add the navigation function to the onTap
function, it doesn't show the ripple effect when I tap on it. Why?
Note that I'm using the go_router
package for navigation.
My code:
SingleChildScrollView(
…
child: Column(
children: [
Container(
…
child: Card(
…
child: Padding(
…
child: Align(
…
child: Column(
…
children: [
…
ListTile(
onTap: () {
context.pushNamed(
AppRoute.editName.name,
pathParameters: {"userId": user.id},
);
},
title: const Text("Name"),
subtitle: Text(user.name),
trailing: const Icon(Icons.edit),
),
…
],
),
),
),
),
),
],
),
),
I tried changing the position of onTap
from ListTile
to InkWell
, but that didn't work:
InkWell(
onTap: () {
context.pushNamed(
AppRoute.editName.name,
pathParameters: {"userId": user.id},
);
},
child: ListTile(
title: const Text("Name"),
subtitle: Text(user.name),
trailing: const Icon(Icons.edit),
),
),
I also tried wrapping the ListTile
with a Material
, but it didn't work either:
Material(
child: ListTile(
onTap: () {
context.pushNamed(
AppRoute.editName.name,
pathParameters: {"userId": user.id},
);
},
title: const Text("Name"),
subtitle: Text(user.name),
trailing: const Icon(Icons.edit),
),
),
Is there any working solution?