方法一:
Widget buildCircleImage(double size, ImageProvider provider) {
return SizedBox(
width: size,
height: size,
child: DecoratedBox(
decoration: BoxDecoration(
shape: BoxShape.circle,
image: DecorationImage(image: provider, fit: BoxFit.cover)),
),
);
}
方法二:
Widget buildCircleImage2(double size, ImageProvider provider) {
return ClipOval(
child: Image(
image: provider,
width: size,
height: size,
fit: BoxFit.cover,
));
}