// Container
class ContainerWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
// TODO: implement build
return new Container(
// 约束
constraints: BoxConstraints.expand(
height: Theme.of(context).textTheme.display1.fontSize * 1.1 + 200.0,
),
// 内边距
padding: const EdgeInsets.all(8.0),
// 背景色,color与decoration不能同时设置
// color: Colors.teal.shade700,
// 对齐
alignment: Alignment.topLeft,
// 子视图
child: Text('百度百77777777',
style: Theme.of(context)
.textTheme.display1.copyWith(color: Colors.white, fontSize: 12.0)),
// 背景装饰
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage('https://upload.jianshu.io/admin_banners/'
'web_images/4592/2cbadf9347d69cfc140daf64de887fda0e361bcc.jpg?'
'imageMogr2/auto-orient/strip|imageView2/1/w/1250/h/540'),
centerSlice: Rect.fromLTRB(270.0, 180.0, 1360.0, 730.0),
),
),
// 前景装饰
// foregroundDecoration: BoxDecoration(
// image: DecorationImage(
// image: NetworkImage('https://upload.jianshu.io/admin_banners/'
// 'web_images/4592/2cbadf9347d69cfc140daf64de887fda0e361bcc.jpg?'
// 'imageMogr2/auto-orient/strip|imageView2/1/w/1250/h/540'),
// centerSlice: Rect.fromLTRB(270.0, 180.0, 1360.0, 730.0),
// ),
// ),
// 旋转
// transform: Matrix4.rotationZ(-0.5),
);
}
}
效果: