Flutter: rounded corners for images

There are different possibilities to create a rounded corner of images:

ClipRRect

ClipRRect(
  borderRadius: BorderRadius.circular(10.0),
  child: Image.network(
    'https://example.com/image.jpg',
    height: 100.0,
    width: 100.0,
  ),
),

BoxDecoration

Container(
  height: 100.0,
  width: 100.0,
  decoration: BoxDecoration(
    image: DecorationImage(
      fit: BoxFit.cover, 
      image: NetworkImage('https://example.com/image.jpg'),
    ),
    borderRadius: BorderRadius.circular(10.0),
  ),
),

Photo by Chaitanya Tvs on Unsplash

Leave a Reply

Your email address will not be published. Required fields are marked *