flutter 我如何框适合一个图像网络在一个容器有边界半径

yyyllmsg  于 2023-02-05  发布在  Flutter
关注(0)|答案(4)|浏览(129)

我怎样用一个边界半径把一个图像网络框入容器

Container(
    width: 100,
    height: 100,
    child: Image.network(
      snapshot.data!,
      fit: BoxFit.cover,
    ),
),
wfveoks0

wfveoks01#

当您使用Container覆盖clipBehavior并调用decoration

Container(
  width: 100,
  height: 100,
  clipBehavior: Clip.hardEdge, //default is none
  decoration: BoxDecoration(
    borderRadius: BorderRadius.circular(12.0),
  ),
  child: Image.network(
    "",
    fit: BoxFit.cover,
  ),
),
lo8azlld

lo8azlld2#

ClipRRect(
    borderRadius: BorderRadius.circular(8.0),
    child: Container(
        height: 100.0,
        width: 100.0,
        child: Image.network(
        subject['images']['large'],
        height: 100.0,
        width: 100.0,
    ),)
)
niwlg2el

niwlg2el3#

Container(
    width: 100,
    height: 100,
    child: Image.network(
      snapshot.data!,
      fit: BoxFit.cover,
      width: 100,
      height: 100,
    ),
),
huwehgph

huwehgph4#

Container(
          decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(10)),
          width: 100,
          height: 100,
          child: Image.network(
          snapshot.data!,
          fit: BoxFit.cover,
          ),),

相关问题