Wallpaper Manager는 Android 기기에서 홈 화면, 잠금 화면 또는 둘 다의 배경화면을 프로그래밍 방식으로 설정할 수 있는 Flutter 플러그인입니다. 이 플러그인은 Flutter 앱 내에서 이미지를 직접 배경화면으로 적용할 수 있는 간단한 인터페이스를 제공하여 사진 또는 커스터마이징 앱의 사용자 경험을 향상시킵니다. 플러그인은 네이티브 Android API를 활용하며 현재는 Android 전용이며 iOS 구현은 없습니다. 적절한 권한이 필요하며, 개인화, 이미지 갤러리 또는 디지털 아트 전시에 중점을 둔 앱에 통합할 때 가장 잘 작동합니다.
사용 사례
앱 콘텐츠에서 동적 배경화면 설정
배경화면 기능을 갖춘 사진 갤러리 앱 만들기
라이프스타일 앱에서 사용자 맞춤 설정 활성화
디지털 아트 플랫폼에서 배경화면 변경 통합
주요 기능
홈 화면 배경화면 설정
잠금 화면 배경화면 설정
두 화면을 동시에 지원
Flutter와의 간단한 API 통합
네이티브 안드로이드 벽지 API 사용
적합한 대상
워크플레이스 변경이 필요한 안드로이드 전용 앱
사진 및 예술 공유 애플리케이션
사용자 맞춤형 도구
동적 배경 테마를 가진 앱
고려 사항
안드로이드 기기에서만 사용 가능
런타임 권한 요청이 필요합니다
Android의 배경화면 시스템에 제한됨
iOS를 지원하지 않습니다
이미지 해상도 및 형식 처리가 필요할 수 있습니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
wallpaper_manager
A Flutter plugin for changing the Home Screen, Lock Screen (or both) Wallpaper(s) on Android devices.
Usage
Installation
In the pubspec.yaml of your flutter project, add the following dependency:
Since this is not a Widget, you have to create WallpaperManager constructors from inside an async function, which is a Future that returns a String output specifying success/failure.
String path = "/path/to/file/on/disk";
int location = WallpaperManager.HOME_SCREEN; // or location = WallpaperManager.LOCK_SCREEN;finalString result = awaitWallpaperManager.setWallpaperFromFile(path, location);
Basic Usage with error handling
You might want to wrap it in a try/catch since platform messages (plug-ins like these) may fail
String path = "/path/to/file/on/disk";
int location = WallpaperManager.HOME_SCREEN; // or location = WallpaperManager.LOCK_SCREEN;String result;
try {
result = awaitWallpaperManager.setWallpaperFromFile(path, location);
} onPlatformException {
result = 'Failed to get wallpaper.';
}
Loading from a URL (with CacheManager, the image is saved to app files as well)
If you're loading a Wallpaper from a URL, you should save it to the disk first, then use the path of the saved image file.
Add flutter_cache_manager or any other dependency you'd like:
dependencies:...flutter_cache_manager:"^1.1.3"
And in dart code
String url = "";
int location = WallpaperManager.HOME_SCREEN; // or location = WallpaperManager.LOCK_SCREEN;String result;
var file = awaitDefaultCacheManager().getSingleFile(url);
finalString result = awaitWallpaperManager.setWallpaperFromFile(file.path, location);
Loading from a Flutter asset
If you're loading a Wallpaper from an asset, you need to make sure it is indexed in the pubspec.yaml file first
String assetPath = "assets/tmp1.jpg";
int location = WallpaperManager.HOME_SCREEN; // or location = WallpaperManager.LOCK_SCREEN;String result;
finalString result = awaitWallpaperManager.setWallpaperFromAsset(assetPath, location);
Getting started
With Wallpaper Manager
See the example directory for a complete sample app using Wallpaper Manager.
With Flutter
For help getting started with Flutter, view the online documentation.
Notes
iOS does not support changing Wallpapers from third-party apps (Source)
Xiaomi/MIUI does not support changing Lock Screen Wallpapers directly from the Android API (Source). You might want to look at creating a Lock Screen Launcher app instead.
[x] Add rect values for optionally cropping the image
[ ] Add variable for re-using Wallpaper from phone's settings
[ ] Write more tests
Changelog
Please see the Changelog page to know what's recently changed.
Contributions
Feel free to contribute to this project.
If you find a bug or want a feature, but don't know how to fix/implement it, please fill an issue.
If you fixed a bug or implemented a feature, please send a pull request.