From 869bfa127dd77252cb843bc19d3a86aefb50e145 Mon Sep 17 00:00:00 2001 From: Carapacik Date: Tue, 26 Jul 2022 15:55:26 +0300 Subject: [PATCH] Fix error with adaptive_background_color and round image on android --- lib/src/android.dart | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/src/android.dart b/lib/src/android.dart index 1e06392..dc8e99d 100644 --- a/lib/src/android.dart +++ b/lib/src/android.dart @@ -110,7 +110,7 @@ void _createAndroidAdaptiveIcon({ _createAdaptiveForeground(adaptiveIcons, foreground); _createAdaptiveBackground(adaptiveIcons, background); if (round != null) { - _createAdaptiveRound(androidIcons, round); + _createAdaptiveRound(androidIcons, round, isValidHexaCode(background)); } else { _removeAndroidManifestIconLauncherRound(); } @@ -189,6 +189,7 @@ void _createAdaptiveForeground( void _createAdaptiveRound( List adaptiveIcons, String round, + bool backgroundIsColor, ) { final roundImage = Icon.loadFile(round); if (roundImage == null) { @@ -210,7 +211,7 @@ void _createAdaptiveRound( 'Generated adaptive round images', level: CliLoggerLevel.two, ); - _createIcLauncherRoundMipMapXmlFile(); + _createIcLauncherRoundMipMapXmlFile(backgroundIsColor); _createAndroidManifestIconLauncherRound(); } @@ -322,11 +323,13 @@ void _createIcLauncherMipMapXmlFile() { // } /// Create ic_launcher_round.xml file -void _createIcLauncherRoundMipMapXmlFile() { +void _createIcLauncherRoundMipMapXmlFile(bool backgroundIsColor) { final icLauncherXml = File( '${_flavorHelper.androidResFolder}$ANDROID_ADAPTIVE_XML_DIR/$ANDROID_ADAPTIVE_ROUND_XML_FILE_NAME'); icLauncherXml.createSync(recursive: true); - icLauncherXml.writeAsStringSync(IC_LAUNCHER_ROUND_MIP_MAP_XML); + icLauncherXml.writeAsStringSync(backgroundIsColor + ? IC_LAUNCHER_ROUND_BACKGROUND_COLOR_XML + : IC_LAUNCHER_ROUND_MIP_MAP_XML); CliLogger.success( 'Created `$ANDROID_ADAPTIVE_ROUND_XML_FILE_NAME`', level: CliLoggerLevel.two,