@@ -5,7 +5,7 @@ import 'dart:io';
5
5
import 'package:flutter_launcher_icons/constants.dart' ;
6
6
import 'package:flutter_launcher_icons/constants.dart' as constants;
7
7
import 'package:flutter_launcher_icons/custom_exceptions.dart' ;
8
- import 'package:flutter_launcher_icons/flutter_launcher_icons_config .dart' ;
8
+ import 'package:flutter_launcher_icons/config/config .dart' ;
9
9
import 'package:flutter_launcher_icons/utils.dart' as utils;
10
10
import 'package:flutter_launcher_icons/xml_templates.dart' as xml_template;
11
11
import 'package:image/image.dart' ;
@@ -35,12 +35,12 @@ List<AndroidIconTemplate> androidIcons = <AndroidIconTemplate>[
35
35
];
36
36
37
37
void createDefaultIcons (
38
- FlutterLauncherIconsConfig flutterLauncherIconsConfig ,
38
+ Config config ,
39
39
String ? flavor,
40
40
) {
41
41
utils.printStatus ('Creating default icons Android' );
42
42
// TODO(p-mazhnik): support prefixPath
43
- final String ? filePath = flutterLauncherIconsConfig .getImagePathAndroid ();
43
+ final String ? filePath = config .getImagePathAndroid ();
44
44
if (filePath == null ) {
45
45
throw const InvalidConfigException (errorMissingImagePath);
46
46
}
@@ -49,9 +49,9 @@ void createDefaultIcons(
49
49
return ;
50
50
}
51
51
final File androidManifestFile = File (constants.androidManifestFile);
52
- if (flutterLauncherIconsConfig .isCustomAndroidFile) {
52
+ if (config .isCustomAndroidFile) {
53
53
utils.printStatus ('Adding a new Android launcher icon' );
54
- final String iconName = flutterLauncherIconsConfig .android;
54
+ final String iconName = config .android;
55
55
isAndroidIconNameCorrectFormat (iconName);
56
56
final String iconPath = '$iconName .png' ;
57
57
for (AndroidIconTemplate template in androidIcons) {
@@ -89,16 +89,16 @@ bool isAndroidIconNameCorrectFormat(String iconName) {
89
89
}
90
90
91
91
void createAdaptiveIcons (
92
- FlutterLauncherIconsConfig flutterLauncherIconsConfig ,
92
+ Config config ,
93
93
String ? flavor,
94
94
) {
95
95
utils.printStatus ('Creating adaptive icons Android' );
96
96
97
97
// Retrieve the necessary Flutter Launcher Icons configuration from the pubspec.yaml file
98
98
final String ? backgroundConfig =
99
- flutterLauncherIconsConfig .adaptiveIconBackground;
99
+ config .adaptiveIconBackground;
100
100
final String ? foregroundImagePath =
101
- flutterLauncherIconsConfig .adaptiveIconForeground;
101
+ config .adaptiveIconForeground;
102
102
if (backgroundConfig == null || foregroundImagePath == null ) {
103
103
throw const InvalidConfigException (errorMissingImagePath);
104
104
}
@@ -120,12 +120,12 @@ void createAdaptiveIcons(
120
120
// Create adaptive icon background
121
121
if (isAdaptiveIconConfigPngFile (backgroundConfig)) {
122
122
_createAdaptiveBackgrounds (
123
- flutterLauncherIconsConfig ,
123
+ config ,
124
124
backgroundConfig,
125
125
flavor,
126
126
);
127
127
} else {
128
- createAdaptiveIconMipmapXmlFile (flutterLauncherIconsConfig , flavor);
128
+ createAdaptiveIconMipmapXmlFile (config , flavor);
129
129
updateColorsXmlFile (backgroundConfig, flavor);
130
130
}
131
131
}
@@ -156,13 +156,13 @@ void updateColorsXmlFile(String backgroundConfig, String? flavor) {
156
156
/// Creates the xml file required for the adaptive launcher icon
157
157
/// FILE LOCATED HERE: res/mipmap-anydpi/{icon-name-from-yaml-config}.xml
158
158
void createAdaptiveIconMipmapXmlFile (
159
- FlutterLauncherIconsConfig flutterLauncherIconsConfig ,
159
+ Config config ,
160
160
String ? flavor,
161
161
) {
162
- if (flutterLauncherIconsConfig .isCustomAndroidFile) {
162
+ if (config .isCustomAndroidFile) {
163
163
File (
164
164
constants.androidAdaptiveXmlFolder (flavor) +
165
- flutterLauncherIconsConfig .android +
165
+ config .android +
166
166
'.xml' ,
167
167
).create (recursive: true ).then ((File adaptiveIcon) {
168
168
adaptiveIcon.writeAsString (xml_template.icLauncherXml);
@@ -180,7 +180,7 @@ void createAdaptiveIconMipmapXmlFile(
180
180
181
181
/// creates adaptive background using png image
182
182
void _createAdaptiveBackgrounds (
183
- FlutterLauncherIconsConfig flutterLauncherIconsConfig ,
183
+ Config config ,
184
184
String adaptiveIconBackgroundImagePath,
185
185
String ? flavor,
186
186
) {
@@ -203,10 +203,10 @@ void _createAdaptiveBackgrounds(
203
203
204
204
// Creates the xml file required for the adaptive launcher icon
205
205
// FILE LOCATED HERE: res/mipmap-anydpi/{icon-name-from-yaml-config}.xml
206
- if (flutterLauncherIconsConfig .isCustomAndroidFile) {
206
+ if (config .isCustomAndroidFile) {
207
207
File (
208
208
constants.androidAdaptiveXmlFolder (flavor) +
209
- flutterLauncherIconsConfig .android +
209
+ config .android +
210
210
'.xml' ,
211
211
).create (recursive: true ).then ((File adaptiveIcon) {
212
212
adaptiveIcon.writeAsString (xml_template.icLauncherDrawableBackgroundXml);
0 commit comments