'How to allow only one Slidable at a time to be open
I'm using flutter_sildable for chat app slide, I want only one slide to be open at the time so I have tried what they recommended on the docs but it's not working and I don't know why
class _ChatTileState extends State<ChatTile> {
final SlidableController slidableController = SlidableController();
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {},
child: Container(
padding: EdgeInsets.symmetric(vertical: 10),
child: Slidable(
key: UniqueKey(),
controller: slidableController,
movementDuration: Duration(milliseconds: 100),
...
Solution 1:[1]
If you are using version 1.0.0 or later you can achieve the same behaviour by wrapping the list of Slidable widgets with:
SlidableAutoCloseBehavior(closeWhenOpened: true, child: ... )
Solution 2:[2]
Hopefully the accepted answer here will work for you. If not, could you show us the rest of your code so we can properly view any further reasons for there to be a problem. Swipe List Item for more options (Flutter)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | miloskarakas |
| Solution 2 | James Piner |
