DEV Community

Cover image for How to Set Network Image In Circular Avatar In Flutter? fluttercorner.com
FlutterCorner
FlutterCorner

Posted on

1

How to Set Network Image In Circular Avatar In Flutter? fluttercorner.com

Hello guys how are you all? Hope you all are fine. In Today’s tutorial, we are going to learn How to set Network Image In Circular Avatar In Flutter?

when we are trying to get Images from API and we have to use an image from api into round corner or circleavatar in a flutter.

Here we have define Different method for Circular Avatar.

How to Set Network Image In Circular Avatar In Flutter ?

Example 1 CircleAvatar With Network Image

To use CircleAvatar we need to define our Network OR Asset Image in backgroundImage property.
also, give radius that will our image radius.
For example like below. [ Image source unsplash.com ].

        CircleAvatar(
            radius: 120.0,
            backgroundImage: NetworkImage(
                "https://images.unsplash.com/photo-1597466765990-64ad1c35dafc"),
          ),
Enter fullscreen mode Exit fullscreen mode

Our Output will be like Below, As Shown in my blog at here How to Set Network Image In Circular Avatar In Flutter?

Example 2 CircleAvatar with border in Flutter

Here is we are going to give Border to our CircleAvtar image.
Here’s the code to create a Circular avatar with a border,

          child: CircleAvatar(
            radius: 130,
            backgroundColor: Colors.red,
            child: CircleAvatar(
              radius: 120,
              backgroundImage: NetworkImage(
                  'https://images.unsplash.com/photo-1597466765990-64ad1c35dafc'),
            ),
          ),
        ),
Enter fullscreen mode Exit fullscreen mode

More Two Example With images at here How to Set Network Image In Circular Avatar In Flutter?

Jetbrains image

Don’t Become a Data Breach Headline

57% of organizations have suffered from a security incident related to DevOps toolchain exposures. Is your CI/CD protected? Check out these nine practical tips to keep your CI/CD secure—without adding friction.

Learn more

Top comments (0)

Jetbrains image

Build Secure, Ship Fast

Discover best practices to secure CI/CD without slowing down your pipeline.

Read more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay