-
Notifications
You must be signed in to change notification settings - Fork 61
/
main.dart
129 lines (116 loc) · 3.41 KB
/
main.dart
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Flutter Demo',
theme: new ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or press Run > Flutter Hot Reload in IntelliJ). Notice that the
// counter didn't reset back to zero; the application is not restarted.
primarySwatch: Colors.blue,
),
home: new Scaffold(
appBar:AppBar(
title:Text('Layout Widget:list、card、stack、listTile'),
),
body:new MyHomePage()
),
);
}
}
class MyHomePage extends StatelessWidget{
@override
Widget build(BuildContext context){
ListTile listTile = new ListTile(
title:new Text(
'这是一个 ListTile widget',
style:new TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20.0
)
),
subtitle: Text('这是一个副标题'),
leading:new Icon(
Icons.markunread,
color: Theme.of(context).primaryColor,
),
);
Stack stack = Stack(
alignment: const Alignment(0.2, 0.7),
children: <Widget>[
new CircleAvatar(
backgroundImage: new NetworkImage('https://img.alicdn.com/tfs/TB1lIf_f4jaK1RjSZKzXXXVwXXa-1629-1080.jpg'),
radius: 100.0,
),
new Opacity(
opacity:0.7,
child:new Container(
decoration:new BoxDecoration(
color:Colors.grey,
),
height: 40.0,
width: 100.0,
alignment: Alignment.center,
child:Text('Nealyang',style:TextStyle(fontSize: 20.0,color: Colors.white)),
)
)
],
);
Card card = new Card(
child:new Container(
padding: const EdgeInsets.all(20.0),
child:new Column(
children: <Widget>[
Image.network(
'https://gw.alicdn.com/tfs/TB1NN.1vQZmBKNjSZPiXXXFNVXa-550-432.png',
width:600.0,
height:200.0,
fit: BoxFit.cover,
),
new Divider(),
new ListTile(
title: new Text('(408) 555-1212',
style: new TextStyle(fontWeight: FontWeight.w500)),
leading: new Icon(
Icons.contact_phone,
color: Colors.blue[500],
),
),
new Divider(),
new ListTile(
title: new Text('(408) 555-1212',
style: new TextStyle(fontWeight: FontWeight.w500)),
leading: new Icon(
Icons.contact_phone,
color: Colors.blue[500],
),
),
],
)
),
);
return new ListView(
children:<Widget>[
listTile,
new Divider(),
new Center(
child:stack,
),
new Divider(),
card,
listTile,
listTile,
card,
listTile,
]
);
}
}