Flutter Widget之Card

Widget:https://flutter.io/docs/development/ui/widgets
Card:https://docs.flutter.io/flutter/material/Card-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
import 'package:flutter/material.dart';

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

class _CardDemoPageState extends State<CardDemoPage> {

@override
Widget build(BuildContext context) {
List<Widget> list = <Widget>[];
for (int i = 0; i < 30; i++) {
list.add(new Card(child: new Column(
children: <Widget>[
new Image.asset(
'images/pic${i + 1}.jpg',),
new ListTile(
title: new Text('title$i', style: _itemTextStyle,),
subtitle: new Text('http://www.appblog.cn'),
leading: i % 3 == 0
? new Icon(Icons.theaters, color: Colors.blue,)
: new Icon(Icons.restaurant, color: Colors.blue,),
),
],
), margin: const EdgeInsets.all(10.0),
));
}
return new Scaffold(
appBar: new AppBar(title: new Text('Card Demo'),),
body: new Center(child: new ListView(children: list,),),
);
}
}

TextStyle _itemTextStyle = new TextStyle(
fontWeight: FontWeight.w500, fontSize: 14.0);

Flutter Widget Card

Powered by AppBlog.CN     浙ICP备14037229号

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

访客数 : | 访问量 :