How can I resize image in pub package "flutter_native_splash"?
Asked Answered
K

4

9

I am using flutter_native_splash 1.3.1 package to add splash screen to the app.

The image size is getting displayed bigger than the desired size on the splash screen. What is right approach to decrease the size of the image on the splash screen?

Karen answered 10/11, 2021 at 2:21 Comment(0)
M
3

I was having issues with this. I tried a lot of different suggestions from stackoverflow, but nothing worked. I eventually just added padding within the image around the logo I wanted to display. So the logo was about 1/3 of the image, centered in the middle and then used center for gravity

<bitmap android:gravity="center" android:src="@drawable/splash" />

The images are all called splash.png.

The images sizes were all squares and had the dimensions:

hdpi 192X192, 
xhdpi 288X288, 
xxhdpi 384X384, 
xxxhdpi 1024X1024
Maley answered 23/9, 2022 at 19:22 Comment(1)
Where is this line of code placed?Vharat
N
1

Unfortunately, I don't think you can do it. So the option is to resize your image to fit your screen. You can read about the resolution in this topic https://github.com/jonbhanson/flutter_native_splash/issues/89

Newsmagazine answered 10/11, 2021 at 3:48 Comment(0)
C
0

It is stated in the documentation that the image will be stretched to fit the screen. I think the best solution is to make your image with an aspect ratio of 9x16 (portrait) so the proportions stay the same.

Cur answered 10/11, 2021 at 4:2 Comment(0)
T
0

As mentioned in the documentation:

image parameter: By default, the launcher icon is used:

  1. App icon without an icon background, as shown on the left: This should be 1152×1152 pixels, and fit within a circle 768 pixels in diameter.
  2. App icon with an icon background, as shown on the right: This should be 960×960 pixels, and fit within a circle 640 pixels in diameter.
Tuberose answered 9/4 at 5:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.