Skip to content

Latest commit

History

History
36 lines (20 loc) 路 1.13 KB

File metadata and controls

36 lines (20 loc) 路 1.13 KB

Responsive Flutter card layout with SizedBox & Center

How do you create a Flutter card layout that grows horizontally up to a given width, then remains fixed at that width just like in this example?


This can be done by composing Center and SizedBox widgets like so:


Why does this work?

Well, it's all about tight vs loose constraints:

  • Center has loose constraints
  • SizedBox has tight constraints

Combine them together for profit.

This excellent article by @mhadaily explains all the details:


Found this useful? Show some love and share the original tweet 馃檹


Previous Next
How to Validate a TextField in Flutter How to navigate programmatically between tabs in Flutter