DEV Community

Cover image for How To Create Rounded Corners Image in Flutter - fluttercorner.com
FlutterCorner
FlutterCorner

Posted on

How To Create Rounded Corners Image in Flutter - fluttercorner.com

Hello Guys, How are you all ? hope you all are fine. In this tutorial we are going to learn How To Create Rounded Corners Image in Flutter.

There is As Simple As You can think to make image round corner. in this Tutorial we will use ClipRreact Class to give image to rounded corner, so without wasting your valuable time lets start this tutorial.

How To Create Rounded Corners Image in Flutter

First of all Import material.dart package in your app’s main.dart file.

import 'package:flutter/material.dart';
Enter fullscreen mode Exit fullscreen mode

Create Stateless widget and Define in runApp.

void main() => runApp(MyApp());
Enter fullscreen mode Exit fullscreen mode

Then we would make Scaffold widget and put a Center Widget in it. and use ClipRReact in your body.

        home: Scaffold(
        appBar: AppBar(
          title: Text("Round Corner Image - FlutterCorner"),
        ),
        body: ClipRRect()
Enter fullscreen mode Exit fullscreen mode

Now in body’s ClipRRect add child to ClipRRect and define Image in your child.

            ClipRRect(
              child: Image(),
            ),
Enter fullscreen mode Exit fullscreen mode

And After That Just borderRadius to give round corner image And Add Image that you want to use as round corner in Image class. For Demo Purpose i am using Network Image in Image Class.

           ClipRRect(
              borderRadius: BorderRadius.circular(30.0),
              child: Image(
                image: NetworkImage(
                    "https://cdn.pixabay.com/photo/2017/10/12/20/15/photoshop-2845779_960_720.jpg"),
              ),
            ),
Enter fullscreen mode Exit fullscreen mode

Here is My Full Source Code of my main.dart file that you will give more understanding.

Here Is How To Create Rounded Corners Image in Flutter

Top comments (0)