Bug Report: flutter_native_splash Android 12+ Color Update Issue
Summary
The flutter_native_splash plugin (v2.4.7) does not properly update the android:windowSplashScreenBackground color in Android 12+ style files when regenerating splash screens. The plugin keeps hardcoded color values instead of reading from flutter_native_splash.yaml.
Environment
- Plugin Version: flutter_native_splash 2.4.7
- Flutter Version: 3.38.5
- Dart Version: 3.10.4
- Target Platform: Android 12+ (API 31+)
- OS: Windows 11
Steps to Reproduce
-
Create a Flutter project with flutter_native_splash configured in flutter_native_splash.yaml:
flutter_native_splash:
color: "#FFFFFF"
image: assets/splash.png
color_dark: "#042a49"
image_dark: assets/splash_dark.png
android_12:
image: assets/splash.png
image_dark: assets/splash_dark.png
color: "#FFFFFF"
color_dark: "#042a49"
-
Run dart run flutter_native_splash:create
-
Change the colors in flutter_native_splash.yaml:
color: "#FF00FF" # Changed from white to magenta
color_dark: "#00FFFF" # Changed from dark blue to cyan
-
Run dart run flutter_native_splash:create again
-
Build and run the app on an Android 12+ device/emulator
Expected Behavior
The splash screen background should update to the new colors (magenta and cyan).
Actual Behavior
The splash screen continues to show the old colors (white and dark blue). The plugin regenerates all files but does not update the android:windowSplashScreenBackground values in:
android/app/src/main/res/values-v31/styles.xml
android/app/src/main/res/values-night-v31/styles.xml
Root Cause
When the plugin runs, it updates these files:
[Android] - android/app/src/main/res/values-v31/styles.xml
[Android] - android/app/src/main/res/values-night-v31/styles.xml
However, the android:windowSplashScreenBackground property retains the first color value it was generated with and ignores subsequent changes in flutter_native_splash.yaml.
Affected Files
android/app/src/main/res/values-v31/styles.xml (Line 9):
<item name="android:windowSplashScreenBackground">#FFFFFF</item>
<!-- This stays #FFFFFF even after changing color in YAML -->
android/app/src/main/res/values-night-v31/styles.xml (Line 9):
<item name="android:windowSplashScreenBackground">#042a49</item>
<!-- This stays #042a49 even after changing color_dark in YAML -->
Workaround
Manually edit the Android 12+ style files after running dart run flutter_native_splash:create:
-
Open android/app/src/main/res/values-v31/styles.xml
-
Find line with android:windowSplashScreenBackground
-
Change the color to match your color value from flutter_native_splash.yaml
-
Open android/app/src/main/res/values-night-v31/styles.xml
-
Find line with android:windowSplashScreenBackground
-
Change the color to match your color_dark value from flutter_native_splash.yaml
-
Uninstall the old app: adb uninstall <your.package.name>
-
Rebuild and run: flutter run
Additional Notes
- This issue only affects Android 12+ (API 31+) devices
- Android 11 and below work correctly as they use the
drawable/launch_background.xml approach
- The issue persists even after:
- Running
flutter clean
- Deleting and recreating the Android folder
- Uninstalling and reinstalling the app
- Upgrading to the latest plugin version
Suggested Fix
The plugin should read the color and color_dark values from flutter_native_splash.yaml and update the android:windowSplashScreenBackground property in the Android 12+ style files on every regeneration, not just on initial creation.
Impact
This bug makes it impossible to update splash screen colors on Android 12+ devices without manually editing XML files, which defeats the purpose of using a configuration-based plugin.
Bug Report: flutter_native_splash Android 12+ Color Update Issue
Summary
The
flutter_native_splashplugin (v2.4.7) does not properly update theandroid:windowSplashScreenBackgroundcolor in Android 12+ style files when regenerating splash screens. The plugin keeps hardcoded color values instead of reading fromflutter_native_splash.yaml.Environment
Steps to Reproduce
Create a Flutter project with
flutter_native_splashconfigured influtter_native_splash.yaml:Run
dart run flutter_native_splash:createChange the colors in
flutter_native_splash.yaml:Run
dart run flutter_native_splash:createagainBuild and run the app on an Android 12+ device/emulator
Expected Behavior
The splash screen background should update to the new colors (magenta and cyan).
Actual Behavior
The splash screen continues to show the old colors (white and dark blue). The plugin regenerates all files but does not update the
android:windowSplashScreenBackgroundvalues in:android/app/src/main/res/values-v31/styles.xmlandroid/app/src/main/res/values-night-v31/styles.xmlRoot Cause
When the plugin runs, it updates these files:
However, the
android:windowSplashScreenBackgroundproperty retains the first color value it was generated with and ignores subsequent changes influtter_native_splash.yaml.Affected Files
android/app/src/main/res/values-v31/styles.xml(Line 9):android/app/src/main/res/values-night-v31/styles.xml(Line 9):Workaround
Manually edit the Android 12+ style files after running
dart run flutter_native_splash:create:Open
android/app/src/main/res/values-v31/styles.xmlFind line with
android:windowSplashScreenBackgroundChange the color to match your
colorvalue fromflutter_native_splash.yamlOpen
android/app/src/main/res/values-night-v31/styles.xmlFind line with
android:windowSplashScreenBackgroundChange the color to match your
color_darkvalue fromflutter_native_splash.yamlUninstall the old app:
adb uninstall <your.package.name>Rebuild and run:
flutter runAdditional Notes
drawable/launch_background.xmlapproachflutter cleanSuggested Fix
The plugin should read the
colorandcolor_darkvalues fromflutter_native_splash.yamland update theandroid:windowSplashScreenBackgroundproperty in the Android 12+ style files on every regeneration, not just on initial creation.Impact
This bug makes it impossible to update splash screen colors on Android 12+ devices without manually editing XML files, which defeats the purpose of using a configuration-based plugin.