Check Mobile App
Read now

Reorderable ListView in flutter

Save

ReorderableListView()  is a built-in widget in the flutter that enables the user to change the order of the items placed in the ListView through long tap and drag.

A reminder app or a task manager app would be the perfect example of this. These apps usually provide reorder or sort functionalities. As in these apps, the user needs to be able to arrange/sort items based on his/her preferences or order priority.

This is pretty easy to implement in the flutter. So, let’s check how to implement Reorderable ListView in flutter.

Step1: Create a flutter project.

Step2: First, we will create a list that has data. So, we will create a list of strings and name as tasks.

Step3: Add ReorderableListView() widget and add key in the children of ReorderableListView widget. The key is expected to distinguish the items after their position is changed.

Step4: Add the reorder function. It is a callback function used by the list to report that a list item has been dragged to a new location in the list and the application should update the order of the items.

Now run your code and check by long-tapping on an item and dragging it to a new position.

Output:

So, this is how we implement reorderable listview in flutter.

Thanks for reading this article ❤

If I got something wrong 🙈, let me know in the comments. I would love to improve.

Reference Link: https://www.kindacode.com/article/working-with-reorderablelistview-in-flutter/

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

css.php

Big thanks to Webkul and his team for helping get Opencart 3.0.3.7 release ready!

Deniel Kerr

Owner and Founder. Opencart

Talk to Sales
Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home