Alexei
Alexei

Reputation: 15664

Image with different dimensions?

android studio 3.6

In android app I use one image with different dimensions. I put image in the next folders:

drawable-hdpi, drawable-mdpi, drawable-xhdpi, drawable-xxhdpi, drawable-xxxhdpi

Nice. It's work fine.

Now what about flutter app. Is I also need to create different folders for every image's dimension?

P.S. I need this image for android and iOS version

Upvotes: 0

Views: 213

Answers (2)

Midhun MP
Midhun MP

Reputation: 107131

As mentioned in the Declaring resolution-aware image assets. You can create folders based on the resolution and add images to it.

Resolution Aware Image Loading

The main asset is assumed to correspond to a resolution of 1.0. For example, consider the following asset layout for an image named my_icon.png:

.../my_icon.png
.../2.0x/my_icon.png
.../3.0x/my_icon.png

On devices with a device pixel ratio of 1.8, the asset .../2.0x/my_icon.png would be chosen. For a device pixel ratio of 2.7, the asset .../3.0x/my_icon.png would be chosen.

Reference Assets and Images

Upvotes: 1

Arun Yogeshwaran
Arun Yogeshwaran

Reputation: 451

For an Android App created using Flutter, You can still use these folders as shown below for varying screen densities

enter image description here

Upvotes: 0

Related Questions