Automatically generates native code for adding splash screens in Android and iOS.

Related tags

Media dart flutter
Overview

pub package Build Status

When your app is opened, there is a brief time while the native app loads Flutter. By default, during this time, the native app displays a white splash screen. This package automatically generates iOS, Android, and Web-native code for customizing this native splash screen background color and splash image. Supports dark mode, full screen, and platform-specific options.

Usage

Would you prefer a video tutorial instead? Check out Johannes Milke's tutorial.

First, add flutter_native_splash as a dev dependency in your pubspec.yaml file. It belongs in dev_dependencies because it is a command line tool. Please disregard the instructions in the Installing tab that gives different instructions.

dev_dependencies:
  flutter_native_splash: ^1.3.3

Don't forget to flutter pub get.

1. Setting the splash screen

Customized the following settings and add to your project's pubspec.yaml file or place in a new file in your root project folder named flutter_native_splash.yaml.

flutter_native_splash:

  # This package generates native code to customize Flutter's default white native splash screen
  # with background color and splash image.
  # Customize the parameters below, and run the following command in the terminal:
  # flutter pub run flutter_native_splash:create
  # To restore Flutter's default white splash screen, run the following command in the terminal:
  # flutter pub run flutter_native_splash:remove

  # color or background_image is the only required parameter.  Use color to set the background
  # of your splash screen to a solid color.  Use background_image to set the background of your
  # splash screen to a png image.  This is useful for gradients. The image will be stretch to the
  # size of the app. Only one parameter can be used, color and background_image cannot both be set.
  color: "#42a5f5"
  #background_image: "assets/background.png"

  # Optional parameters are listed below.  To enable a parameter, uncomment the line by removing
  # the leading # character.

  # The image parameter allows you to specify an image used in the splash screen.  It must be a
  # png file and should be sized for 4x pixel density.
  #image: assets/splash.png

  # This property allows you to specify an image used as branding in the splash screen. It must be
  # a png file. Currently, it is only supported for Android and iOS.
  branding: assets/dart.png

  # Specify your branding image for dark mode.
  #branding_dark: assets/dart_dark.png

  # To position the branding image at the bottom of the screen you can use bottom, bottomRight,
  # and bottomLeft. The default values is bottom if not specified or specified something else.
  #
  # Make sure this content mode value should not be similar to android_gravity value and ios_content_mode
  # value.
  branding_mode: bottom

  # The color_dark, background_image_dark, and image_dark are parameters that set the background
  # and image when the device is in dark mode. If they are not specified, the app will use the
  # parameters from above. If the image_dark parameter is specified, color_dark or
  # background_image_dark must be specified.  color_dark and background_image_dark cannot both be
  # set.
  #color_dark: "#042a49"
  #background_image_dark: "assets/dark-background.png"
  #image_dark: assets/splash-invert.png

  # The android, ios and web parameters can be used to disable generating a splash screen on a given
  # platform.
  #android: false
  #ios: false
  #web: false

  # The position of the splash image can be set with android_gravity, ios_content_mode, and
  # web_image_mode parameters.  All default to center.
  #
  # android_gravity can be one of the following Android Gravity (see
  # https://developer.android.com/reference/android/view/Gravity): bottom, center,
  # center_horizontal, center_vertical, clip_horizontal, clip_vertical, end, fill, fill_horizontal,
  # fill_vertical, left, right, start, or top.
  #android_gravity: center
  #
  # ios_content_mode can be one of the following iOS UIView.ContentMode (see
  # https://developer.apple.com/documentation/uikit/uiview/contentmode): scaleToFill,
  # scaleAspectFit, scaleAspectFill, center, top, bottom, left, right, topLeft, topRight,
  # bottomLeft, or bottomRight.
  #ios_content_mode: center
  #
  # web_image_mode can be one of the following modes: center, contain, stretch, and cover.
  #web_image_mode: center

  # To hide the notification bar, use the fullscreen parameter.  Has no affect in web since web
  # has no notification bar.  Defaults to false.
  # NOTE: Unlike Android, iOS will not automatically show the notification bar when the app loads.
  #       To show the notification bar, add the following code to your Flutter app:
  #       WidgetsFlutterBinding.ensureInitialized();
  #       SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom, SystemUiOverlay.top]);
  #fullscreen: true
  
  # If you have changed the name(s) of your info.plist file(s), you can specify the filename(s) 
  # with the info_plist_files parameter.  Remove only the # characters in the three lines below,
  # do not remove any spaces:
  #info_plist_files:
  #  - 'ios/Runner/Info-Debug.plist'
  #  - 'ios/Runner/Info-Release.plist'

2. Run the package

After adding your settings, run the following command in the terminal:

flutter pub run flutter_native_splash:create

When the package finishes running, your splash screen is ready.

To specify the YAML file location just add --path with the command in the terminal:

flutter pub run flutter_native_splash:create --path=path/to/my/file.yaml

Android 12 Support

Android 12 has a new method of adding splash screens, which consists of a window background, icon, and the icon background. Currently, this package supports setting the background color and the icon is taken from the launcher icon.

If you enable Android 12 support, the package will add a styles.xml in values-v31 and values-night-v31 resource folders, which will provide Android 12 support while maintaining the legacy splash screen for previous versions of Android.

NOTE: The splash screen may not appear when you launch the app from Android Studio. However, it should appear when you launch by clicking on the launch icon in Android.

Recommendations

Secondary splash screen:

The native splash screen is displayed while the native app loads the Flutter framework. Once Flutter loads, there are probably still resources that need to be loaded before your app is ready. For this reason, you should consider implementing a secondary Flutter splash screen or placeholders that display while these resources load. The example shows an implementation of a secondary splash screen.

FAQs

I got the error "A splash screen was provided to Flutter, but this is deprecated."

This message is not related to this package but is related to a change in how Flutter handles splash screens in Flutter 2.5. It is caused by having the following code in your AndroidManifest.xml, which was included by default in previous versions of Flutter:

">
<meta-data
 android:name="io.flutter.embedding.android.SplashScreenDrawable"
 android:resource="@drawable/launch_background"
 />

The solution is to remove the above code. Note that this will also remove the fade effect between the native splash screen and your app.

Can I change the duration of the splash screen?

No, it is not possible to change the duration of the splash screen. The native splash screen is displayed while the native app loads the Flutter framework. Because the resources in your app cannot load while the native splash screen is displayed, the native splash screen must be as fast as possible. Note that delaying the user experience is a poor design decision.

Are animations/lottie/GIF images supported?

Not at this time. However, you may want to consider a secondary splash screen that supports animation. See the secondary splash screen recommendation.

I got the error AAPT: error: style attribute 'android:attr/windowSplashScreenBackground' not found

This attribute is only found in Android 12, so if you are getting this error, it means your project is not fully set up for Android 12. Did you update your app's build configuration?

I see a flash of the wrong splash screen on iOS

This is caused by an iOS splash caching bug, which can be solved by uninstalling your app, powering off your device, power back on, and then try reinstalling.

I see a white screen between splash screen and app

  1. It may be caused by an iOS splash caching bug, which can be solved by uninstalling your app, powering off your device, power back on, and then try reinstalling.
  2. It may be caused by the delay due to initialization in your app. To test this, make a test where your main() returns a Container(color: Colors.black);. If the white flash goes away, it will show that your content is not loading fast enough. You could solve this by creating a secondary splash screen or loading a barebones version of your app with placeholders, and then populate the placeholders as content loads.

Notes

  • If the splash screen was not updated correctly on iOS or if you experience a white screen before the splash screen, run flutter clean and recompile your app. If that does not solve the problem, delete your app, power down the device, power up the device, install and launch the app as per this StackOverflow thread.

  • This package modifies launch_background.xml and styles.xml files on Android, LaunchScreen.storyboard and Info.plist on iOS, and index.html on Web. If you have modified these files manually, this plugin may not work properly. Please open an issue if you find any bugs.

How it works

Android

  • Your splash image will be resized to mdpi, hdpi, xhdpi, xxhdpi and xxxhdpi drawables.
  • An tag containing a for your splash image drawable will be added in launch_background.xml
  • Background color will be added in colors.xml and referenced in launch_background.xml.
  • Code for full screen mode toggle will be added in styles.xml.
  • Dark mode variants are placed in drawable-night, values-night, etc. resource folders.

iOS

  • Your splash image will be resized to @3x and @2x images.
  • Color and image properties will be inserted in LaunchScreen.storyboard.
  • The background color is implemented by using a single-pixel png file and stretching it to fit the screen.
  • Code for hidden status bar toggle will be added in Info.plist.

Web

  • A web/splash folder will be created for splash screen images and CSS files.
  • Your splash image will be resized to 1x, 2x, 3x, and 4x sizes and placed in web/splash/img.
  • The splash style sheet will be added to the app's web/index.html, as well as the HTML for the splash pictures.

Removing

If you would like to restore Flutter's default white splash screen, run the following command in the terminal:

flutter pub run flutter_native_splash:remove

Acknowledgments

This package was originally created by Henrique Arthur and it is currently maintained by Jon Hanson.

Bugs or Requests

If you encounter any problems feel free to open an issue. If you feel the library is missing a feature, please raise a ticket. Pull request are also welcome.

Comments
  • The plugin changes the color from the background to the Splash

    The plugin changes the color from the background to the Splash

    The plugin changes the color from the background to the Splash, that color is not defined anywhere in the configuration

    When opening the app, it comes out normal, after a few milliseconds it changes to an undefined color, everything happens after the native screen and before the flutter screen.

    Uninstall the app and continue with the same behavior.

    https://user-images.githubusercontent.com/26438532/123553761-76dcd580-d77d-11eb-9b7e-2e724d1015f2.mp4

    Device (please complete the following information):

    • Device: [Xiaomi Redmi Note 7]
    • OS: [Android 10]

    Flutter doctor

    [√] Flutter (Channel stable, 2.2.1, on Microsoft Windows [Versión 10.0.19043.1023], locale es-US)
        • Flutter version 2.2.1 at C:\src\flutter
        • Framework revision 02c026b03c (4 weeks ago), 2021-05-27 12:24:44 -0700
        • Engine revision 0fdb562ac8
        • Dart version 2.13.1
    
    [√] Android toolchain - develop for Android devices (Android SDK version 30.0.2) 
        • Android SDK at E:\Programas\SDK
        • Platform android-30, build-tools 30.0.2
        • ANDROID_SDK_ROOT = E:\Programas\SDK
        • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java       
        • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
        • All Android licenses accepted.
    
    [√] Chrome - develop for the web
        • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
    
    [√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.9.0)       
        • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
        • Visual Studio Community 2019 version 16.9.31025.194
        • Windows 10 SDK version 10.0.18362.0
    
    [√] Android Studio (version 4.1.0)
        • Android Studio at C:\Program Files\Android\Android Studio
        • Flutter plugin can be installed from:
           https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
           https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    
    [√] VS Code (version 1.57.1)
        • VS Code at C:\Users\Yeikel\AppData\Local\Programs\Microsoft VS Code
        • Flutter extension version 3.23.0
    
    [√] Connected device (4 available)
        • Redmi Note 7 (mobile) • d97ede0d • android-arm64  • Android 10 (API 29)
        • Windows (desktop)     • windows  • windows-x64    • Microsoft Windows [Versión 10.0.19043.1023]
        • Chrome (web)          • chrome   • web-javascript • Google Chrome 91.0.4472.77
        • Edge (web)            • edge     • web-javascript • Microsoft Edge 91.0.864.54
    
    opened by yeikel16 38
  • iOS - White screen before splash screen

    iOS - White screen before splash screen

    Hi, thanks for the wonderful package. It saved me a lot of time. I have a small issue with the iOS splash screen. It works fine, but there's a white screen right before the splash screen that I specified. Have you seen this before or would you know of a way to get rid of that initial white screen? Thanks

    • Edit: device is iPhone 6
    bug 
    opened by Aljulanda9 34
  • Black Statusbar on Splashscreen

    Black Statusbar on Splashscreen

    I'm having the same issue described in the previous #248. With Android I'm finding a black status bar during all the splash screen.

    I've used the the option fullscreen: true. But it's still appearing.

    Not sure if the notch on the mobile has something to do with that.

    I would like the status bar to be removed or, if possible, change its color to be white, that would be enough in my case.

    Expected behavior I was expecting the status bar to be removed or, at least, to have the same color as the defined in the background.

    Device (please complete the following information):

    • Device: OnePlus 7
    • OS: Android 11

    Flutter doctor [✓] Flutter (Channel stable, 2.10.2, on macOS 12.2.1 21D62 darwin-x64, locale es-ES) • Flutter version 2.10.2 at /Users/ccebrecos/Code/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 097d3313d8 (hace 3 semanas), 2022-02-18 19:33:08 -0600 • Engine revision a83ed0e5e3 • Dart version 2.16.1 • DevTools version 2.9.2

    [✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1) • Android SDK at /Users/ccebrecos/Library/Android/sdk • Platform android-32, build-tools 32.1.0-rc1 • Java binary at: /Users/ccebrecos/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/211.7628.21.2111.8139111/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822) • All Android licenses accepted.

    [✓] Xcode - develop for iOS and macOS (Xcode 13.2.1) • Xcode at /Applications/Xcode.app/Contents/Developer • CocoaPods version 1.11.2

    [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

    [✓] Android Studio (version 2021.1) • Android Studio at /Users/ccebrecos/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/211.7628.21.2111.8139111/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)

    [✓] IntelliJ IDEA Ultimate Edition (version 2021.3.2) • IntelliJ at /Users/ccebrecos/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart

    [✓] IntelliJ IDEA Ultimate Edition (version 2021.3.2) • IntelliJ at /Users/ccebrecos/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/213.6777.52/IntelliJ IDEA.app • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart

    [✓] IntelliJ IDEA Ultimate Edition (version 2021.3.1) • IntelliJ at /Users/ccebrecos/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/213.6461.79/IntelliJ IDEA.app • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart

    [✓] Connected device (1 available) • Chrome (web) • chrome • web-javascript • Google Chrome 99.0.4844.51

    [✓] HTTP Host Availability • All required HTTP hosts are available

    • No issues found!

    opened by ccebrecos 30
  • Splash icon not working

    Splash icon not working

    Describe the bug App Icon not visible in splash screen

    flutter_native_splash: image: lib/assets/images/splash.png color: "#16A3AD" fullscreen: true

    Expected behavior App Icon not visible in splash screen

    Screenshots Screenshot_20220725_004036

    Device (please complete the following information):

    • Device: Pixel 4 Api 30 Emulator
    • OS: Android 11

    Flutter doctor [√] Flutter (Channel stable, 3.0.5, on Microsoft Windows [Version 10.0.22000.795], locale en-GB) • Flutter version 3.0.5 at C:\Users\haide_bue2l28\Documents\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision f1875d570e (11 days ago), 2022-07-13 11:24:16 -0700 • Engine revision e85ea0e79c • Dart version 2.17.6 • DevTools version 2.12.2

    [√] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at C:\Users\haide_bue2l28\AppData\Local\Android\sdk • Platform android-31, build-tools 31.0.0 • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840) • All Android licenses accepted.

    [√] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

    [X] Visual Studio - develop for Windows X Visual Studio not installed; this is necessary for Windows development. Download at https://visualstudio.microsoft.com/downloads/. Please install the "Desktop development with C++" workload, including all of its default components

    [√] Android Studio (version 2021.2) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)

    [√] VS Code (version 1.69.2) • VS Code at C:\Users\haide_bue2l28\AppData\Local\Programs\Microsoft VS Code • Flutter extension can be installed from: https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

    [√] Connected device (4 available) • sdk gphone x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22000.795] • Chrome (web) • chrome • web-javascript • Google Chrome 103.0.5060.134 • Edge (web) • edge • web-javascript • Microsoft Edge 103.0.1264.71

    [√] HTTP Host Availability • All required HTTP hosts are available

    ! Doctor found issues in 1 category.

    Additional context Add any other context about the problem here.

    opened by Shahzeb-99 25
  • Image isn't displayed on splash screen on Android 12

    Image isn't displayed on splash screen on Android 12

    Describe the bug Image is not being shown on splash screen

    To Reproduce

    1. add to dev_dependenciesflutter_native_splash: ^2.0.4
    2. add config to pubspec.yaml
    flutter_native_splash:
      color: "#232323"
      image: assets/icon/test.png
    
    1. run flutter clean && flutter pub get && flutter pub run flutter_native_splash:create
    2. Launch app

    Expected behavior Show the image on top of the background

    Screenshots If applicable, add screenshots to help explain your problem.

    Device (please complete the following information):

    • Device: Pixel 3a XL
    • OS: Android 12
    **Flutter doctor**
    [√] Flutter (Channel stable, 2.10.1, on Microsoft Windows [Versión 10.0.19044.1526], locale es-ES)
        • Flutter version 2.10.1 at C:\flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision db747aa133 (6 days ago), 2022-02-09 13:57:35 -0600
        • Engine revision ab46186b24
        • Dart version 2.16.1
        • DevTools version 2.9.2
    
    [√] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
        • Android SDK at S:\ADB
        • Platform android-32, build-tools 32.1.0-rc1
        • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
        • Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)
        • All Android licenses accepted.
    
    [√] Chrome - develop for the web
        • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
    
    [√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.5)
        • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
        • Visual Studio Community 2019 version 16.11.31729.503
        • Windows 10 SDK version 10.0.19041.0
    
    [√] Android Studio (version 2021.1)
        • Android Studio at C:\Program Files\Android\Android Studio
        • Flutter plugin can be installed from:
           https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
           https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)
    
    [√] IntelliJ IDEA Ultimate Edition (version 2021.2)
        • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA 2021.2
        • Flutter plugin can be installed from:
           https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
           https://plugins.jetbrains.com/plugin/6351-dart
    
    [√] VS Code (version 1.64.2)
        • VS Code at C:\Users\Kevin\AppData\Local\Programs\Microsoft VS Code
        • Flutter extension version 3.34.0
    
    [√] Connected device (4 available)
        • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64    • Android 12 (API 31) (emulator)
        • Windows (desktop)            • windows       • windows-x64    • Microsoft Windows [Versión 10.0.19044.1526]
        • Chrome (web)                 • chrome        • web-javascript • Google Chrome 98.0.4758.82
        • Edge (web)                   • edge          • web-javascript • Microsoft Edge 98.0.1108.50
    
    [√] HTTP Host Availability
        • All required HTTP hosts are available
    
    • No issues found!
    

    Additional context I'm sure the image works as I'm using the same for the Icon.

    opened by kevinpita 21
  • Flavor support?

    Flavor support?

    Do you have flavor support? Expected behavior similar to the launcher icons where I name different files and run the command with a custom file name. I tried that here but failed because it couldn't find the flutter_native_splash section. Is there another way to do it?

    feature request 
    opened by EinatK 20
  • Black screen that shows up between the splash screen and my app's first screen

    Black screen that shows up between the splash screen and my app's first screen

    Config used: Tested with Android Device

    dev_dependencies: flutter_native_splash: ^0.1.9

    flutter_native_splash: image: assets/icon/...-splash.png color: "#ffffff"

    opened by skystar7 20
  • Image not displaying on Android 12 Samsung galaxy S21 FE

    Image not displaying on Android 12 Samsung galaxy S21 FE

    Describe the bug On Android 12 Samsung galaxy S21 FE the splash screen image is not displaying. Tested as working on Android 10.

    To Reproduce Steps to reproduce the behavior: flutter_native_splash: color: "#199ABE" android_12: image: assets/images/png/splash_logo_android12.png android: true ios: true android_gravity: center ios_content_mode: center

    Expected behavior Expected to see splash image in centre of screen.

    Screenshots If applicable, add screenshots to help explain your problem. screenshot1

    Device (please complete the following information):

    • Device: Samsung galaxy S21 FE
    • OS: Android 12

    Flutter doctor Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.0.0, on Ubuntu 20.04.4 LTS 5.13.0-41-generic, locale en_GB.UTF-8) [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0) [✓] Chrome - develop for the web [✓] Linux toolchain - develop for Linux desktop [✓] Android Studio (version 2021.1) [✓] Android Studio [✓] IntelliJ IDEA Ultimate Edition (version 2022.1) [✓] Connected device (3 available) [✓] HTTP Host Availability

    • No issues found!

    Additional context Add any other context about the problem here.

    opened by Cyansuperfrog 16
  • white screen, between splash screen and app

    white screen, between splash screen and app

    Describe the bug

    there is have a white screen, between splash screen and app. how can I solve this problem?

    Expected behavior I don't want to this white screen

    Screenshots If applicable, add screenshots to help explain your problem.

    https://user-images.githubusercontent.com/40922460/123523899-f44e0a80-d6d7-11eb-8bab-354c3f7609ef.mov

    Device (please complete the following information):

    • Device: [e.g. iPhone611]
    • OS: [e.g. iOS 14.5 simulator]

    Flutter doctor [✓] Flutter (Channel stable, 2.2.0, on macOS 11.4 20F71 darwin-x64, locale en-AZ) • Flutter version 2.2.0 at /Users/shahmirzali/Development/flutter • Framework revision b22742018b (6 weeks ago), 2021-05-14 19:12:57 -0700 • Engine revision a9d88a4d18 • Dart version 2.13.0

    [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at /Users/shahmirzali/Library/Android/sdk • Platform android-30, build-tools 30.0.3 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495) • All Android licenses accepted.

    [✓] Xcode - develop for iOS and macOS • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 12.5, Build version 12E262 • CocoaPods version 1.10.1

    [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

    [✓] Android Studio (version 4.1) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

    [✓] VS Code (version 1.57.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.23.0

    [✓] Connected device (2 available) • iPhone 11 (mobile) • BEA3DE1D-CF21-4F28-8BF3-DE9A90E56C0E • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator) • Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.114

    • No issues found!

    opened by sahmirzali 16
  • Failed to load resource: the server responded with a status of 404 ()

    Failed to load resource: the server responded with a status of 404 ()

    Screenshot 2021-08-04 at 3 14 22 PM When I upload the build on the server after the launch of the app I am getting this issue.

    /splash/img/light-background.png 404

    and when I try to put a custom image with the same name it's showing two images on the splash.
    Screenshot 2021-08-04 at 3 15 37 PM

    opened by rohitchaurasiya151 14
  • pub finished with exit code 255

    pub finished with exit code 255

    Hi,

    Just saw your link on reddit and wanted to give it a try.

    Here's the error code: flutter pub pub run flutter_native_splash:create [Android] Creating splash images [Android] Updating launch_background.xml with splash image path [iOS] Creating splash images [iOS] Updating LaunchScreen.storyboard with width, height and color Unhandled exception: RangeError: Invalid value: Only valid value is 0: -1 #0 List.insert (dart:core-patch/growable_array.dart:11:7) #1 _updateLaunchBackgroundFileWithImagePath (package:flutter_native_splash/android.dart:104:11) <asynchronous suspension> #2 _applyLaunchBackgroundXml (package:flutter_native_splash/android.dart:77:12) #3 createSplash (package:flutter_native_splash/android.dart:26:9) <asynchronous suspension> #4 createSplash (package:flutter_native_splash/flutter_native_splash.dart:18:5) #5 main (file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_native_splash-0.1.4/bin/create.dart:5:3) #6 _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32) #7 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12) pub finished with exit code 255

    bug 
    opened by lubi888 14
  • Splash screen looks dark even when color is set to

    Splash screen looks dark even when color is set to "#ffffff"

    Attention: If you open a bug report without sufficient details, it will be closed. Is your question related to Android 12? Please check the notes on Android 12 first (https://pub.dev/packages/flutter_native_splash#android-12-support).

    Describe the bug

    I am setting up the splash screen for android and ios. I am on a dark theme on my device settings. I need the splash screen to be on light theme always even regardless of device theme. However, I get dark theme on device dark mode and light theme on device light mode. The splash screen goes dark or light according to device theme mode.

    I have setup as below.

    Configuration

    File: flutter_native_splash.yaml

    flutter_native_splash:
      color: "#ffffff"
      image: assets/images/splash/app_icon_with_bg.png
    
      android_12:
        image: assets/images/splash-v31/app_icon_with_bg_v31_1152.png
    
      web: false
    

    Device (please complete the following information):

    • Device: Poco F3 Pro
    • OS: Android 12

    To Reproduce Steps to reproduce the behavior, using the example app:

    1. Setup a sample project
    2. Setup native splash.
    3. Set above config.
    4. Generate the splash.
    5. Run the project on android in dark theme.
    6. The splash screen should be dark right now even though color_dark is not specified.
    opened by ExpertKiD 1
  • android 12 splash

    android 12 splash

    Right now I'm more like this problem https://issuetracker.google.com/issues/199776339?pli=1 But I turned on the cold boot, there is no boot map Hot start is on how to solve this please

    opened by jacky70638 1
  • Icon image does not display and app startup color issues

    Icon image does not display and app startup color issues

    I previously had this package installed and it worked great, but migrating to new version I'm doing something wrong.

    As stated in your FAQ I removed the following from AndroidManifest.xml

    <meta-data
                    android:name="io.flutter.embedding.android.SplashScreenDrawable"
                    android:resource="@drawable/launch_background"
                    />
    
    No errors running flutter pub run flutter_native_splash:create

    [Android] Creating default splash images [Android] Creating default android12splash images [Android] Creating dark mode android12splash images [Android] Updating launch background(s) with splash image path... [Android] - android/app/src/main/res/drawable/launch_background.xml [Android] - android/app/src/main/res/drawable-v21/launch_background.xml [Android] Updating styles... [Android] - android/app/src/main/res/values-v31/styles.xml [Android] - android/app/src/main/res/values-night-v31/styles.xml [Android] - android/app/src/main/res/values/styles.xml [iOS] Creating images [iOS] Updating ios/Runner/Info.plist for status bar hidden/visible [Web] Creating images [Web] Creating images [Web] Creating background images [Web] Creating CSS [Web] Updating index.html ╔════════════════════════════════════════════════════════════════════════════╗ ║ WHAT IS NEW: ║ ╠════════════════════════════════════════════════════════════════════════════╣ ║ You can now keep the splash screen up while your app initializes! ║ ║ No need for a secondary splash screen anymore. Just use the remove() ║ ║ method to remove the splash screen after your initialization is complete. ║ ║ Check the docs for more info. ║ ╚════════════════════════════════════════════════════════════════════════════╝

    ✅ Native splash complete. Now go finish building something awesome! 💪 You rock! 🤘🤩 Like the package? Please give it a 👍 here: https://pub.dev/packages/flutter_native_splash

    Three issues I'm seeing:

    1. The icon I have specified in yaml does not display at any time during startup.
    2. During app startup, the color goes from #46468d (purple), which is correct, to black (incorrect), then white (incorrect), and then the app opens.
    3. Full screen is still showing status bar. Maybe I'm misunderstanding what full screen means.

    In main.dart

    WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
    
    FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
    
    /// Directly before runApp
    FlutterNativeSplash.remove();
    

    Configuration

    Using flutter_native_splash: ^2.2.16

    flutter_native_splash:
      color: "#46468d"
      image: assets/images/wakieup-logo-splash.png
      android_12:
        image: assets/images/wakieup-logo-splash.png
        color: "#46468d"
      fullscreen: true
      android12: true
      android: true
      web: true
      ios: true
    

    Device:

    • Device: Pixel 5 (Running in emulator)
    • OS: Android API 32 (Android 12)

    To Reproduce This must be something subjective to my setup? I've tried flutter clean and running flutter pub run flutter_native_splash:create several times, but the icon never shows up and the startup colors are not consistently purple as expected.

    Screenshots

    Color is correct, but assets/images/wakieup-logo-splash.png does not display.

    image

    Additional context

    My 960 x 960 icon image that should be displaying during startup.

    wakieup-logo-splash

    opened by Zelfapp 1
  • android12 splash screen

    android12 splash screen

    Opening the app for the first time, there is no splash screen The second boot is fine This issue is limited to Android 12 and above

    Recreate a flutter project Start directly, and there is still this problem of no startup screen

    This refers to no startup screen There is a background color, but the launch image does not appear Only open for the first time

    android/app/src/main/res/values-v31/styles.xml