crop images to flutter round

1. a first embodiment, the head becomes circular format

//将角度变为圆形
child:Container(
        width: 300,
        height: 300,
        decoration: BoxDecoration(
          color:Colors.yellow,
          borderRadius: BorderRadius.all(
            Radius.circular(20.0)
          ),
          image: DecorationImage(image: NetworkImage("https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=2692809760,3266574367&fm=26&gp=0.jpg"),
          fit: BoxFit.cover)
        ),
      )

2. The second way

 child: ClipOval(
          child: Image.network(
            'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=2692809760,3266574367&fm=26&gp=0.jpg',
            height: 100,
            width: 100,
            fit: BoxFit.cover
          ),
        ),

The second way which can be adapted automatically according to image size, the second recommendation

Guess you like

Origin blog.csdn.net/caorya/article/details/92796670