GridView containing Cards doesn’t calculate height correctly

Posted by Andre Scott | Updated on

GridView containing Cards doesn’t calculate height correctly.

Your problem is that the tiles of GridView.count have a default aspect ratio of 1.0 (i.e. square), and it sounds like you want your tiles to be shorter than that.

A quick fix would be to hard code the childAspectRatio to a number you like. A more nuanced approach would be to implement a SliverGridDelegate that describes the layout you want and use GridView.custom. You could also just do a ListView of 2-element Row widgets and not use GridView at all.

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@] Your question and answer will appear on and help other developers.

Related Questions & Answers