android – Change Splash Screen Color Programmatically in Flutter-ThrowExceptions

Exception or error:

launch_background.xml

<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@color/orange" />
    <!-- You can insert your own image assets here -->
    <item>
        <bitmap
            android:gravity="center"
            android:src="@drawable/splash_icon" />
    </item> -->
</layer-list>

styles.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
        <!-- Show a splash screen on the activity. Automatically removed when
             Flutter draws its first frame -->
        <item name="android:windowBackground">@drawable/launch_background</item>
    </style>
    <color name="orange">#FF9800</color>
</resources>

I change the primary color value in the app dynamically and set theme colors for app. How can I send the primary color value here –> <color name="orange">#FF9800</color>

Also what should I do for IOS?

How to solve:

As far as I know, you can’t change values of an XML file programmatically.

Leave a Reply

Your email address will not be published. Required fields are marked *