letsar / flutter_slidable

A Flutter implementation of slidable list item with directional slide actions.
MIT License
2.72k stars 588 forks source link

how to dismiss slidableAction when using other widget #458

Open rt234cw opened 9 months ago

rt234cw commented 9 months ago

For example, I am using TextButton. How do I dismiss the sliablaction after pressing the button?

Slidable(
            endActionPane: ActionPane(
              motion: const ScrollMotion(),
              children: [
                TextButton(onPressed: () {}, child: const Text('cancel'),),
              ],
            ),
samih93 commented 7 months ago

fianl slidableController = SlidableController(this); Slidable( controller: slidableController, // Specify a key if the Slidable is dismissible. key: const ValueKey(0), motion: const ScrollMotion(), children: [ TextButton(onPressed: () { slidableController .close(); }, child: const Text('cancel'),), ],