Flutter Network Image does not fit in Circular Avatar

后端 未结 23 1169
走了就别回头了
走了就别回头了 2020-12-29 02:06

I am trying to retrieve bunch of images from an api. I want the images to be displayed in Circular form so I am using CircleAvatar Widget, but I keep getting im

23条回答
  •  旧巷少年郎
    2020-12-29 02:47

    Here is a round picture with a shadow:

    child: AspectRatio(
        aspectRatio: 1/1,
        child: Container(
            margin: EdgeInsets.all(
                10.0
            ),
            decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(100.0),
                boxShadow:[
                  BoxShadow(
                      color: Color.fromARGB(60, 0, 0, 0),
                      blurRadius: 5.0,
                      offset: Offset(5.0, 5.0)
                  )
                ],
                image: DecorationImage(
                    fit: BoxFit.cover,
                    image: NetworkImage(user.image)
                )
            )
        )
    )
    

提交回复
热议问题