-
Notifications
You must be signed in to change notification settings - Fork 0
/
container.dart
60 lines (57 loc) · 1.61 KB
/
container.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
import 'package:flutter/material.dart';
import 'package:flutter_demo/tabbar/mine/component/content_text.dart';
import 'package:flutter_demo/tabbar/mine/component/title_text.dart';
class ContainerPage extends StatefulWidget {
@override
_ContainerPageState createState() => _ContainerPageState();
}
class _ContainerPageState extends State<ContainerPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Container"),
),
body: ListView(
children: <Widget>[
TitleTextPage("简介:"),
ContentTextPage([
"Container。"
]),
TitleTextPage("属性:"),
ContentTextPage([
"alignment: 子元素对齐",
"padding: 内边距",
"decoration: 设置样式,边框、圆角、背景图片等",
"margin: 外边距"
]),
TitleTextPage("例子:"),
ContainerDemo()
],
),
);
}
}
class ContainerDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Center(
child: Container(
width: 200,
height: 200,
alignment: Alignment.center,
decoration: BoxDecoration(
color: Colors.lightBlue,
border: Border.all(color: Colors.deepOrangeAccent),
borderRadius: BorderRadius.all(Radius.circular(20))
// 背景图片
// image: DecorationImage(
// image: AssetImage("asset/images/1.jpg"),
// fit: BoxFit.fill
// )
),
child: Text("Container"),
),
);
}
}