Language: English | 中文

mx_app_icon

Pub

App icon generator.

Usage

1. Use this package as a library

add mx_app_icon to dependencies

dev_dependencies:
   mx_app_icon: any
import 'package:mx_app_icon/mx_app_icon.dart';

void main(List<String> args) {
   final generator = MxAppIconGenerator();

   final iconFile = File('圖片路徑');

   final iosDir = Directory('./ios/Runner/Assets.xcassets/AppIcon.appiconset');
   final androidDir = Directory('./android/app/src/main/res');
   
   // 產生ios圖片
   generator.generateIosIcon(iconFile.readAsBytesSync(), iosDir);
   
   // 產生android圖片
   generator.generateAndroidIcon(iconFile.readAsBytesSync(), androidDir);
}

2. Use this package as an executable

  1. Activating a package

     dart pub global activate mx_app_icon
    
  2. Running

     mx_app_icon -f {imagePath} -p ios -t {targetDir} -b #FFFFFF
    
  3. Command Line Arguments

    -f, --file           image source file
    -t, --target_dir     target folder points to 'AppIcon.appiconset' for iOS and 'res' for Android.
    -p, --platform       platform (ios/android)
    -b, --background     background color
    -h, --[no-]help      description
    

(If thrown error command not found on step2, check this add path to env)