app_icon_changer 1.0.6

  • Readme
  • Changelog
  • Example
  • Installing
  • 73

app_icon_changer #

Change your app icon right from your Flutter code! [iOS only]

Runs on iOS 10.3 and above

Usage #

Settings for iOS #

  • Navigate to iOS folder in your Flutter app.
  • Right click on Runner folder and add a new directory named App Icons
  • Add your icons in the folder
  • Right click on the folder you just added and open it in Finder
  • Now open your iOS module in XCode
  • You won't find your folder inside XCode
  • Drag the folder from Finder under the Runner folder (Now XCode knows you added a folder)
  • Open Info.plist as source code and add the following code
<key>CFBundleIcons</key>
    <dict>
        <key>CFBundleAlternateIcons</key>
        <dict>
            <key>icon-white</key>
            <dict>
                <key>UIPrerenderedIcon</key>
                <string>NO</string>
                <key>CFBundleIconFiles</key>
                <array>
                    <string>icon-white</string>
                </array>
            </dict>
            <key>icon-black</key>
            <dict>
                <key>UIPrerenderedIcon</key>
                <string>NO</string>
                <key>CFBundleIconFiles</key>
                <array>
                    <string>icon-black</string>
                </array>
            </dict>
        </dict>
        <key>CFBundlePrimaryIcon</key>
        <dict>
            <key>CFBundleIconFiles</key>
            <array>
                <string>icon</string>
            </array>
        </dict>
        <key>UINewsstandIcon</key>
        <dict>
            <key>CFBundleIconFiles</key>
            <array>
                <string></string>
            </array>
            <key>UINewsstandBindingEdge</key>
            <string>UINewsstandBindingEdgeLeft</string>
            <key>UINewsstandBindingType</key>
            <string>UINewsstandBindingTypeMagazine</string>
        </dict>
    </dict>

Replace icon-white and icon-black with your icon names. You can also add more keys depending on the number of icons you want to keep.

Dart side #

Add the dependency in pubspec.yaml and call the package through code like this:

Future<void> setAppIcon(String name) async {
    try {
      await AppIconChanger.changeIcon(name);
    } on PlatformException {
      print('Failed to change app icon');
    }
    if (!mounted) return;
  }

1.0.6 #

  • Update changelog formatting

1.0.5 #

  • Format dart file

1.0.4 #

  • Add comments in public APIs

1.0.3 #

  • Update readme description

1.0.2 #

  • Updated deployment target in example

1.0.1 #

  • Updated description within the recommended character count

1.0.0 #

  • Updated description

0.0.1 #

  • Initial implementation for iOS
  • Supports iOS 10.3 and above

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:app_icon_changer/app_icon_changer.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {

  @override
  void initState() {
    super.initState();
  }
  Future<void> setAppIcon(String name) async {
    try {
      await AppIconChanger.changeIcon(name);
    } on PlatformException {
      print('Failed to change app icon');
    }
    if (!mounted) return;
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primaryColor: Colors.blueGrey
      ),
      home: Scaffold(
        backgroundColor: Colors.blueGrey[200],
        appBar: AppBar(
          title: const Text('App icon changer'),
        ),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              FlatButton(
                child: Text('White icon'),
                color: Colors.black,
                textColor: Colors.white,
                onPressed: () => setAppIcon('icon-white'),
              ),
              FlatButton(
                child: Text('Black icon'),
                color: Colors.white,
                onPressed: () => setAppIcon('icon-black'),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  app_icon_changer: ^1.0.6

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:app_icon_changer/app_icon_changer.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
45
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
73
Learn more about scoring.

We analyzed this package on Jul 11, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform linux

Because:

  • package:app_icon_changer/app_icon_changer.dart that declares support for platforms: android, ios

Package does not support Flutter platform macos

Because:

  • package:app_icon_changer/app_icon_changer.dart that declares support for platforms: android, ios

Package does not support Flutter platform web

Because:

  • package:app_icon_changer/app_icon_changer.dart that declares support for platforms: android, ios

Package does not support Flutter platform windows

Because:

  • package:app_icon_changer/app_icon_changer.dart that declares support for platforms: android, ios

Package not compatible with SDK dart

Because:

  • app_icon_changer that is a package requiring null.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test