wallpaper 1.1.5 copy "wallpaper: ^1.1.5" to clipboard
wallpaper: ^1.1.5 copied to clipboard

PlatformAndroid

The Purpose of the plugin is to set wallpaper from url. Only supported to android. Internally using WallpaperManager to set wallpaper.

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

Installation #

Add the plugin to your pubspec.yaml:

dependencies:
  wallpaper: ^1.1.5

Then run:

flutter pub get

Android Configuration #

1️⃣ Add permissions in AndroidManifest.xml #

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

2️⃣ Create file_paths.xml #

Create this file:

android/app/src/main/res/xml/file_paths.xml

Example:

<?xml version="1.0" encoding="utf-8"?>
<paths>
    <external-path name="external_files" path="." />
</paths>

This is required so the plugin can store downloaded images before applying them as wallpaper.


Usage #

Import the plugin:

import 'package:wallpaper/wallpaper.dart';

Download Image #

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

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

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,
);

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.

License #

MIT License

52
likes
160
points
472
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

The Purpose of the plugin is to set wallpaper from url. Only supported to android. Internally using WallpaperManager to set wallpaper.

Repository (GitHub)
View/report issues

License

Apache-2.0 (license)

Dependencies

dio, flutter, flutter_web_plugins, path_provider, plugin_platform_interface, web

More

Packages that depend on wallpaper

Packages that implement wallpaper