Flutter 踩雷日記 - 換App icon 不管用

Flutter 踩雷日記 - 換App icon 不管用

首先是dependency 如下


1. pubspec.yaml

dev_dependencies:
flutter_test:
sdk: flutter

# The "flutter_lints" package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^5.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
flutter_launcher_icons: ^0.13.1

2. 在專案root folder下新增以下此檔案 flutter_launcher_icons.yaml


內容為:

# flutter pub run flutter_launcher_icons
flutter_launcher_icons:
image_path: "assets/your_icon.png"

android: true
# image_path_android: "assets/icon/icon.png"
min_sdk_android: 21 # android min sdk min:16, default 21
# adaptive_icon_background: "assets/icon/background.png"
# adaptive_icon_foreground: "assets/icon/foreground.png"

ios: true
# image_path_ios: "assets/icon/icon.png"
remove_alpha_channel_ios: true


3. icon如果要更換還有個重點,替換後需要輸入 flutter pub run flutter_launcher_icons



4. 接著flutter run , 替換成功!










張貼留言

0 留言