Flutter 容器(4) - Container
Container 类似于HTML中的div标签
import 'package:flutter/material.dart';
class AuthList extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('代码测试'),
centerTitle: true,
),
body: Container(
alignment: Alignment.bottomCenter,
decoration: BoxDecoration(
border: Border.all(color: Colors.blue, width: 2.0),
image: DecorationImage(
image: NetworkImage(
'https://bbs.qn.img-space.com/201910/6/85833b8012b9e0a626961e844f531c3d.jpg?imageView2/2/w/1024/q/75/ignore-error/1//'),
fit: BoxFit.fill),
borderRadius: BorderRadius.all(Radius.circular(10.0))),
width: 300.0,
height: 150.0,
padding: EdgeInsets.all(30.0),
margin: EdgeInsets.all(50.0),
constraints: BoxConstraints.expand(width: 200.0, height: 150.0),
child: Text(
'Container demo',
style: TextStyle(color: Colors.deepOrange),
),
),
);
}
}
Keep learning