Container

圆角

  1. Container(
  2. margin: EdgeInsets.all(15.0),
  3. decoration: BoxDecoration(
  4. borderRadius: BorderRadius.circular(5),
  5. color: Colors.white,
  6. image: DecorationImage(
  7. image: AssetImage("images/bg.jpg"),
  8. fit: BoxFit.cover,
  9. ),
  10. ),
  11. child: Text('dadas')
  12. )

按钮

shape(可以绘制为矩形、圆形或圆形的框边框的基类)

  1. shape: RoundedRectangleBorder(
  2. borderRadius: BorderRadius.circular(10),
  3. ),
  4. BeveledRectangleBorder 顶端斜角
  5. BoxBorder
  6. CircleBorder 圆形
  7. InputBorder
  8. RoundedRectangleBorder 顶端圆角
  9. StadiumBorder 体育场型

图片

圆形图片/圆角图片

  1. // 1、CircleAvatar
  2. CircleAvatar(
  3. //头像半径
  4. radius: 60,
  5. //头像图片 -> NetworkImage网络图片,AssetImage项目资源包图片, FileImage本地存储图片
  6. backgroundImage: NetworkImage(
  7. 'https://pic2.zhimg.com/v2-639b49f2f6578eabddc458b84eb3c6a1.jpg'
  8. ),
  9. )
  10. //2、ClipOval
  11. ClipOval(
  12. child: Image.network(
  13. 'https://pic2.zhimg.com/v2-639b49f2f6578eabddc458b84eb3c6a1.jpg',
  14. width: 120,
  15. height: 120,
  16. fit: BoxFit.cover,
  17. ),
  18. )
  19. //3、Container + BoxDecoration
  20. Container(
  21. width: 120,
  22. height: 120,
  23. decoration: BoxDecoration(
  24. shape: BoxShape.circle,
  25. image: DecorationImage(
  26. image: NetworkImage('https://pic2.zhimg.com/v2-639b49f2f6578eabddc458b84eb3c6a1.jpg'),
  27. fit: BoxFit.cover
  28. )
  29. )
  30. )