wallpaper_manager icon indicating copy to clipboard operation
wallpaper_manager copied to clipboard

How to fully cover the wallpaper instead of stretching it

Open buckydroid opened this issue 4 years ago • 4 comments

Is there any ways to cover the wallpaper responsivly (specially on lockscreen) without stretching or squeezing the image?

buckydroid avatar Jun 24 '20 08:06 buckydroid

Is there any ways to cover the wallpaper responsivly (specially on lockscreen) without stretching or squeezing the image?

You can crop the image using WallpaperManager.setWallpaperFromFileWithCrop. Provide the left, top, right, and bottom values to match the screen of the device.

christiankyle-ching avatar Nov 06 '20 10:11 christiankyle-ching

Is there any ways to cover the wallpaper responsivly (specially on lockscreen) without stretching or squeezing the image?

You can crop the image using WallpaperManager.setWallpaperFromFileWithCrop. Provide the left, top, right, and bottom values to match the screen of the device.

I already used findRenderObject to get the screen left, right, top, bottom, and crop it but it still the same thing!

X-SLAYER avatar Dec 13 '20 12:12 X-SLAYER

@X-SLAYER

I used MediaQuery.of(context).size to get the screen width and height.

Then get the screen ratio by double screenRatio = width / height;. Use that ratio to calculate the width of the final image based on the height of the image. Because your screen size (height and width) won't match up with the image's size, so you need to adjust while maintaining the screen ratio.

christiankyle-ching avatar Dec 15 '20 01:12 christiankyle-ching

@christiankyle-ching

can u provide me ur code snippets cause I tried the same thin but still nothing happend

X-SLAYER avatar Dec 15 '20 15:12 X-SLAYER