Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to fully cover the wallpaper instead of stretching it #12

Open
buckydroid opened this issue Jun 24, 2020 · 4 comments
Open

How to fully cover the wallpaper instead of stretching it #12

buckydroid opened this issue Jun 24, 2020 · 4 comments

Comments

@buckydroid
Copy link

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

@christiankyle-ching
Copy link

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.

@X-SLAYER
Copy link

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!

@christiankyle-ching
Copy link

@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.

@X-SLAYER
Copy link

@christiankyle-ching

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants