I want this type of behavior in list view item swipe.
- When user swipe half the list item I want to show some options.
- When user click on that option I am performing some task.
- When a user swipes an item all the way through to end(mean full swipe), I don't want to remove it; instead, I want to perform a task, and when that task or process is finished, I want to dismiss the swipe.
Here is my Code!
child: SlidableAutoCloseBehavior(
child: ListView.separated(
itemBuilder: ((context, index) => Slidable(
closeOnScroll: true,
key: UniqueKey(),
startActionPane: ActionPane(
dismissible: DismissiblePane(
onDismissed: () {
Fluttertoast.showToast(
msg: "Full swipe ${index + 1}");
},
),
motion: BehindMotion(),
children: [
SlidableAction(
onPressed: (BuildContext context) {
Fluttertoast.showToast(
msg: "Unlock ${index + 1}");
},
backgroundColor: Colors.red,
label: "Unlock",
icon: Icons.lock_open),
SlidableAction(
onPressed: (BuildContext context) {
Fluttertoast.showToast(msg: "Lock ${index + 1}");
},
backgroundColor: Colors.green,
label: "Lock",
icon: Icons.lock_outline),
],
),
child: listViewItem(index))),
separatorBuilder: (BuildContext context, int index) =>
const Divider(),
itemCount: list.length,
),
)
I had accomplished the first and second points successfully, but I have no idea how to archive the third point.