Change Splash Screen Color Programmatically in Flutter

断了今生、忘了曾经 提交于 2020-06-25 05:50:12

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/60115160/change-splash-screen-color-programmatically-in-flutter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!