From 2a111a76f191ff461e6013ee7eadf36616edb62e Mon Sep 17 00:00:00 2001 From: Yan Min Hong Date: Tue, 23 Jun 2020 16:57:07 -0700 Subject: [PATCH 01/13] added scaling by use of adaptive_icon_foreground_scale_factor --- lib/android.dart | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/lib/android.dart b/lib/android.dart index 1f13cf99fd..c133df7e2d 100644 --- a/lib/android.dart +++ b/lib/android.dart @@ -63,19 +63,39 @@ bool isAndroidIconNameCorrectFormat(String iconName) { void createAdaptiveIcons(Map flutterLauncherIconsConfig) { print('Creating adaptive icons Android'); - // Retrieve the necessary Flutter Launcher Icons configuration from the pubspec.yaml file + // Retrieve the necessary Flutter Launcher Icons configuration from the yaml file final String backgroundConfig = flutterLauncherIconsConfig['adaptive_icon_background']; final String foregroundImagePath = flutterLauncherIconsConfig['adaptive_icon_foreground']; final Image foregroundImage = decodeImage(File(foregroundImagePath).readAsBytesSync()); + final double foregroundScaleFactor = + flutterLauncherIconsConfig['adaptive_icon_foreground_scale_factor']; + + final bool rescale = + foregroundScaleFactor != null && foregroundScaleFactor > 0; + + Image newCanvas; + // Scales the image prior to converting to icon. This is mainly for scaling down to match adaptive icon spec + if (rescale) { + print('Rescaling icon by $foregroundScaleFactor'); + final int height = foregroundImage.height; + final int width = foregroundImage.width; + final int scaledHeight = (height * 1/foregroundScaleFactor).floor(); + final int scaledWidth = (width * 1/foregroundScaleFactor).floor(); + newCanvas = Image(scaledHeight, scaledWidth); + newCanvas.fill(0); + copyInto(newCanvas, foregroundImage, + dstX: ((scaledHeight - height) / 2).floor(), + dstY: ((scaledWidth - width) / 2).floor()); + } // Create adaptive icon foreground images for (AndroidIconTemplate androidIcon in adaptiveForegroundIcons) { overwriteExistingIcons( androidIcon, - foregroundImage, + rescale ? newCanvas : foregroundImage, constants.androidAdaptiveForegroundFileName, ); } @@ -252,12 +272,14 @@ Future overwriteAndroidManifestWithNewLauncherIcon( String iconName) async { final File androidManifestFile = File(constants.androidManifestFile); final List oldManifestLines = await androidManifestFile.readAsLines(); - final List transformedLines = transformAndroidManifestWithNewLauncherIcon(oldManifestLines, iconName); + final List transformedLines = + transformAndroidManifestWithNewLauncherIcon(oldManifestLines, iconName); await androidManifestFile.writeAsString(transformedLines.join('\n')); } /// Updates only the line containing android:icon with the specified iconName -List transformAndroidManifestWithNewLauncherIcon(List oldManifestLines, String iconName) { +List transformAndroidManifestWithNewLauncherIcon( + List oldManifestLines, String iconName) { return oldManifestLines.map((String line) { if (line.contains('android:icon')) { // Using RegExp replace the value of android:icon to point to the new icon From f6b1b65722a021f557a3faaac2e802fe8eb3aaff Mon Sep 17 00:00:00 2001 From: Yan Min Hong Date: Tue, 23 Jun 2020 17:35:52 -0700 Subject: [PATCH 02/13] Update android.dart --- lib/android.dart | 56 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/lib/android.dart b/lib/android.dart index c133df7e2d..65e909952d 100644 --- a/lib/android.dart +++ b/lib/android.dart @@ -60,6 +60,21 @@ bool isAndroidIconNameCorrectFormat(String iconName) { return true; } +/// Rescales image by creating a different sized canvas and copying image centered onto the new canvas +Image rescaleImage(Image image, double scaleFactor, {int fillColor = 0}) { + print('Rescaling icon by $scaleFactor'); + final int height = image.height; + final int width = image.width; + final int scaledHeight = (height * 1 / scaleFactor).floor(); + final int scaledWidth = (width * 1 / scaleFactor).floor(); + final Image scaledImage = Image(scaledHeight, scaledWidth); + scaledImage.fill(fillColor); + copyInto(scaledImage, image, + dstX: ((scaledHeight - height) / 2).floor(), + dstY: ((scaledWidth - width) / 2).floor()); + return scaledImage; +} + void createAdaptiveIcons(Map flutterLauncherIconsConfig) { print('Creating adaptive icons Android'); @@ -72,30 +87,43 @@ void createAdaptiveIcons(Map flutterLauncherIconsConfig) { decodeImage(File(foregroundImagePath).readAsBytesSync()); final double foregroundScaleFactor = flutterLauncherIconsConfig['adaptive_icon_foreground_scale_factor']; + final String foregroundScaleFillColor = + flutterLauncherIconsConfig['adaptive_icon_foreground_scale_fill_color']; final bool rescale = foregroundScaleFactor != null && foregroundScaleFactor > 0; - Image newCanvas; - // Scales the image prior to converting to icon. This is mainly for scaling down to match adaptive icon spec - if (rescale) { - print('Rescaling icon by $foregroundScaleFactor'); - final int height = foregroundImage.height; - final int width = foregroundImage.width; - final int scaledHeight = (height * 1/foregroundScaleFactor).floor(); - final int scaledWidth = (width * 1/foregroundScaleFactor).floor(); - newCanvas = Image(scaledHeight, scaledWidth); - newCanvas.fill(0); - copyInto(newCanvas, foregroundImage, - dstX: ((scaledHeight - height) / 2).floor(), - dstY: ((scaledWidth - width) / 2).floor()); + Image rescaledImage; + + // Scales the foreground image prior to converting to icon. This is mainly for scaling down to match adaptive icon spec + if (rescale && + foregroundImage != null && + foregroundScaleFactor != null && + foregroundScaleFactor > 0) { + int _getColorFromHex(String hexColor) { + //Converts hex string to int + hexColor = hexColor.toUpperCase().replaceAll('#', ''); + /* Defaulting to transparent background + + if (hexColor.length == 6) { + hexColor = 'FF' + hexColor; + } + */ + return int.parse(hexColor, radix: 16); + } + + rescaledImage = rescaleImage(foregroundImage, foregroundScaleFactor, + fillColor: foregroundScaleFillColor != null && + foregroundScaleFillColor.isNotEmpty + ? _getColorFromHex(foregroundScaleFillColor) + : 0); } // Create adaptive icon foreground images for (AndroidIconTemplate androidIcon in adaptiveForegroundIcons) { overwriteExistingIcons( androidIcon, - rescale ? newCanvas : foregroundImage, + rescale ? rescaledImage : foregroundImage, constants.androidAdaptiveForegroundFileName, ); } From 61b9ee7d7e3cd599e65e278e9649f0e58db3db6b Mon Sep 17 00:00:00 2001 From: Yan Min Hong Date: Sat, 18 Jul 2020 12:38:21 -0700 Subject: [PATCH 03/13] updated total ios icon list --- test/main_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/main_test.dart b/test/main_test.dart index 4024dd9fa3..3501aa8e76 100644 --- a/test/main_test.dart +++ b/test/main_test.dart @@ -11,7 +11,7 @@ import 'package:flutter_launcher_icons/main.dart' as main_dart; // Unit tests for main.dart void main() { test('iOS icon list is correct size', () { - expect(ios.iosIcons.length, 21); + expect(ios.iosIcons.length, 15); }); test('Android icon list is correct size', () { From b7f3047e4b9fa4dd282694636cc9629ec7a0dfe5 Mon Sep 17 00:00:00 2001 From: Yan Min Hong Date: Sat, 5 Dec 2020 22:47:42 -0800 Subject: [PATCH 04/13] updated gitignore --- .gitignore | 120 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 113 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 45ce92b464..0e8c2f9fbf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,117 @@ -# Files and directories created by pub -.packages +# Miscellaneous +*.class +*.lock +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# Visual Studio Code related +.classpath +.project +.settings/ +.vscode/ + +# Flutter repo-specific +/bin/cache/ +/bin/internal/bootstrap.bat +/bin/internal/bootstrap.sh +/bin/mingit/ +/dev/benchmarks/mega_gallery/ +/dev/bots/.recipe_deps +/dev/bots/android_tools/ +/dev/devicelab/ABresults*.json +/dev/docs/doc/ +/dev/docs/flutter.docs.zip +/dev/docs/lib/ +/dev/docs/pubspec.yaml +/dev/integration_tests/**/xcuserdata +/dev/integration_tests/**/Pods +/packages/flutter/coverage/ +version +analysis_benchmark.json + +# packages file containing multi-root paths +.packages.generated + +# Flutter/Dart/Pub related +**/doc/api/ .dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +**/generated_plugin_registrant.dart +.packages +.pub-cache/ .pub/ -.idea/ build/ -# Remove the following pattern if you wish to check in your lock file -pubspec.lock +flutter_*.png +linked_*.ds +unlinked.ds +unlinked_spec.ds + +# Android related +**/android/**/gradle-wrapper.jar +**/android/.gradle +**/android/captures/ +**/android/gradlew +**/android/gradlew.bat +**/android/local.properties +**/android/**/GeneratedPluginRegistrant.java +**/android/key.properties +*.jks + +# iOS/XCode related +**/ios/**/*.mode1v3 +**/ios/**/*.mode2v3 +**/ios/**/*.moved-aside +**/ios/**/*.pbxuser +**/ios/**/*.perspectivev3 +**/ios/**/*sync/ +**/ios/**/.sconsign.dblite +**/ios/**/.tags* +**/ios/**/.vagrant/ +**/ios/**/DerivedData/ +**/ios/**/Icon? +**/ios/**/Pods/ +**/ios/**/.symlinks/ +**/ios/**/profile +**/ios/**/xcuserdata +**/ios/.generated/ +**/ios/Flutter/.last_build_id +**/ios/Flutter/App.framework +**/ios/Flutter/Flutter.framework +**/ios/Flutter/Flutter.podspec +**/ios/Flutter/Generated.xcconfig +**/ios/Flutter/app.flx +**/ios/Flutter/app.zip +**/ios/Flutter/flutter_assets/ +**/ios/Flutter/flutter_export_environment.sh +**/ios/ServiceDefinitions.json +**/ios/Runner/GeneratedPluginRegistrant.* + +# macOS +**/macos/Flutter/GeneratedPluginRegistrant.swift + +# Coverage +coverage/ + +# Symbols +app.*.symbols -# Directory created by dartdoc -doc/api/ +# Exceptions to above rules. +!**/ios/**/default.mode1v3 +!**/ios/**/default.mode2v3 +!**/ios/**/default.pbxuser +!**/ios/**/default.perspectivev3 +!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages +!/dev/ci/**/Gemfile.lock \ No newline at end of file From 22ad3a2dc3c4bb0391a43079a550eb6ec7a481de Mon Sep 17 00:00:00 2001 From: Yan Min Hong Date: Sat, 5 Dec 2020 22:48:23 -0800 Subject: [PATCH 05/13] cleanup --- example/android/local.properties | 4 ++-- pubspec.yaml | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/example/android/local.properties b/example/android/local.properties index 3850e1d37a..06dcee3290 100644 --- a/example/android/local.properties +++ b/example/android/local.properties @@ -1,3 +1,3 @@ -sdk.dir=/Users/mos/Library/Android/sdk -flutter.sdk=/Users/mos/Flutter +sdk.dir=C:\\Users\\yanco\\AppData\\Local\\Android\\Sdk +flutter.sdk=C:\\flutter flutter.buildMode=debug \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index c37f6d6978..3bcc667838 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -9,12 +9,12 @@ authors: - Mark O'Sullivan dependencies: - image: "^2.1.1" - args: "^1.5.0" - yaml: "^2.1.15" + image: ^2.1.1 + args: ^1.5.0 + yaml: ^2.1.15 environment: sdk: '>=2.2.0 <3.0.0' dev_dependencies: - test: '^1.6.3' + test: ^1.6.3 From 301141b32183479f3a06e871478747155bf7e6af Mon Sep 17 00:00:00 2001 From: Yan Min Hong Date: Tue, 16 Feb 2021 16:54:45 -0800 Subject: [PATCH 06/13] updated print statement --- lib/android.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/android.dart b/lib/android.dart index 109a19f571..03e466f724 100644 --- a/lib/android.dart +++ b/lib/android.dart @@ -65,7 +65,7 @@ bool isAndroidIconNameCorrectFormat(String iconName) { /// Rescales image by creating a different sized canvas and copying image centered onto the new canvas Image rescaleImage(Image image, double scaleFactor, {int fillColor = 0}) { - print('Rescaling icon by $scaleFactor'); + printStatus('Rescaling icon by $scaleFactor'); final int height = image.height; final int width = image.width; final int scaledHeight = (height * 1 / scaleFactor).floor(); From f16bcbd86cb61ceca98948e33d8d702cacf7b378 Mon Sep 17 00:00:00 2001 From: Yan Min Hong Date: Tue, 23 Feb 2021 16:09:56 -0800 Subject: [PATCH 07/13] Updated to force scaled icons to be on a square canvas --- example/default/pubspec.yaml | 1 + lib/android.dart | 50 +++++++++++++++++------------------- 2 files changed, 24 insertions(+), 27 deletions(-) diff --git a/example/default/pubspec.yaml b/example/default/pubspec.yaml index 7a638d6ac2..52c685738c 100644 --- a/example/default/pubspec.yaml +++ b/example/default/pubspec.yaml @@ -21,6 +21,7 @@ flutter_icons: ios: true # can specify file name here e.g. "My-Launcher-Icon" adaptive_icon_background: "assets/images/christmas-background.png" # only available for Android 8.0 devices and above adaptive_icon_foreground: "assets/images/icon-foreground-432x432.png" # only available for Android 8.0 devices and above + adaptive_icon_foreground_scale_factor: 1.0 # Test adaptive icon scaling dev_dependencies: flutter_test: diff --git a/lib/android.dart b/lib/android.dart index 03e466f724..9cb19fc0d4 100644 --- a/lib/android.dart +++ b/lib/android.dart @@ -1,4 +1,5 @@ import 'dart:io'; +import 'dart:math'; import 'package:flutter_launcher_icons/utils.dart'; import 'package:flutter_launcher_icons/xml_templates.dart' as xml_template; import 'package:image/image.dart'; @@ -44,12 +45,14 @@ void createDefaultIcons( } overwriteAndroidManifestWithNewLauncherIcon(iconName, androidManifestFile); } else { - printStatus('Overwriting the default Android launcher icon with a new icon'); + printStatus( + 'Overwriting the default Android launcher icon with a new icon'); for (AndroidIconTemplate template in androidIcons) { overwriteExistingIcons( template, image, constants.androidFileName, flavor); } - overwriteAndroidManifestWithNewLauncherIcon(constants.androidDefaultIconName, androidManifestFile); + overwriteAndroidManifestWithNewLauncherIcon( + constants.androidDefaultIconName, androidManifestFile); } } @@ -68,22 +71,23 @@ Image rescaleImage(Image image, double scaleFactor, {int fillColor = 0}) { printStatus('Rescaling icon by $scaleFactor'); final int height = image.height; final int width = image.width; - final int scaledHeight = (height * 1 / scaleFactor).floor(); - final int scaledWidth = (width * 1 / scaleFactor).floor(); - final Image scaledImage = Image(scaledHeight, scaledWidth); + final int scaledDimension = (max(width, height) * 1 / scaleFactor).floor(); + if (height != width) { + printStatus( + 'Foreground image is not square! Scaled canvas will be made square to meet Adaptive Icon Specifications'); + } + final Image scaledImage = Image(scaledDimension, scaledDimension); scaledImage.fill(fillColor); copyInto(scaledImage, image, - dstX: ((scaledHeight - height) / 2).floor(), - dstY: ((scaledWidth - width) / 2).floor()); + dstX: ((scaledDimension - width) / 2).floor(), + dstY: ((scaledDimension - height) / 2).floor(),); return scaledImage; } - void createAdaptiveIcons( Map flutterLauncherIconsConfig, String flavor) { printStatus('Creating adaptive icons Android'); - // Retrieve the necessary Flutter Launcher Icons configuration from the yaml file final String backgroundConfig = flutterLauncherIconsConfig['adaptive_icon_background']; @@ -96,25 +100,16 @@ void createAdaptiveIcons( final String foregroundScaleFillColor = flutterLauncherIconsConfig['adaptive_icon_foreground_scale_fill_color']; - final bool rescale = - foregroundScaleFactor != null && foregroundScaleFactor > 0; + final bool rescale = foregroundScaleFactor != null && + foregroundScaleFactor > 0 && foregroundImage != null; Image rescaledImage; - // Scales the foreground image prior to converting to icon. This is mainly for scaling down to match adaptive icon spec - if (rescale && - foregroundImage != null && - foregroundScaleFactor != null && - foregroundScaleFactor > 0) { + // Scales the foreground image prior to converting to icon. This is intended for scaling down to match adaptive icon spec + if (rescale) { int _getColorFromHex(String hexColor) { //Converts hex string to int hexColor = hexColor.toUpperCase().replaceAll('#', ''); - /* Defaulting to transparent background - - if (hexColor.length == 6) { - hexColor = 'FF' + hexColor; - } - */ return int.parse(hexColor, radix: 16); } @@ -128,10 +123,10 @@ void createAdaptiveIcons( // Create adaptive icon foreground images for (AndroidIconTemplate androidIcon in adaptiveForegroundIcons) { overwriteExistingIcons( - androidIcon, - rescale ? rescaledImage : foregroundImage, - constants.androidAdaptiveForegroundFileName, flavor - ); + androidIcon, + rescale ? rescaledImage : foregroundImage, + constants.androidAdaptiveForegroundFileName, + flavor); } // Create adaptive icon background @@ -158,7 +153,8 @@ void updateColorsXmlFile(String backgroundConfig, String flavor) { updateColorsFile(colorsXml, backgroundConfig); } else { printStatus('No colors.xml file found in your Android project'); - printStatus('Creating colors.xml file and adding it to your Android project'); + printStatus( + 'Creating colors.xml file and adding it to your Android project'); createNewColorsFile(backgroundConfig, flavor); } } From b24ef959f19071fdc94013f32bab79ce9284bb58 Mon Sep 17 00:00:00 2001 From: Yan Min Hong Date: Tue, 23 Feb 2021 16:25:58 -0800 Subject: [PATCH 08/13] cleanup --- lib/android.dart | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/lib/android.dart b/lib/android.dart index 9cb19fc0d4..e3f36976fd 100644 --- a/lib/android.dart +++ b/lib/android.dart @@ -69,18 +69,21 @@ bool isAndroidIconNameCorrectFormat(String iconName) { /// Rescales image by creating a different sized canvas and copying image centered onto the new canvas Image rescaleImage(Image image, double scaleFactor, {int fillColor = 0}) { printStatus('Rescaling icon by $scaleFactor'); - final int height = image.height; - final int width = image.width; - final int scaledDimension = (max(width, height) * 1 / scaleFactor).floor(); - if (height != width) { + final int scaledDimension = + (max(image.width, image.height) * 1 / scaleFactor).floor(); + if (image.width != image.height) { printStatus( - 'Foreground image is not square! Scaled canvas will be made square to meet Adaptive Icon Specifications'); - } + 'Foreground image is not square! Scaled canvas will be made square ' + 'to meet Adaptive Icon Specifications'); + } final Image scaledImage = Image(scaledDimension, scaledDimension); scaledImage.fill(fillColor); - copyInto(scaledImage, image, - dstX: ((scaledDimension - width) / 2).floor(), - dstY: ((scaledDimension - height) / 2).floor(),); + copyInto( + scaledImage, + image, + dstX: ((scaledDimension - image.width) / 2).floor(), + dstY: ((scaledDimension - image.height) / 2).floor(), + ); return scaledImage; } @@ -101,11 +104,13 @@ void createAdaptiveIcons( flutterLauncherIconsConfig['adaptive_icon_foreground_scale_fill_color']; final bool rescale = foregroundScaleFactor != null && - foregroundScaleFactor > 0 && foregroundImage != null; + foregroundScaleFactor > 0 && + foregroundImage != null; Image rescaledImage; - // Scales the foreground image prior to converting to icon. This is intended for scaling down to match adaptive icon spec + // Scales the foreground image prior to converting to icon. + // This is intended for scaling down to match adaptive icon spec if (rescale) { int _getColorFromHex(String hexColor) { //Converts hex string to int From bf272220e436cb8480893dd0eed79dfc733e683d Mon Sep 17 00:00:00 2001 From: Yan Min Hong Date: Thu, 22 Apr 2021 22:04:15 -0700 Subject: [PATCH 09/13] Update pubspec.yaml --- pubspec.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pubspec.yaml b/pubspec.yaml index 386b69dfb2..7c3c91f1b7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,13 +5,13 @@ maintainer: Mark O'Sullivan (@MarkOSullivan94) homepage: https://github.com/fluttercommunity/flutter_launcher_icons dependencies: - image: ^2.1.1 - args: ^1.5.0 - yaml: ^2.1.15 + image: ^3.0.2 + args: ^2.1.0 + yaml: ^3.1.0 path: ^1.7.0 environment: sdk: '>=2.3.0 <3.0.0' dev_dependencies: - test: ^1.11.1 + test: ^1.17.1 From f510c52eeedcf0d28f3260e3c0935ac23ecd570e Mon Sep 17 00:00:00 2001 From: Yan Min Hong Date: Thu, 22 Apr 2021 22:13:54 -0700 Subject: [PATCH 10/13] Update pubspec.yaml --- pubspec.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pubspec.yaml b/pubspec.yaml index 7c3c91f1b7..36e174b608 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -6,7 +6,7 @@ homepage: https://github.com/fluttercommunity/flutter_launcher_icons dependencies: image: ^3.0.2 - args: ^2.1.0 + args: ^1.6.0 yaml: ^3.1.0 path: ^1.7.0 @@ -14,4 +14,4 @@ environment: sdk: '>=2.3.0 <3.0.0' dev_dependencies: - test: ^1.17.1 + test: ^1.16.5 From cd98a249e8ed64debb543a713aa583dfc64f389e Mon Sep 17 00:00:00 2001 From: Yan Min Hong Date: Thu, 22 Apr 2021 22:38:49 -0700 Subject: [PATCH 11/13] Update pubspec.yaml --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 36e174b608..326e72c3b3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,7 +5,7 @@ maintainer: Mark O'Sullivan (@MarkOSullivan94) homepage: https://github.com/fluttercommunity/flutter_launcher_icons dependencies: - image: ^3.0.2 + image: ^2.1.19 args: ^1.6.0 yaml: ^3.1.0 path: ^1.7.0 From ff70959dc0c9003cf1741f6390ba1a391147c5ba Mon Sep 17 00:00:00 2001 From: Yan Min Hong Date: Thu, 22 Apr 2021 22:42:10 -0700 Subject: [PATCH 12/13] Update pubspec.yaml --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 326e72c3b3..54c18ae764 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -7,7 +7,7 @@ homepage: https://github.com/fluttercommunity/flutter_launcher_icons dependencies: image: ^2.1.19 args: ^1.6.0 - yaml: ^3.1.0 + yaml: ^2.1.2 path: ^1.7.0 environment: From 3bcfc1131c127ee15faaa460198f167278429408 Mon Sep 17 00:00:00 2001 From: Yan Min Hong Date: Wed, 26 Jan 2022 11:49:08 -0800 Subject: [PATCH 13/13] cleanup --- lib/android.dart | 11 ++++++----- lib/ios.dart | 3 ++- lib/main.dart | 6 +++--- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/android.dart b/lib/android.dart index 2f11578fc3..1ec888b92b 100644 --- a/lib/android.dart +++ b/lib/android.dart @@ -1,10 +1,11 @@ import 'dart:io'; import 'dart:math'; + +import 'package:flutter_launcher_icons/constants.dart' as constants; +import 'package:flutter_launcher_icons/custom_exceptions.dart'; import 'package:flutter_launcher_icons/utils.dart'; import 'package:flutter_launcher_icons/xml_templates.dart' as xml_template; import 'package:image/image.dart'; -import 'package:flutter_launcher_icons/custom_exceptions.dart'; -import 'package:flutter_launcher_icons/constants.dart' as constants; class AndroidIconTemplate { AndroidIconTemplate({required this.size, required this.directoryName}); @@ -110,10 +111,10 @@ void createAdaptiveIcons( foregroundScaleFactor > 0 && foregroundImage != null; - Image rescaledImage; - // Scales the foreground image prior to converting to icon. This is mainly for scaling down to match adaptive icon spec - if (rescale && foregroundImage != null) { + if (rescale) { + Image rescaledImage; + int _getColorFromHex(String hexColor) { //Converts hex string to int hexColor = hexColor.toUpperCase().replaceAll('#', ''); diff --git a/lib/ios.dart b/lib/ios.dart index c051792d94..d60f50fd1f 100644 --- a/lib/ios.dart +++ b/lib/ios.dart @@ -1,8 +1,9 @@ import 'dart:convert'; import 'dart:io'; + +import 'package:flutter_launcher_icons/constants.dart'; import 'package:flutter_launcher_icons/utils.dart'; import 'package:image/image.dart'; -import 'package:flutter_launcher_icons/constants.dart'; /// File to handle the creation of icons for iOS platform class IosIconTemplate { diff --git a/lib/main.dart b/lib/main.dart index 1edea61726..a4bbd4e0ea 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,12 +1,12 @@ import 'dart:io'; import 'package:args/args.dart'; -import 'package:path/path.dart' as path; -import 'package:yaml/yaml.dart'; import 'package:flutter_launcher_icons/android.dart' as android_launcher_icons; -import 'package:flutter_launcher_icons/ios.dart' as ios_launcher_icons; import 'package:flutter_launcher_icons/constants.dart'; import 'package:flutter_launcher_icons/custom_exceptions.dart'; +import 'package:flutter_launcher_icons/ios.dart' as ios_launcher_icons; +import 'package:path/path.dart' as path; +import 'package:yaml/yaml.dart'; const String fileOption = 'file'; const String helpFlag = 'help';