パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v1.0.10

wallpaper_manager

Androidデバイス上のホーム画面、ロック画面(または両方)の壁紙を変更するためのFlutterプラグインです。

30日間ダウンロード
83
いいね数
103
Pub ポイント
40

パッケージをインストール

flutter pub add wallpaper_manager

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

Wallpaper Manager は、Android デバイス上でホーム画面、ロック画面、または両方の壁紙をプログラムで設定できる Flutter プラグインです。このプラグインは、Flutter アプリ内から画像を直接壁紙として適用するための簡単なインターフェースを提供し、写真やカスタマイズアプリにおけるユーザー体験を向上させます。プラグインはネイティブな Android API を活用しており、現在は Android のみをサポートしており、iOS の実装はありません。適切な権限が必要であり、パーソナライズ、画像ギャラリー、デジタルアート表示に焦点を当てたアプリに統合すると最適に機能します。

用途

  • アプリコンテンツからダイナミックな壁紙を設定する
  • 壁紙機能付きの写真ギャラリー アプリを作成する
  • ライフスタイルアプリでのユーザーカスタマイズの有効化
  • デジタルアートプラットフォームにおける壁紙変更の統合

主な機能

  • ホーム画面の壁紙を設定する
  • ロック画面の壁紙を設定する
  • 両画面の同時サポート
  • Flutter とのシンプルな API 統合
  • ネイティブな Android ベルト API を使用

適している対象

  • Android専用のアプリで壁紙の変更が必要なもの
  • 写真とアート共有アプリケーション
  • ユーザーのパーソナライズツール
  • ダイナミックな背景テーマを持つアプリ

注意事項

  • Androidデバイス専用
  • 実行時権限のリクエストが必要です
  • Androidのウォールペーパーシステムに限定
  • iOS をサポートしていません
  • 画像の解像度および形式の処理が必要になる可能性があります

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

wallpaper_manager

Wallpaper Manager

A Flutter plugin for changing the Home Screen, Lock Screen (or both) Wallpaper(s) on Android devices.

Pub

Usage

Installation

In the pubspec.yaml of your flutter project, add the following dependency:

dependencies:
  ...
  wallpaper_manager: "^1.0.10"

In your library add the following import:

import 'package:wallpaper_manager/wallpaper_manager.dart';
Example
Basic Usage

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;
final String result = await WallpaperManager.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 = await WallpaperManager.setWallpaperFromFile(path, location);
} on PlatformException {
  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 = await DefaultCacheManager().getSingleFile(url);
final String result = await WallpaperManager.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

dependencies:
  ...
  flutter:
    ...
    assets:
    - assets/tmp1.jpeg

And in dart code

String assetPath = "assets/tmp1.jpg";
int location = WallpaperManager.HOME_SCREEN; // or location = WallpaperManager.LOCK_SCREEN;
String result;
final String result = await WallpaperManager.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.

Known Issues

Todos

  • [ ] Write tests
  • [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.

カテゴリー

ソースリポジトリ

このパッケージを使用しているプロジェクト