Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Animation when switch grid view to list view - Flutter

I want to have the animation like this when switch between grid view and list view. How can I do it in Flutter?

![Text](https://im3.ezgif.com/tmp/ezgif-3-d2131e9e11f0.gif)

like image 274
Qk Lahpita Avatar asked Nov 15 '22 16:11

Qk Lahpita


1 Answers

Simply creating a ListView and a GridView, using a bool variable to determine which one to show, wrapping each child in a Hero, and when you want to switch, changing the value of the said bool variable and then pushing the same route works. See here: https://dartpad.dev/05785dfd91a02e55d68a6cd086dcbf0b

like image 151
Ercan Tomaç Avatar answered Jun 17 '23 13:06

Ercan Tomaç