Display List Tile in Flutter

Display List Tile in Flutter

A list tile is a fixed height row that usually consists of title, short description and leading or trailing icon.

A ListTile class is used to create a list tile. The lines of text are defined using title and subtitle properties. The icons can be specified with leading and trailing properties.

import 'package:flutter/material.dart';

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

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

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(title: const Text('List tile')),
        body: Column(
          children: const <Widget>[
            ListTile(
              title: Text('Account'),
              subtitle: Text('Sub title 1'),
              leading: Icon(Icons.account_circle),
              trailing: Icon(Icons.keyboard_arrow_right),
            ),
            ListTile(
              title: Text('Call'),
              subtitle: Text('Sub title 2'),
              leading: Icon(Icons.call),
              trailing: Icon(Icons.keyboard_arrow_right),
              selected: true,
            ),
          ],
        ));
  }
}

Leave a Comment

Cancel reply

Your email address will not be published.