animated_splash 1.0.0 copy "animated_splash: ^1.0.0" to clipboard
animated_splash: ^1.0.0 copied to clipboard

A light weight package for flutter apps, that easily shows a splash screen with a nice fade animation.

Animated Splash Screen #

Using the package #

Get the library

environment:
  sdk: ">=2.1.0 <3.0.0"
copied to clipboard

Add dependency in pubspec.yaml

dependencies:
  animated_splash: ^1.0.0
copied to clipboard

Things to do #

  1. Get a logo for your app
  2. Prepare what to execute while the splash screen is shown (initializing your db, shared preferences, firebase...etc)
  3. Screen to be shown after splash screen and background process
  4. Duration of Splash Screen

Import the package

import 'package:animated_splash/animated_splash.dart';
copied to clipboard

Show splash screen for some duration #

  type: AnimatedSplashType.StaticDuration
copied to clipboard

Inside your main function, use home as SplashScreen(_), the parameters are as follows:

imagePath: Path to your app-logo/image home: Screen to be shown after splash duration: duration of splash screen in milliseconds type

runApp(MaterialApp(
  home: AnimatedSplash(
              imagePath: 'assets/flutter_icon.png',
              home: Home(),
              duration: 2500,
              type: AnimatedSplashType.StaticDuration,
            ),
));
copied to clipboard

Execute a function in background and based on the value from that function navigate to different screen #

  type: AnimatedSplashType.BackgroundProcess
copied to clipboard

Create an object of Function that gets executed while splash screen is shown

Function duringSplash = () {
  //Write your code here
  ...
  return value;
};
copied to clipboard

Create routes according to your function return value

  //setup the return value correctly for proper navigation
  Map<dynamic, Widget> returnValueAndHomeScreen = {1: Home(), 2: HomeSt()};

copied to clipboard

Inside your main function, use home as SplashScreen(_), the parameters are as follows:

imagePath: Path to your app-logo/image home: Screen to be shown after splash customFunction: the function you have written above duration: duration of splash screen in milliseconds type output value of customFunction and home screen to navigate(Map function)

runApp(MaterialApp(
  home: AnimatedSplash(
              imagePath: 'assets/flutter_icon.png',
              home: Home(),
              customFunction: duringSplash,
              duration: 2500,
              type: AnimatedSplashType.BackgroundProcess,
              outputAndHome: op,
            ),
));
copied to clipboard

Demo #

ProgressDialog Demo
191
likes
40
points
46
downloads

Publisher

unverified uploader

Weekly Downloads

2024.09.11 - 2025.03.26

A light weight package for flutter apps, that easily shows a splash screen with a nice fade animation.

Repository (GitHub)

License

Apache-2.0 (license)

Dependencies

flutter

More

Packages that depend on animated_splash