Create Circle Image in Flutter

In most UI/UX you will see image getting displayed in a circular shape. In this post, we are going to create a circle image in a Flutter app.

Below is how to create a circle image downloading from an URL. You can change it to other image sources such as Image.asset or Image.file.

class HomePage extends StatefulWidget {
  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: MainAppBar(title: 'Home'),
      backgroundColor: Colors.white,
      body: SafeArea(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            Row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                Container(
                  decoration:
                      BoxDecoration(color: Colors.blue, shape: BoxShape.circle),
                  height: 300,
                  width: 300,
                  child: ClipOval(
                    child: Image.network(
                        "https://cdn.pixabay.com/photo/2018/10/04/11/31/river-3723439_960_720.jpg", fit: BoxFit.fitHeight,),
                  ),
                ),
              ],
            )
          ],
        ),
      ),
    );
  }
}

Leave a Comment

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

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close