How to change the application launcher icon to Flutter?

When I create an application using the command flutter create, the flutter logo is used as the application icon for both platforms.

If I want to change the application icon, I have to go to both platform directories and replace the images there ?, by platform directories I mean myapp/ios/Runner/Assets.xcassets/AppIcon.appiconsetfor iOS and myapp/android/app/src/main/resfor Android.

Or can you define the image as a Flutter Asset , and the icons are created in some way ?.

+90
source share
9 answers

Flutter Launcher Icons was designed to help quickly generate launch icons for Android and iOS: https://pub.dartlang.org/packages/flutter_launcher_icons

  • pubspec.yaml ( Flutter),
  • pubspec.yaml , , , iOS, Android .
  • !

GitHub README,

, , , .

- / , , GitHub.

: , 24 2018 , , Flutter.

2: 4.4.0 (8 2018 ) Android iOS.

3: 0.5.2 (20 2018 .) Android Flutter

+119

:

  1. flutter_launcher_icons pubspec.yaml

dev_dependencies: 
  flutter_test:
    sdk: flutter

  flutter_launcher_icons: "^0.6.1"

flutter_icons:
  image_path: "icon/icon.png" 
  android: true
  ios: true
  1. . eg icon/icon.png

  2. :

$ flutter pub get

$ flutter pub pub run flutter_launcher_icons:main

, Android iOS, ,

, .

+55

,

flutter_launcher_icons. , , Android iOS. , .

Android

Android , .

enter image description here

( Android)

Android - Asset Studio, Android Studio (, VSCode). Flutter.

android . New> Image Asset. .

: 1024x1024 , , 512x512. Gimp Inkscape, , . .

enter image description here

( )

. mipmap:

n7ax9.png

, .

, , AndroidManifest , ( ic_launcher):

application android:icon="@mipmap/ic_launcher"

, , .

IOS

iOS , Mac, Mac App Store Icon Set Creator. ( 1024x1024 ), ( Contents.json). .

iOS . .

, , Xcode ( , Mac) , ios Flutter. Runner> Assets.xcassets AppIcon.

enter image description here

" ...". , .

. , , .

Mac...

. Flutter ios/Runner/Assets.xcassets/AppIcon.appiconset.

B9CKd.png

, , . , Icon-App-29x29@3x.png Icon-App-29x29@3x.png 29 Icon-App-29x29@3x.png 3, Icon-App-29x29@3x.png 87 . JSON.

+40

. - , .

+3

.

App Icon Creator

1: ,

2: ( )

3: Zip

android/app/main/src/res
+2

- iOS Android.

iOS Android . , .

: https://flutter.dev/docs/deployment/android

+1

.

"flutter_launcher_icons". , .

  1. pubspec.yaml . , ,

    :
    :
    SDK:
    cupertino_icons: ^ 0.1.2
    flutter_launcher_icons: ^ 0.7.2 + 1

flutter pub .

  1. , . 1024x1024 . , assets/icon/icon.png

  2. pubspec.yaml ,

    flutter_icons:
    Android: "Launcher_icon"
    IOS:
    image_path: "assets/icon/icon.png"

  3. flutter pub . ,

    flutter pub run flutter_launcher_icons: main -f pubspec.yaml

-1

You can achieve this using flutter_launcher_icons in pubspec.yaml

Another way is to use one for Android and another for iOS

-1
source

Source: https://habr.com/ru/post/1017192/


All Articles