1 | // Copyright 2014 The Flutter Authors. All rights reserved. |
---|---|
2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. |
4 | |
5 | import 'package:flutter/cupertino.dart'; |
6 | import 'package:flutter/material.dart'; |
7 | |
8 | /// Flutter code sample for [CupertinoListTile]. |
9 | |
10 | void main() => runApp(const CupertinoListTileApp()); |
11 | |
12 | class CupertinoListTileApp extends StatelessWidget { |
13 | const CupertinoListTileApp({super.key}); |
14 | |
15 | @override |
16 | Widget build(BuildContext context) { |
17 | return const CupertinoApp(home: CupertinoListTileExample()); |
18 | } |
19 | } |
20 | |
21 | class CupertinoListTileExample extends StatelessWidget { |
22 | const CupertinoListTileExample({super.key}); |
23 | |
24 | @override |
25 | Widget build(BuildContext context) { |
26 | return CupertinoPageScaffold( |
27 | navigationBar: const CupertinoNavigationBar(middle: Text('CupertinoListTile Sample')), |
28 | child: ListView( |
29 | children: const <Widget>[ |
30 | CupertinoListTile(title: Text('One-line CupertinoListTile')), |
31 | CupertinoListTile(leading: FlutterLogo(), title: Text('One-line with leading widget')), |
32 | CupertinoListTile( |
33 | title: Text('One-line with trailing widget'), |
34 | trailing: Icon(Icons.more_vert), |
35 | ), |
36 | CupertinoListTile( |
37 | leading: FlutterLogo(), |
38 | title: Text('One-line with both widgets'), |
39 | trailing: Icon(Icons.more_vert), |
40 | ), |
41 | CupertinoListTile( |
42 | leading: FlutterLogo(size: 56.0), |
43 | title: Text('Two-line CupertinoListTile'), |
44 | subtitle: Text('Here is a subtitle'), |
45 | trailing: Icon(Icons.more_vert), |
46 | additionalInfo: Icon(Icons.info), |
47 | ), |
48 | CupertinoListTile( |
49 | key: Key('CupertinoListTile with background color'), |
50 | leading: FlutterLogo(size: 56.0), |
51 | title: Text('CupertinoListTile with background color'), |
52 | backgroundColor: Colors.lightBlue, |
53 | ), |
54 | ], |
55 | ), |
56 | ); |
57 | } |
58 | } |
59 |