Flutter provides several fundamental widgets for arranging children:
Container: Used for styling, sizing, and padding a single child.Column: Arranges children vertically.Row: Arranges children horizontally.Wrap: Arranges children horizontally but automatically wraps to the next line when space is insufficient.
// Container for styling
Container(
width: 100,
height: 100,
color: Colors.blue,
alignment: Alignment.center,
child: Text('Hello world'),
),
// Column for vertical layout
Column(
children: [
Container(width: 100, height: 100, color: Colors.blue, child: Text('Hello')),
ElevatedButton(onPressed: () {}, child: Text('Button')),
],
),
// Row for horizontal layout
Row(
children: [
ElevatedButton(onPressed: () {}, child: const Text('1')),
ElevatedButton(onPressed: () {}, child: const Text('2')),
],
),
// Wrap for auto-wrapping content
Wrap(
children: [FlutterLogo(), FlutterLogo(), FlutterLogo()],
),