diff --git a/CHANGELOG.md b/CHANGELOG.md index 3278ccd..e0ab3e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [2.2.7] - (2022-July-31) + +- Remove branding on Android 12 if branding is not specified. Fixes [#399](https://github.com/jonbhanson/flutter_native_splash/issues/399). + ## [2.2.6] - (2022-July-24) - Fix parseColor test. Thanks [mihiro](https://github.com/mihiron) for [PR #393](https://github.com/jonbhanson/flutter_native_splash/pull/393). diff --git a/README.md b/README.md index 117e875..593d174 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ First, add `flutter_native_splash` as a dependency in your pubspec.yaml file. ```yaml dependencies: - flutter_native_splash: ^2.2.6 + flutter_native_splash: ^2.2.7 ``` Don't forget to `flutter pub get`. diff --git a/lib/android.dart b/lib/android.dart index e6762f9..2a00fac 100644 --- a/lib/android.dart +++ b/lib/android.dart @@ -173,7 +173,10 @@ void _createAndroidSplash({ android12BrandingImagePath: brandingImagePath, ); - if (darkColor != null || darkBackgroundImage != null) { + if (android12DarkBackgroundColor != null || + android12DarkImagePath != null || + darkAndroid12IconBackgroundColor != null || + brandingDarkImagePath != null) { _applyStylesXml( fullScreen: fullscreen, file: _flavorHelper.androidV31StylesNightFile, @@ -388,7 +391,12 @@ Future _updateStylesFile({ ); // In Android 12, the color must be set directly in the styles.xml - if (android12BackgroundColor != null) { + if (android12BackgroundColor == null) { + removeElement( + launchTheme: launchTheme, + name: 'android:windowSplashScreenBackground', + ); + } else { replaceElement( launchTheme: launchTheme, name: 'android:windowSplashScreenBackground', @@ -396,15 +404,12 @@ Future _updateStylesFile({ ); } - if (android12BrandingImagePath != null) { - replaceElement( + if (android12BrandingImagePath == null) { + removeElement( launchTheme: launchTheme, name: 'android:windowSplashScreenBrandingImage', - value: '@drawable/branding', ); - } - - if (android12BrandingImagePath != null) { + } else { replaceElement( launchTheme: launchTheme, name: 'android:windowSplashScreenBrandingImage', @@ -412,7 +417,12 @@ Future _updateStylesFile({ ); } - if (android12ImagePath != null) { + if (android12ImagePath == null) { + removeElement( + launchTheme: launchTheme, + name: 'android:windowSplashScreenAnimatedIcon', + ); + } else { replaceElement( launchTheme: launchTheme, name: 'android:windowSplashScreenAnimatedIcon', @@ -420,7 +430,12 @@ Future _updateStylesFile({ ); } - if (android12IconBackgroundColor != null) { + if (android12IconBackgroundColor == null) { + removeElement( + launchTheme: launchTheme, + name: 'android:windowSplashScreenIconBackgroundColor', + ); + } else { replaceElement( launchTheme: launchTheme, name: 'android:windowSplashScreenIconBackgroundColor', diff --git a/pubspec.yaml b/pubspec.yaml index 821316b..0a0c12b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: flutter_native_splash description: Customize Flutter's default white native splash screen with background color and splash image. Supports dark mode, full screen, and more. -version: 2.2.6 +version: 2.2.7 homepage: https://github.com/jonbhanson/flutter_native_splash environment: