I want the ListTile
to only allow one click. There is a ListTile
that is pushed to another screen when tapped in my app.
When I now click this ListTile
multiple times, it pushes to another screen multiple times. I expected the result to be that the ListTile
only allows one click and pushes another screen once.
I googled and referenced these questions, but didn't get the expected results:
how to disable button after first click in flutter?, How to prevent multiple click on a gesture?, Elevated Button that can able to click just once -Flutter, Trigger a function only one time after press a button - Flutter, How can I make that the on ttap button only be pressed one time? - Flutter
My code:
ListTile(
…
onTap: () {
…
Navigator.of(context).push(MaterialPageRoute(builder: (context) => Scaffold(appBar: AppBar())));
}
),
Feel free to leave a comment if you need more information.
How to make ListTile
only allow one click in Flutter? I would appreciate any help. Thank you in advance!