flutter

Column Row Tips

//Limiting the width of Column itself, use SizedBox
SizedBox(
  width: 100, // set this
  child: Column(...),
)

//Limiting width of children inside Column, without hardcoding values
Row(
  children: <Widget>[
    Expanded(
      flex: 3, // takes 30% of available width 
      child: Child1(),
    ),
    Expanded(
      flex: 7, // takes 70% of available width  
      child: Child2(),
    ),
  ],
)

//Limiting width of children inside Column, with hardcoding values.
Row(
  children: <Widget>[
    SizedBox(
      width: 100, // hard coding child width
      child: Child1(),
    ),
    SizedBox(
      width: 200, // hard coding child width
      child: Child2(),
    ),
  ],
)
Was this helpful?