Search code examples
fluttersplash-screenandroid-splashscreen

Flutter splashscreen not full screen android 12


I am creating a flutter app with a splashscreen. I have used the flutter_native_splash package however I cannot get it to fill the whole screen no matter what I change in manifest.xml, styles.xml and launch_background.xml. It starts with a circle with an image then transitions to fulscreen. I would like it to be fullscreen the whole time.

This is my pubspec.yaml code

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^1.0.2
  flutter_native_splash: ^2.2.9

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_lints: ^2.0.0

flutter_native_splash:
  color: "#ffffff"
  image: assets/images/rasta.png
  # branding: assets/images/rasta.png
  color_dark: "#121212"
  image_dark: assets/images/rasta.png
  # branding_dark: assets/images/rasta.png
  fullscreen: true
  
  android_12:
    image: assets/images/rasta.png
    icon_background_color: "#ffffff"
    image_dark: assets/images/rasta.png
    icon_background_color_dark: "#121212"
    fullscreen: true

This is my manifest.xml code

            <!-- Specifies an Android theme to apply to this Activity as soon as
                 the Android process has started. This theme is visible to the user
                 while the Flutter UI initializes. After that, this theme continues
                 to determine the Window background behind the Flutter UI. -->
            <meta-data
              android:name="io.flutter.embedding.android.LaunchTheme"
              android:resource="@style/LaunchTheme"
              />
              <!-- Displays an Android View that continues showing the launch screen
                 Drawable until Flutter paints its first frame, then this splash
                 screen fades out. A splash screen is useful to avoid any visual
                 gap between the end of Android's launch screen and the painting of
                 Flutter's first frame. -->
            <meta-data
              android:name="io.flutter.embedding.android.SplashScreenDrawable"
              android:resource="@drawable/launch_background"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />

This is my launch_background.xml code

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <bitmap android:gravity="fill" android:src="@drawable/background"/>
    </item>
    <item>
        <bitmap android:gravity="fill" android:src="@drawable/splash"/>
    </item>
</layer-list>

This is my styles.xml code

    <!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
    <style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
        <!-- 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>
        <item name="android:forceDarkAllowed">false</item>
        <item name="android:windowFullscreen">true</item>
        <item name="android:windowLayoutInDisplayCutoutMode">shortEdges</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="@android:style/Theme.Light.NoTitleBar">
        <item name="android:windowBackground">@drawable/launch_background</item>
    </style>

These are the images

first splashscreen desired splashscreen

How can I make the splashscreen be fullscreen always and not start with the first image


Solution

  • Sorry, this is not possible. Starting in Android 12, Full screen splash screens are not supported. Documentation