simo9900
simo9900

Reputation: 133

resizing dynamically a CachedNetworkImage image in flutter

I want to display dynamically an image from internet in flutter according to its size

CachedNetworkImage(
                                fit: if (width >height)  {BoxFit.fitWidth}else{BoxFit.fitHeight},

                                imageUrl: "url",

                                placeholder: (context, url) =>
                                    CupertinoActivityIndicator(),
                                errorWidget: (context, url, error) =>
                                    Icon(Icons.error),
                              )

I want to have width and the height of the image so I can define which fit I want to use thanks

Upvotes: 0

Views: 1962

Answers (1)

ChessMax
ChessMax

Reputation: 2265

Maybe you just need BoxFit.contain?

Upvotes: 1

Related Questions