karvulf / flutter-reorderable-grid-view

BSD 3-Clause "New" or "Revised" License
155 stars 22 forks source link

How to use in version 5.0.1 newIndex, oldIndex of orderUpdateEntities that were passed as parameters of onReorder #112

Closed JangInho closed 2 months ago

JangInho commented 3 months ago

How to use in version 5.0.1 newIndex, oldIndex of orderUpdateEntities that were passed as parameters of onReorder

karvulf commented 3 months ago

Hello @JangInho

Since the update I don't pass any indices. Instead you get a function which will do the reorder for you. This is how it works:

        onReorder: (ReorderedListFunction reorderedListFunction) {
          setState(() {
            _fruits = reorderedListFunction(_fruits) as List<String>;
          });
        },

In this example, you add your list which will be reordered to reorderedListFunction and cast the result as the type of your list. After that you update the state with the updated list. Did it work for you? Edit: You can also find more examples in the folder example.

karvulf commented 2 months ago

Closing this one because of no answer