1+ import 'package:flutter/material.dart' ;
2+
3+ class Index extends StatelessWidget {
4+ @override
5+ Widget build (BuildContext context) {
6+ return Scaffold (
7+ appBar: AppBar (title: Text ('Container Demo' ),),
8+ body: ListView (
9+ children: < Widget > [
10+ Center (
11+ child: Container (
12+ child: Text ('Hello' , style: TextStyle (fontSize: 20.0 ),),
13+ width: 80.0 ,
14+ height: 80.0 ,
15+ margin: const EdgeInsets .all (10.0 ),
16+ padding: const EdgeInsets .all (10.0 ),
17+ // color: const Color(0xfff48Fb1),
18+ alignment: Alignment .center,
19+ decoration: BoxDecoration (
20+ color: const Color (0xfff48Fb1 ),
21+ border: Border .all (width: 2.0 , color: Colors .redAccent),
22+ borderRadius: BorderRadius .circular (10.0 )
23+ ),
24+ ),
25+ ),
26+ Center (
27+ child: Container (
28+ child: Text (
29+ 'Hello World' ,
30+ style: Theme .of (context).textTheme.display1.copyWith (color: Colors .black),
31+ ),
32+ // width: 200.0,
33+ // height: 200.0,
34+ // color: Colors.green,
35+ margin: const EdgeInsets .all (30.0 ),
36+ padding: const EdgeInsets .all (10.0 ),
37+ alignment: Alignment .center,
38+ decoration: BoxDecoration (
39+ border: Border .all (width: 2.0 , color: Colors .red),
40+ color: Colors .grey,
41+ borderRadius: BorderRadius .all (Radius .circular (20.0 )),
42+ image: DecorationImage (
43+ image: NetworkImage ('http://sucimg.itc.cn/avatarimg/55d21fdc4b8d4838bef0da94ada78cab_1501139484387' ),
44+ centerSlice: Rect .fromLTRB (270.0 , 180.0 , 1360.0 , 730.0 ),
45+ // fit: BoxFit.cover
46+ )
47+ ),
48+ constraints: BoxConstraints .expand (
49+ height: Theme .of (context).textTheme.display1.fontSize * 1.1 + 200.0
50+ ),
51+ foregroundDecoration: BoxDecoration (
52+ image: DecorationImage (
53+ image: NetworkImage ('https://www.example.com/images/frame.png' ),
54+ centerSlice: Rect .fromLTRB (270.0 , 180.0 , 1360.0 , 730.0 ),
55+ )
56+ ),
57+ transform: Matrix4 .rotationZ (0.1 ),
58+ ),
59+ )
60+ ],
61+ )
62+ );
63+ }
64+ }
0 commit comments