TExcelTAD
Home › Flutter › Cards & ListTile

Flutter Cards & ListTile

Two Material widgets do a lot of heavy lifting in typical app screens: ListTile, a ready-made row layout with slots for an icon, a title, a subtitle and a trailing widget, and Card, a panel with rounded corners and a soft shadow that groups related content.

ListTile anatomy

A ListTile has fixed slots. You fill only the ones you need:

Slot Typical content
leading Icon, CircleAvatar or thumbnail on the left
title Main text (usually a Text)
subtitle Secondary text below the title
trailing Icon, switch, checkbox or small text on the right
onTap / onLongPress What happens when the row is pressed
flutter · try it yourself
import 'package:flutter/material.dart';

void main() => runApp(const MaterialApp(home: Inbox()));

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Inbox')),
      body: ListView(
        children: [
          ListTile(
            leading: const CircleAvatar(child: Text('K')),
            title: const Text('Kim'),
            subtitle: const Text('Lunch tomorrow?'),
            trailing: const Text('09:41'),
            onTap: () => debugPrint('Open chat with Kim'),
          ),
          const ListTile(
            leading: CircleAvatar(child: Text('R')),
            title: Text('Ravi'),
            subtitle: Text('Sent the slides 👍'),
            trailing: Text('Yesterday'),
          ),
        ],
      ),
    );
  }
}
Open chat with Kim

Interactive tiles

Flutter ships variants that combine a tile with a control. Tapping anywhere on the row toggles the control, which makes them much easier to hit than a bare Switch.

flutter · try it yourself
class NotificationSettings extends StatefulWidget {
  const NotificationSettings({super.key});

  @override
  State<NotificationSettings> createState() => _NotificationSettingsState();
}

class _NotificationSettingsState extends State<NotificationSettings> {
  bool _push = true;
  bool _email = false;

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        SwitchListTile(
          title: const Text('Push notifications'),
          value: _push,
          onChanged: (v) => setState(() => _push = v),
        ),
        CheckboxListTile(
          title: const Text('Weekly email'),
          subtitle: const Text('A summary every Monday'),
          value: _email,
          onChanged: (v) => setState(() => _email = v ?? false),
        ),
      ],
    );
  }
}

RadioListTile works the same way for choosing one option from a group.

Cards

A Card is a Material surface: it draws a background, rounded corners and an elevation shadow, and clips nothing by default. Put any layout inside it — very often a Column with a ListTile and some buttons.

flutter · try it yourself
class ArticleCard extends StatelessWidget {
  const ArticleCard({super.key});

  @override
  Widget build(BuildContext context) {
    return Card(
      margin: const EdgeInsets.all(16),
      elevation: 2,
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          const ListTile(
            leading: Icon(Icons.article, size: 40),
            title: Text('Getting started with Flutter'),
            subtitle: Text('5 min read'),
          ),
          Row(
            mainAxisAlignment: MainAxisAlignment.end,
            children: [
              TextButton(onPressed: () {}, child: const Text('SHARE')),
              TextButton(onPressed: () {}, child: const Text('READ')),
              const SizedBox(width: 8),
            ],
          ),
        ],
      ),
    );
  }
}

Tip: To make a whole card tappable with the ripple effect, put an InkWell inside the card (Card(child: InkWell(onTap: …, child: …))), and set clipBehavior: Clip.antiAlias on the card so the ripple respects the rounded corners.

Customising shape and colour

Card accepts color, elevation, margin and shape. For instance, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)) gives larger corners. In Material 3, Card.filled() and Card.outlined() give the flat and outlined variants.

Note: mainAxisSize: MainAxisSize.min on the inner Column stops the card from stretching to fill the whole screen height.

Test yourself

Which ListTile slot is shown on the far right?

  1. leading
  2. title
  3. subtitle
  4. trailing

What does a Card add compared to a plain Container?

  1. Scrolling
  2. A Material surface with rounded corners and an elevation shadow
  3. Automatic padding of 100
  4. Navigation

Which widget combines a list row with an on/off switch?

  1. ToggleTile
  2. SwitchListTile
  3. ListSwitch
  4. CheckboxListTile