पैकेज, रिपॉज़िटरी और ऐप श्रेणियाँ खोजें

पैकेज विवरणv1.2.0

wallpaper

प्लगइन का उद्देश्य URL से वॉलपेपर सेट करना है। केवल Android के लिए समर्थित है। आंतरिक रूप से वॉलपेपर मैनेजर का उपयोग करके वॉलपेपर सेट किया जाता है।

Android
30-दिन डाउनलोड
575
लाइक
52
Pub अंक
160

पैकेज इंस्टॉल करें

flutter pub add wallpaper

पैकेज अवलोकन

सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।

वॉलपेपर पैकेज एंड्रॉइड डिवाइस पर URL का उपयोग करके वॉलपेपर सेट करने की अनुमति देता है। यह आंतरिक रूप से एंड्रॉइड वॉलपेपर मैनेजर API का उपयोग करता है ताकि वेब URL से छवियों को वॉलपेपर के रूप में लागू किया जा सके। एंड्रॉइड के लिए विशेष रूप से डिज़ाइन किया गया, यह iOS का समर्थन नहीं करता है। प्लगइन को आसानी से एकीकृत किया जा सकता है और ऐप्स के लिए उपयोगी है जो उपयोगकर्ताओं को डायनामिक या उपयोगकर्ता-चयनित छवियों के साथ अपने डिवाइस के होम स्क्रीन को कस्टमाइज़ करने की अनुमति देते हैं। इसमें उपयुक्त अनुमतियां आवश्यक हैं और एंड्रॉइड के लिए लक्षित फ्लटर एप्लिकेशन में चिकनी तरीके से काम करता है।

उपयोग

  • URL से डायनामिक वॉलपेपर सेट करें
  • एप्स में डिवाइस होम स्क्रीन को कस्टमाइज़ करना
  • उपयोगकर्ता वॉलपेपर चयन सक्षम करना
  • वॉलपेपर अद्यतन को स्वचालित करना
  • चित्र-आधारित थीम को एकीकृत करना

मुख्य विशेषताएँ

  • URL से वॉलपेपर सेट करें
  • मूल वॉलपेपर मैनेजर API का उपयोग करता है
  • Android-केवल समर्थन
  • Flutter के साथ सरल एकीकरण
  • रिमोट छवि स्रोत का समर्थन करता है

इनके लिए उपयुक्त

  • Android ऐप विकासकर्ता
  • वॉलपेपर कस्टमाइजेशन फीचर्स
  • डायनामिक थीम विकल्प वाले ऐप्स
  • चित्र-आधारित उपयोगकर्ता अनुभव
  • उपकरण-स्तरीय बदलाव की आवश्यकता वाले मोबाइल ऐप्स

विचार योग्य बातें

  • केवल Android पर काम करता है
  • रनटाइम अनुमति की आवश्यकता है
  • Android के WallpaperManager तक सीमित
  • बड़े या समर्थित नहीं चित्र प्रारूपों के साथ विफल हो सकता है
  • iOS प्लेटफ़ॉर्म का समर्थन नहीं करता है

मूल README

संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।

Wallpaper

A Flutter plugin that allows you to download an image from a URL and set it as wallpaper on Android.

The plugin supports setting wallpapers for:

  • Home screen
  • Lock screen
  • Both screens
  • System wallpaper

Features

  • Download image from URL
  • Track download progress
  • Set wallpaper for home screen
  • Set wallpaper for lock screen
  • Set wallpaper for both screens
  • Set system wallpaper
  • Resize images before setting wallpaper
  • Use modern opt-in fit modes for source-based wallpapers
  • Read the platform-recommended wallpaper size
  • Open the Android system wallpaper chooser

Installation

Add the plugin to your pubspec.yaml:

dependencies:
  wallpaper: ^1.2.0

Then run:

flutter pub get

Android Configuration

The plugin manifest already declares the permissions it needs for downloading network images and setting wallpapers:

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.SET_WALLPAPER"/>

Downloaded images are stored in app-private cache, files, or external files directories depending on DownloadLocation. Apps using the default workflow do not need READ_EXTERNAL_STORAGE or WRITE_EXTERNAL_STORAGE, and they do not need to add their own file_paths.xml.


Usage

Import the plugin:

import 'package:wallpaper/wallpaper.dart';

Recommended Wallpaper Size

Use the recommended size when choosing, generating, cropping, or downloading an image for the current Android launcher:

final size = await Wallpaper.recommendedWallpaperSize();
print('${size.width} x ${size.height}');

Open Wallpaper Chooser

Open Android's built-in wallpaper chooser without passing a specific image:

await Wallpaper.openWallpaperChooser();

Download Image

final stream = Wallpaper.imageDownloadProgress(
  imageUrl,
  location: DownloadLocation.applicationDirectory,
);

stream.listen((progress) {
  print(progress);
});

Typed Download Operation

Use download when you need typed progress, headers, timeouts, cache reuse, or cancellation:

final operation = Wallpaper.download(
  imageUrl,
  options: const WallpaperDownloadOptions(
    imageName: 'daily_wallpaper',
    headers: {'Authorization': 'Bearer token'},
    connectTimeout: Duration(seconds: 15),
    receiveTimeout: Duration(seconds: 30),
    cachePolicy: WallpaperCachePolicy.reuse,
  ),
);

operation.progress.listen((progress) {
  print(progress.percentage);
});

final file = await operation.completed;

await Wallpaper.homeScreen(
  imageName: file.imageName,
  fileExtension: file.fileExtension,
  location: file.location,
);

Cancel an active operation:

await operation.cancel();

Clear plugin-managed temporary downloads created by the typed download API:

await Wallpaper.clearCache();

Set Home Screen Wallpaper

await Wallpaper.homeScreen(
  width: width,
  height: height,
  options: RequestSizeOptions.resizeFit,
  location: DownloadLocation.applicationDirectory,
);

Set Lock Screen Wallpaper

await Wallpaper.lockScreen(
  location: DownloadLocation.applicationDirectory,
);

Set Both Wallpapers

await Wallpaper.bothScreen(
  location: DownloadLocation.applicationDirectory,
);

Set System Wallpaper

await Wallpaper.systemScreen(
  location: DownloadLocation.applicationDirectory,
);

Set Wallpaper From a Local File

await Wallpaper.setFromFile(
  file.path,
  target: WallpaperTarget.home,
  options: RequestSizeOptions.resizeFit,
  fit: WallpaperFit.cover,
  alignment: WallpaperAlignment.topCenter,
);

alignment is optional and defaults to center. It applies to WallpaperFit.cover cropping and WallpaperFit.center placement.


Set Wallpaper From Bytes

await Wallpaper.setFromBytes(
  imageBytes,
  target: WallpaperTarget.both,
  fileExtension: ImageFormat.png,
);

Set Wallpaper From an Asset

await Wallpaper.setFromAsset(
  'assets/wallpaper.jpg',
  target: WallpaperTarget.lock,
);

For assets bundled by another package:

await Wallpaper.setFromAsset(
  'assets/wallpaper.jpg',
  package: 'wallpaper_assets',
);

Unified Source API

Use setWallpaperFromSource when you prefer a typed result instead of catching PlatformException from the legacy methods:

final result = await Wallpaper.setWallpaperFromSource(
  source: WallpaperSource.file(file.path),
  options: const WallpaperOptions(
    target: WallpaperTarget.home,
    fit: WallpaperFit.cover,
    alignment: WallpaperAlignment.topCenter,
  ),
);

switch (result) {
  case WallpaperSuccess(:final message):
    print(message);
  case WallpaperFailure(:final exception):
    print('${exception.code}: ${exception.message}');
}

Example

final stream = Wallpaper.imageDownloadProgress(imageUrl);

stream.listen((progress) {
  print("Downloading: $progress");
}, onDone: () async {

  await Wallpaper.homeScreen(
    width: 1080,
    height: 1920,
    options: RequestSizeOptions.resizeFit,
  );

});

Supported Platform

Platform Supported
Android ✅
iOS ❌

Notes

  • Internet connection is required to download images.
  • Lock screen wallpaper requires Android 7.0+ (API 24).
  • Behavior may vary depending on device manufacturer.
  • Starting multiple downloads with the same imageName writes to the same file. Use unique names for concurrent downloads.

License

MIT License

श्रेणियाँ

निर्भरताएँ

निर्भरता सूची 4 आइटम

सोर्स रिपॉज़िटरी

इस पैकेज का उपयोग करने वाले प्रोजेक्ट

अभी कोई डेटा उपलब्ध नहीं है।