Flutter Widget之ListTile

Widget:https://flutter.io/docs/development/ui/widgets
ListTile:https://docs.flutter.io/flutter/material/ListTile-class.html

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import 'package:flutter/material.dart';

class ListTileDemoPage extends StatefulWidget {
@override
State<StatefulWidget> createState() => new _ListTileDemoPagePageState();
}

class _ListTileDemoPagePageState extends State<ListTileDemoPage> {
int _act = 1;

@override
void initState() {
super.initState();
}

Widget build(BuildContext context) {
return Scaffold(
appBar: new AppBar(
title: new Text('ListTile Demo'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
ListTile(
leading: const Icon(Icons.home),
title: const Text('AppBlog.CN'),
subtitle: const Text('http://www.appblog.cn'),
),
SizedBox(height: 10),
ListTile(
leading: const Icon(Icons.flight_land),
title: const Text('Trix\'s airplane'),
subtitle: _act != 2 ? const Text('The airplane is only in Act II.') : null,
enabled: _act == 2,
onTap: () { /* react to the tile being tapped */ }
)
],
)
),
);
}
}

Flutter Widget ListTile

Powered by AppBlog.CN     浙ICP备14037229号

Copyright © 2012 - 2020 APP开发技术博客 All Rights Reserved.

访客数 : | 访问量 :