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

パッケージ詳細v3.7.0

async_wallpaper

Androidで非同期に壁紙を設定します。また、動画ライブ壁紙もサポートしています。

Android
30日間ダウンロード
2440
いいね数
91
Pub ポイント
160

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

flutter pub add async_wallpaper

パッケージ概要

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

Androidデバイスでウォールペーパーを非同期に設定できるFlutterパッケージであり、動画ライブウォールペーパーのサポートも含まれます。UIスレッドをブロッキングせずに、Flutterアプリ内でウォールペーパーを変更するための簡単かつ効率的な方法を提供します。このパッケージはAndroid専用に設計されており、ネイティブなAndroid APIとシームレスに統合されています。開発者は、動的なウォールペーパーカスタマイズオプションを提供することで、ユーザー体験を向上させることができます。ソースコードはGitHub上で公開されており、透明性と貢献を促進しています。

用途

  • アプリから静的壁紙を設定する
  • 動画ライブ壁紙の作成
  • パーソナライズ機能の強化
  • 背景の壁紙の更新
  • 写真ギャラリーアプリとの統合

主な機能

  • 非同期の壁紙設定
  • 動画ライブ壁紙のサポート
  • Android専用のプラットフォーム互換性
  • シンプルな API インテグレーション
  • ブロッキングしないUI操作

適している対象

  • Androidアプリ開発者
  • 壁紙カスタマイズアプリ
  • 写真およびメディアアプリ
  • ユーザーエクスペリエンス向上プロジェクト
  • 動的な背景変更を必要とするアプリ

注意事項

  • Android プラットフォームに限定
  • 実行時権限が必要です
  • 動画ウォールペーパーのサポートは、デバイスの機能に依存します
  • すべての Android バージョンで動作しない可能性があります
  • 動画ウォールペーパーによるバッテリーへの影響の可能性

元の README

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

async_wallpaper

pub package

Flutter plugin to set wallpapers on Android and save them to Photos on iOS.

  • Static wallpaper from a URL, file path, content URI, or bytes
  • Home, lock, or both targets, with a separate result for each
  • Video and OpenGL live wallpapers
  • Scheduled wallpaper rotation
  • Capability checks before you show an action

Screenshots

Static wallpaper Capabilities More APIs iOS

Video live wallpaper: home screen before, the system preview, and the applied video.

Scale modes: centerCrop, fitCenter, center, fill, and stretch on a 1080x2400 phone.

Requirements

  • Flutter >=3.41.4, Dart >=3.9.0
  • Android minSdk 24
  • iOS 13.0+ (download only)

Installation

dependencies:
  async_wallpaper: ^3.3.0
import 'package:async_wallpaper/async_wallpaper.dart';

Usage

Check capabilities
final c = await AsyncWallpaper.getCapabilities();
if (c.supportsStaticWallpaper && c.canSetWallpaper) {
  // Show the action.
}
Static wallpaper
final result = await AsyncWallpaper.applyWallpaper(
  const StaticWallpaperRequest(
    source: WallpaperSource.url('https://example.com/wallpaper.jpg'),
    target: WallpaperTarget.both,
    scaleMode: WallpaperScaleMode.centerCrop,
    strategy: WallpaperApplyStrategy.direct,
  ),
);
if (result.status == WallpaperOperationStatus.applied) {
  // For `both`, read `result.home` and `result.lock`.
}

Sources: WallpaperSource.url (HTTPS), filePath, contentUri, bytes.

Video live wallpaper
final req = VideoWallpaperRequest(
  source: WallpaperSource.filePath('/storage/emulated/0/Download/loop.mp4'),
  target: WallpaperTarget.home,
);
final prepared = await AsyncWallpaper.setVideoWallpaper(req);
if (prepared.status == WallpaperOperationStatus.awaitingUserConfirmation) {
  await AsyncWallpaper.openLiveWallpaperPreview(req);
}

previewOpened means the system preview opened, not that the user applied it.

OpenGL live wallpaper

Check supportsOpenGlLiveWallpaper first, then call setOpenGlLiveWallpaper with a GLSL ES 1.00 fragment shader (1-60 FPS).

Wallpaper rotation
await AsyncWallpaper.startWallpaperRotation(
  const WallpaperRotationRequest(
    sources: <WallpaperRotationSource>[
      WallpaperRotationSource(sourceType: WallpaperSourceType.url, source: 'https://example.com/1.jpg'),
      WallpaperRotationSource(sourceType: WallpaperSourceType.file, source: '/storage/emulated/0/Download/2.jpg'),
    ],
    target: WallpaperTarget.both,
    intervalMinutes: 60,
    order: WallpaperRotationOrder.shuffle,
    triggers: <WallpaperRotationTrigger>{
      WallpaperRotationTrigger.interval,
      WallpaperRotationTrigger.charging,
      WallpaperRotationTrigger.timeOfDay,
    },
    activeHoursStart: 6,
    activeHoursEnd: 23,
  ),
);
await AsyncWallpaper.getWallpaperRotationStatus();
await AsyncWallpaper.rotateWallpaperNow();
await AsyncWallpaper.stopWallpaperRotation();

The minimum interval is 15 minutes. URLs must be HTTPS. Rotation uses WorkManager and needs no foreground service.

Download
await AsyncWallpaper.downloadWallpaper(
  const DownloadWallpaperRequest(url: 'https://example.com/wallpaper.jpg'),
);
  • iOS: add NSPhotoLibraryAddUsageDescription to Info.plist.
  • Android 9 and older: declare WRITE_EXTERNAL_STORAGE with android:maxSdkVersion="28" and request it before you call downloadWallpaper.

Platform support

Android iOS Web/desktop
Static, live, OpenGL, rotation Yes unsupported unsupported
Download Yes Yes unsupported
  • Background work (for example WorkManager): use WallpaperApplyStrategy.direct. The cropper, picker, and live previews need a foreground Activity and return foregroundRequired otherwise.
  • The plugin shows no toasts and does not navigate. Your app shows its own UI from the result.

Docs

Contributing

Report bugs with the bug report template and include the device model, Android version, and steps to reproduce. Request features with the feature request template. Read CONTRIBUTING.md before you open a PR.

License

MIT

カテゴリー

ソースリポジトリ

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