Row(
children: [
Expanded(
child: Container(
color: Colors.teal,
height: 100,
child: Center(child: Text('Left')),
),
),
Container(
width: 100,
height: 100,
color: Colors.orange,
child: Center(child: Text('Right')),
),
],
)
//With flex Property (Proportional Space)
Row(
children: [
Expanded(
flex: 2,
child: Container(color: Colors.blue, height: 100),
),
Expanded(
flex: 1,
child: Container(color: Colors.green, height: 100),
),
],
)
Ai Code Analizer
🧩 Typical Use Cases
Make widgets fill remaining space.
Create proportional layouts inside
RoworColumn.Prevent overflow by allowing widgets to resize.
🎨 Important Notes
| Property | Description |
|---|---|
flex | Integer value that determines proportion |
child | The widget to expand |
Must be inside Row, Column, or Flex | Won’t work in other containers |
