Created
February 3, 2020 13:12
-
-
Save ryanlid/de760626bd9c2c3bbbd4add74082f394 to your computer and use it in GitHub Desktop.
Card 组件
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
var card = SizedBox( | |
// 限制高度 | |
height: 250.0, | |
// 添加 Card 组件 | |
child: Card( | |
// 垂直布局 | |
child: Column( | |
children: <Widget>[ | |
ListTile( | |
// 标题 | |
title: Text( | |
"深圳市南山区", | |
style: TextStyle( | |
fontWeight: FontWeight.w300, | |
), | |
), | |
// 子标题 | |
subtitle: Text("研发中心"), | |
leading: Icon( | |
Icons.home, | |
color: Colors.lightBlue, | |
), | |
), | |
// 分割线 | |
Divider(), | |
ListTile( | |
title: Text("深圳市罗湖区"), | |
subtitle: Text("培训学习"), | |
leading: Icon( | |
Icons.school, | |
color: Colors.lightBlue, | |
), | |
), | |
Divider() | |
], | |
), | |
), | |
); | |
return MaterialApp( | |
title: "Card 组件", | |
home: Scaffold( | |
appBar: AppBar( | |
title: Text("Card 组件"), | |
), | |
body: Center( | |
child: card, | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment