Skip to content

Commit

Permalink
add example using badges package
Browse files Browse the repository at this point in the history
  • Loading branch information
X-Wei committed Nov 14, 2020
1 parent 3ae9895 commit 2a2def4
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions lib/routes/lists_list_tile_ex.dart
Original file line number Diff line number Diff line change
@@ -1,36 +1,46 @@
import 'package:badges/badges.dart';
import 'package:flutter/material.dart';

class ListTileExample extends StatelessWidget {
const ListTileExample({Key key}) : super(key: key);

@override
Widget build(BuildContext context) {
const listTiles = <Widget>[
ListTile(
final listTiles = <Widget>[
const ListTile(
title: Text('Tile 0: basic'),
),
Divider(),
ListTile(
const Divider(),
const ListTile(
leading: Icon(Icons.face),
title: Text('Tile 1: with leading/trailing widgets'),
trailing: Icon(Icons.tag_faces),
),
Divider(),
ListTile(
const Divider(),
const ListTile(
title: Text('Tile 2 title'),
subtitle: Text('subtitle of tile 2'),
),
Divider(),
ListTile(
const Divider(),
const ListTile(
title: Text('Tile 3: 3 lines'),
isThreeLine: true,
subtitle: Text('subtitle of tile 3'),
),
Divider(),
ListTile(
const Divider(),
const ListTile(
title: Text('Tile 4: dense'),
dense: true,
),
const Divider(),
ListTile(
title: const Text('Tile5: tile with badge'),
subtitle: const Text('(This uses the badges package)'),
trailing: Badge(
badgeContent: const Text('3'),
child: const Icon(Icons.message),
),
),
];
// Directly returning a list of widgets is not common practice.
// People usually use ListView.builder, c.f. "ListView.builder" example.
Expand Down

0 comments on commit 2a2def4

Please sign in to comment.