[Flutter/dart]Crop the image into an oval
Overview
When displaying an image on a smartphone app, I think that the original image is often cropped and displayed.
If you want to crop in a circle, you use CircleAvator, but if the original image is vertically long, you may want to crop it in an oval shape. I will explain how to do it.
Method
Use ClipOval.
Widget _myImg(){
return ClipOval(
child: Image.asset('image/rect.png',),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: Column(
children: [
Center(
child: _myImg()
)
],
),
);
}
original image:
this becomes like below.
Recent Posts
See AllWhat want to do I want to create an input form using TextField. For example, if the input content is a monetary amount, I would like to...
What want to do There is a variable that remain unchanged once the initial value is determined. However, it cannot be determined yet when...
What want to do As the title suggests. Place two widgets in one line on the screen One in the center of the screen and the other on the...
コメント