Skip to content

Commit

Permalink
- Upgraded image:^3.0.2 to image:^4.0.10 and fixed breaking changes d…
Browse files Browse the repository at this point in the history
…one by the upgrade.
  • Loading branch information
carloshpb authored and MarkOSullivan94 committed Feb 24, 2023
1 parent 9a48d68 commit 6c25163
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
27 changes: 14 additions & 13 deletions lib/android.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:flutter_launcher_icons/constants.dart';
import 'package:flutter_launcher_icons/constants.dart' as constants;
import 'package:flutter_launcher_icons/custom_exceptions.dart';
import 'package:flutter_launcher_icons/flutter_launcher_icons_config.dart';
import 'package:flutter_launcher_icons/utils.dart';
import 'package:flutter_launcher_icons/utils.dart' as utils;
import 'package:flutter_launcher_icons/xml_templates.dart' as xml_template;
import 'package:image/image.dart';
import 'package:path/path.dart' as path;
Expand Down Expand Up @@ -36,19 +36,19 @@ void createDefaultIcons(
FlutterLauncherIconsConfig flutterLauncherIconsConfig,
String? flavor,
) {
printStatus('Creating default icons Android');
utils.printStatus('Creating default icons Android');
// todo: support prefixPath
final String? filePath = flutterLauncherIconsConfig.getImagePathAndroid();
if (filePath == null) {
throw const InvalidConfigException(errorMissingImagePath);
}
final Image? image = decodeImageFile(filePath);
final Image? image = utils.decodeImageFile(filePath);
if (image == null) {
return;
}
final File androidManifestFile = File(constants.androidManifestFile);
if (flutterLauncherIconsConfig.isCustomAndroidFile) {
printStatus('Adding a new Android launcher icon');
utils.printStatus('Adding a new Android launcher icon');
final String iconName = flutterLauncherIconsConfig.android;
isAndroidIconNameCorrectFormat(iconName);
final String iconPath = '$iconName.png';
Expand All @@ -57,7 +57,7 @@ void createDefaultIcons(
}
overwriteAndroidManifestWithNewLauncherIcon(iconName, androidManifestFile);
} else {
printStatus(
utils.printStatus(
'Overwriting the default Android launcher icon with a new icon',
);
for (AndroidIconTemplate template in androidIcons) {
Expand Down Expand Up @@ -90,7 +90,7 @@ void createAdaptiveIcons(
FlutterLauncherIconsConfig flutterLauncherIconsConfig,
String? flavor,
) {
printStatus('Creating adaptive icons Android');
utils.printStatus('Creating adaptive icons Android');

// Retrieve the necessary Flutter Launcher Icons configuration from the pubspec.yaml file
final String? backgroundConfig =
Expand All @@ -100,7 +100,7 @@ void createAdaptiveIcons(
if (backgroundConfig == null || foregroundImagePath == null) {
throw const InvalidConfigException(errorMissingImagePath);
}
final Image? foregroundImage = decodeImageFile(foregroundImagePath);
final Image? foregroundImage = utils.decodeImageFile(foregroundImagePath);
if (foregroundImage == null) {
return;
}
Expand Down Expand Up @@ -138,11 +138,12 @@ void createAdaptiveIcons(
void updateColorsXmlFile(String backgroundConfig, String? flavor) {
final File colorsXml = File(constants.androidColorsFile(flavor));
if (colorsXml.existsSync()) {
printStatus('Updating colors.xml with color for adaptive icon background');
utils.printStatus(
'Updating colors.xml with color for adaptive icon background');
updateColorsFile(colorsXml, backgroundConfig);
} else {
printStatus('No colors.xml file found in your Android project');
printStatus(
utils.printStatus('No colors.xml file found in your Android project');
utils.printStatus(
'Creating colors.xml file and adding it to your Android project',
);
createNewColorsFile(backgroundConfig, flavor);
Expand Down Expand Up @@ -181,7 +182,7 @@ void _createAdaptiveBackgrounds(
String? flavor,
) {
final String filePath = adaptiveIconBackgroundImagePath;
final Image? image = decodeImageFile(filePath);
final Image? image = utils.decodeImageFile(filePath);
if (image == null) {
return;
}
Expand Down Expand Up @@ -266,7 +267,7 @@ void overwriteExistingIcons(
String filename,
String? flavor,
) {
final Image newFile = createResizedImage(template.size, image);
final Image newFile = utils.createResizedImage(template.size, image);
File(
constants.androidResFolder(flavor) +
template.directoryName +
Expand All @@ -286,7 +287,7 @@ void _saveNewImages(
String iconFilePath,
String? flavor,
) {
final Image newFile = createResizedImage(template.size, image);
final Image newFile = utils.createResizedImage(template.size, image);
File(
constants.androidResFolder(flavor) +
template.directoryName +
Expand Down
4 changes: 2 additions & 2 deletions lib/ios.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ void createIcons(FlutterLauncherIconsConfig config, String? flavor) {
return;
}
if (config.removeAlphaIOS) {
image.channels = Channels.rgb;
image.remapChannels(ChannelOrder.rgb);
}
if (image.channels == Channels.rgba) {
if (image.hasAlpha) {
print(
'\nWARNING: Icons with alpha channel are not allowed in the Apple App Store.\nSet "remove_alpha_ios: true" to remove it.\n',
);
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_launcher_icons
description: A package which simplifies the task of updating your Flutter app's launcher icon.
version: 0.11.0
version: 0.11.0+1
maintainer: Mark O'Sullivan (@MarkOSullivan94)
homepage: https://github.com/fluttercommunity/flutter_launcher_icons
repository: https://github.com/fluttercommunity/flutter_launcher_icons/
Expand All @@ -10,7 +10,7 @@ dependencies:
args: ^2.2.0
checked_yaml: ^2.0.1
cli_util: ^0.3.5
image: ^3.0.2
image: ^4.0.10
json_annotation: ^4.5.0
path: ^1.8.0
yaml: ^3.1.0
Expand Down

0 comments on commit 6c25163

Please sign in to comment.