'Flutter responsiveness: GridView with a single column on mobile VS mobile ListView, desktop GridView

I would like to make my Flutter app more responsive.

One simple fix would be to lay out items in a grid on larger screens, with a single-column view used on mobile screens.

What's the best way to achieve this?

Ideally, I'd like to use a GridView with a responsive number of columns, for both smaller and larger screens. This would be the most elegant solution in terms of code cleanliness. However, I'm concerned that using a single-column GridView on mobile might be less performant than using a ListView.

Does anyone here have data about potential performance penalties of this approach? Or does single-column GridView use the exact same code as ListView?

The other approach would be to use ListView vs GridView depending on the size of the window. This would lead to code duplication, but could possibly be more efficient.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source