Menu
CoddyTech

Column

Part of the Your First App section of Coddy's Flutter journey. Lesson 19 of 32.

Center and Container hold one child. To show several widgets, use a Column: it puts its children: one under another.

Column(
  children: [
    Text('Eggs'),
    Text('Milk'),
    Text('Bread'),
  ],
)

children: takes a list, so the widgets go inside square brackets, each followed by a comma. They are shown from top to bottom in the order you write them.

challenge icon

Challenge

Easy

The app shows only First. Replace it with a Column that shows First, Second and Third, in that order, one under another.

Try it yourself

import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: Center(
          child: Text('First'),
        ),
      ),
    );
  }
}
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Your First App

Practice on your own: Online Flutter compiler