MehdiDx
MehdiDx

Reputation: 15

Stripe , Theme isn't set to use Theme.AppCompat or Theme.MaterialComponents

I am facing an issue when trying to implement Stripe with flutter , I did all what they said in the readme , but I still have this problem : Your theme isn't set to use Theme.AppCompat or Theme.MaterialComponents.

The problem is I updated my styles.xml to this : `

@drawable/launch_background ?android:colorBackground `

I don't know where the problem is , please help me .!

I tried to add this line in AndroidManifest.xml : android:theme="@style/NormalTheme"

and I did all what they said in their readme .

Upvotes: 0

Views: 163

Answers (1)

Rezwan
Rezwan

Reputation: 231

Recently I faced similar issue, so just rewrite your values/styles.xml like this:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
    <style name="LaunchTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
        <!-- Show a splash screen on the activity. Automatically removed when
             the Flutter engine draws its first frame -->
        <item name="android:windowBackground">@drawable/launch_background</item>
    </style>
    <!-- Theme applied to the Android Window as soon as the process has started.
         This theme determines the color of the Android Window while your
         Flutter UI initializes, as well as behind your Flutter UI while its
         running.

         This Theme is only used starting with V2 of Flutter's Android embedding. -->
    <style name="NormalTheme" parent="Theme.MaterialComponents">
        <item name="android:windowBackground">?android:colorBackground</item>
    </style>
</resources>

Also rewrite your values-night/styles.xml like this:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
    <style name="LaunchTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
        <!-- Show a splash screen on the activity. Automatically removed when
             the Flutter engine draws its first frame -->
        <item name="android:windowBackground">@drawable/launch_background</item>
    </style>
    <!-- Theme applied to the Android Window as soon as the process has started.
         This theme determines the color of the Android Window while your
         Flutter UI initializes, as well as behind your Flutter UI while its
         running.

         This Theme is only used starting with V2 of Flutter's Android embedding. -->
    <style name="NormalTheme" parent="Theme.MaterialComponents">
        <item name="android:windowBackground">?android:colorBackground</item>
    </style>
</resources>

Happy coding! :)

Upvotes: 0

Related Questions