Container

Alignment属性,Container内child的对齐方式,也就是容器子内容的对齐方式,并不是容器本身的对齐方式。
padding         内边距
margin           外边距
decoration     装饰器
使用:
 1 body: new Center(
 2           child: new Container(
 3             child: new Text(
 4               '非淡泊无以明志,非宁静无以致远。(诸葛亮)',
 5               style: TextStyle(fontSize: 30.0),
 6             ),
 7             alignment: Alignment.topLeft,
 8             width: 500.0,
 9             height: 200.0,
10             //color: Colors.lightBlue,
11             //padding: const EdgeInsets.all(10),    //内边距
12             padding: const EdgeInsets.fromLTRB(10.0, 50.0, 0, 0),
13             margin: const EdgeInsets.all(20.0),
14             decoration: new BoxDecoration(
15               gradient: const LinearGradient(
16                   colors: [Colors.lightBlue, Colors.green, Colors.purple]
17                   ),
18                   border: Border.all(width: 5.0,color:Colors.red
19                   ),
20             ),
21           ),
22         ),

 

posted @ 2020-03-13 15:00  lai1322  阅读(161)  评论(0编辑  收藏  举报