Skip to content

Instantly share code, notes, and snippets.

@ryanlid
Created February 3, 2020 13:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanlid/de760626bd9c2c3bbbd4add74082f394 to your computer and use it in GitHub Desktop.
Save ryanlid/de760626bd9c2c3bbbd4add74082f394 to your computer and use it in GitHub Desktop.
Card 组件
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