In this instructional exercise, we will figure out how to show an Image with adjusted corners in Flutter application.
You can get adjusted corners for an Image gadget by enclosing it by a ClipRRect gadget.
Flutter rounded corners container
Following is a fast example code scrap you can use for wrapping Image gadget in a ClipRRect for adjusted corners.
ClipRRect(
borderRadius: BorderRadius.circular(30.0),
child: Image.network('https://images.pexels.com/photos/2931915/pexels-photo-2931915.jpeg'),
)
You may change the borderRadius an incentive for various radii at corners.
Example: Image with Rounded Corners in Flutter
This is a model Flutter application where we show a picture with adjusted corners.
To reproduce this model, make an essential Flutter application and supplant main.dart with the accompanying code.
import 'package:flutter/material.dart';
void main() {
runApp(MaterialApp(
home: MyApp(),
));
}
class MyApp extends StatefulWidget {
@override
_State createState() => _State();
}
class _State extends State<MyApp> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Flutter Tutorial - exerror.com'),
),
body: Center(
child: Column(children: <Widget>[
ClipRRect(
child: Padding(
padding: EdgeInsets.all(30),
child: ClipRRect(
borderRadius: BorderRadius.circular(30.0),
child: Image.network(
'https://images.pexels.com/photos/2931915/pexels-photo-2931915.jpeg'),
),
),
),
]),
),
);
}
}
Here s My main.dart output

Flutter circle avatar image
Method 2 : Use ClipRRect
it will work perfectly.
Use ClipRRect
it will work perfectly.
ClipRRect(
borderRadius: BorderRadius.circular(8.0),
child: Image.network(
subject['images']['large'],
height: 150.0,
width: 100.0,
),
)
Method 3 : use CircleAvatar
CircleAvatar(
radius: 20,
backgroundImage: NetworkImage('https://via.placeholder.com/140x100')
)
Method 4 : Using ClipRRect
Using ClipRRect
you need to hardcode BorderRadius
, so if you need complete circular stuff, use ClipOval
instead.
ClipOval(
child: Image.network(
"image_url",
height: 100,
width: 100,
fit: BoxFit.cover,
),
),
Method 5 : use Container BoxDecoration
Try this instead, worked for me:
Container(
width: 100.0,
height: 150.0,
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.cover, image: NetworkImage('Path to your image')),
borderRadius: BorderRadius.all(Radius.circular(8.0)),
color: Colors.redAccent,
),
),
Method 6 : Using Container
Container(
width: 48.0,
height: 48.0,
decoration: new BoxDecoration(
shape: BoxShape.circle,
image: new DecorationImage(
fit: BoxFit.fill,
image: NetworkImage("path to your image")
)
)),
Method 7
For image use this
ClipOval(
child: Image.network(
'https://url to your image',
fit: BoxFit.fill,
),
);
While for Asset Image use this
ClipOval(
child: Image.asset(
'Path to your image',
fit: BoxFit.cover,
),
)
Method 8 : Using Inkwell
With new version of flutter and material theme u need to use the “Padding” widgett too in order to have an image that doesn’t fill its container.
For example if you want to insert a rounded image in the AppBar u must use padding or your image will always be as high as the AppBar.
Hope this will help someone
InkWell(
onTap: () {
print ('Click Profile Pic');
},
child: Padding(
padding: const EdgeInsets.all(8.0),
child: ClipOval(
child: Image.asset(
'assets/images/profile1.jpg',
),
),
),
),
Method 9 : using ClipRRect
Use ClipRRect with set image property of fit: BoxFit.fill
ClipRRect(
borderRadius: new BorderRadius.circular(10.0),
child: Image(
fit: BoxFit.fill,
image: AssetImage('images/image.png'),
width: 100.0,
height: 100.0,
),
),
Method 10 : user decoration Image for a container.
@override
Widget build(BuildContext context) {
final alucard = Container(
decoration: new BoxDecoration(
borderRadius: BorderRadius.circular(10),
image: new DecorationImage(
image: new AssetImage("images/logo.png"),
fit: BoxFit.fill,
)
)
);
Method 11 : Try This it works well.
Try This it works well.
Container(
height: 220.0,
width: double.infinity,
decoration: BoxDecoration(
borderRadius: new BorderRadius.only(
topLeft: Radius.circular(10),
topRight: Radius.circular(10),
),
image: DecorationImage(
fit: BoxFit.fill,
image: NetworkImage(
photoUrl,
),
),
),
);
Method 12
Use this Way in this circle image is also working + you have preloader also for network image:
new ClipRRect(
borderRadius: new BorderRadius.circular(30.0),
child: FadeInImage.assetNetwork(
placeholder:'asset/loader.gif',
image: 'Your Image Path',
),
)
Summery
So it’s all About All possible solutions. Hope this above all solution helped you a lot. Comment below Your thoughts and your queries. Comment Below on your suggestion.
Check Out Below Article
TypeError: this.getOptions is not a function in vue.js
exerror.com specifically for sharing programming issues and examples. We’ll be sharing some chunks of codes of PHP, Laravel Framework, CSS3, HTML5, MYSQL, Bootstrap, CodeIgniter Framework, JQuery, Javascript, Server, Ionic Framework, Python, flutter, macOS, Angular, etc Programming Language. On our site, I am sure you will find something good solution and a fine example of topics of PHP, Laravel Framework, CSS3, HTML5, MYSQL, Bootstrap, CodeIgniter Framework, JQuery, Javascript, Server, Ionic Framework, Python, flutter, macOS, Angular, etc Programming Language.