karvulf / flutter-reorderable-grid-view

BSD 3-Clause "New" or "Revised" License
158 stars 23 forks source link

can it close the animation? it sharks my eyes #102

Closed linuxdrake closed 8 months ago

linuxdrake commented 8 months ago

can it close the animation? it shark my eyes,thks

linuxdrake commented 8 months ago

when i open the page, it always operate the animation. I just hope it does when dragging

karvulf commented 8 months ago

Hallo @linuxdrake Can you give me more details? So you wish to disable the whole animations or specific ones? And does the animation not work for dragging or how is your last sentence meant?

linuxdrake commented 8 months ago

the animation for dragging is ok for me. if I adjust the order of widgets of gridview, click other bottombar and return to the current page, there is always the animation from original order to the last new order, i don't want this animation.

karvulf commented 8 months ago

This sounds a bit like the whole widget is rebuilt. Can you show me this behavior in a video and provide the code you have? @linuxdrake

karvulf commented 8 months ago

Which version do you use? This animation only happens every time because the widget is rebuilt. If you use the version 5.0.0-dev.10, you could set fadeInDuration to Duration.zero to have no animation. @linuxdrake

karvulf commented 8 months ago

this part has changed with the version, so if you use the onReorder, you should use it like this: @linuxdrake

... 
onReorder: (reorderedListFunction) {
    setState(() {
      myBooks = reorderedListFunction(myBooks) as List<YOUR_BOOK_TYPE>;
    });
}
...
linuxdrake commented 8 months ago

sorry, the code can run ,but the animation stll appers. child: ReorderableBuilder( fadeInDuration: Duration.zero, scrollController: _scrollController, onReorder: (orderUpdateEntity) { setState(() { myBooks = orderUpdateEntity(myBooks) as List<Map<String, dynamic>>; // final mybook = myBooks.removeAt(orderUpdateEntity.oldIndex); // myBooks.insert(orderUpdateEntity.newIndex, mybook); }); @karvulf

karvulf commented 8 months ago

I set fadeInDuration to zero and it worked for me, I didn't see the fade in animation. Can you provide a bit more of your code or even an example app where I can reproduce this issue? It's hard to say why this happens without seeing the code. @linuxdrake

linuxdrake commented 8 months ago

@karvulf thank you very much. it worked after i removed the initiation in the inistate function. it worked well in vesion 4.0.0