Container
圆角
Container(
margin: EdgeInsets.all(15.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5),
color: Colors.white,
image: DecorationImage(
image: AssetImage("images/bg.jpg"),
fit: BoxFit.cover,
),
),
child: Text('dadas')
)
按钮
shape(可以绘制为矩形、圆形或圆形的框边框的基类)
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
BeveledRectangleBorder 顶端斜角
BoxBorder
CircleBorder 圆形
InputBorder
RoundedRectangleBorder 顶端圆角
StadiumBorder 体育场型
图片
圆形图片/圆角图片
// 1、CircleAvatar
CircleAvatar(
//头像半径
radius: 60,
//头像图片 -> NetworkImage网络图片,AssetImage项目资源包图片, FileImage本地存储图片
backgroundImage: NetworkImage(
'https://pic2.zhimg.com/v2-639b49f2f6578eabddc458b84eb3c6a1.jpg'
),
)
//2、ClipOval
ClipOval(
child: Image.network(
'https://pic2.zhimg.com/v2-639b49f2f6578eabddc458b84eb3c6a1.jpg',
width: 120,
height: 120,
fit: BoxFit.cover,
),
)
//3、Container + BoxDecoration
Container(
width: 120,
height: 120,
decoration: BoxDecoration(
shape: BoxShape.circle,
image: DecorationImage(
image: NetworkImage('https://pic2.zhimg.com/v2-639b49f2f6578eabddc458b84eb3c6a1.jpg'),
fit: BoxFit.cover
)
)
)