io.flutter.embedding.android

## Interface SplashScreen

- All Known Implementing Classes:
    DrawableSplashScreen

      public interface SplashScreen

  Splash screen configuration for a given Flutter experience.

  Implementations provide a visual representation of a splash screen in `createSplashView(Context, Bundle)`, and implement a transition from the splash UI to Flutter's UI in `transitionToFlutter(Runnable)`.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `View` | `createSplashView(Context context, Bundle savedInstanceState)` Creates a `View` to be displayed as a splash screen before Flutter renders its first frame.
    `default boolean` | `doesSplashViewRememberItsTransition()` Returns `true` if the splash `View` built by this `SplashScreen` remembers its transition progress across configuration changes by saving that progress to `View` state.
    `default Bundle` | `saveSplashScreenState()` Returns whatever state is necessary to restore a splash `View` after destruction and recreation, e.g., orientation change.
    `void` | `transitionToFlutter(Runnable onTransitionComplete)` Invoked by Flutter when Flutter has rendered its first frame, and would like the `splashView` to disappear.

- - ### Method Detail

    - #### createSplashView

          @Nullable
          View createSplashView(@NonNull
                                          Context context,
                                          @Nullable
                                          Bundle savedInstanceState)

      Creates a `View` to be displayed as a splash screen before Flutter renders its first frame.

      This method can be called at any time, and may be called multiple times depending on Android configuration changes that require recreation of a view hierarchy. Implementers that provide a stateful splash view, such as one with animations, should take care to migrate that animation state from the previously returned splash view to the newly created splash view.

    - #### transitionToFlutter

          void transitionToFlutter(@NonNull
                                   Runnable onTransitionComplete)

      Invoked by Flutter when Flutter has rendered its first frame, and would like the `splashView` to disappear.

      The provided `onTransitionComplete` callback must be invoked when the splash `View` has finished transitioning itself away. The splash `View` will be removed and destroyed when the callback is invoked.

    - #### doesSplashViewRememberItsTransition

          default boolean doesSplashViewRememberItsTransition()

      Returns `true` if the splash `View` built by this `SplashScreen` remembers its transition progress across configuration changes by saving that progress to `View` state. Returns `false` otherwise.

      The typical return value for this method is `false`. When the return value is `false`, the following can happen:

      1. Splash `View` begins transitioning to the Flutter UI.
      2. A configuration change occurs, like an orientation change, and the `Activity` is re-created, along with the `View` hierarchy.
      3. The remainder of the splash transition is skipped and the Flutter UI is displayed.
      In the vast majority of cases, skipping a little bit of the splash transition should be acceptable. Most users will never experience such a situation, and those that do are unlikely to notice the visual artifact. However, a workaround is available for those developers who need it.

      Returning `true` from this method will cause the given splash `View` to be displayed in the `View` hierarchy, even if Flutter has already rendered its first frame. It is then the responsibility of the splash `View` to remember its previous transition progress, restart any animations, and then trigger its completion callback when appropriate. It is also the responsibility of the splash `View` to immediately invoke the completion callback if it has already completed its transition. By meeting these requirements, and returning `true` from this method, the splash screen experience will be completely seamless, including configuration changes.

    - #### saveSplashScreenState

          @Nullable
          default Bundle saveSplashScreenState()

      Returns whatever state is necessary to restore a splash `View` after destruction and recreation, e.g., orientation change.