animated_splash 0.0.1 animated_splash: ^0.0.1 copied to clipboard
A light weight package for flutter apps, that easily shows a splash screen with a nice fade animation, for a specific amount of time, also it executes peace of code that needs to be run while the spla [...]
Splash Screen #
Using the package #
environment:
sdk: ">=2.1.0 <3.0.0"
Add dependency in pubspec.yaml
dependencies:
animated_splash: ^0.0.1
Things to do #
- Get a logo for your app
- Prepare what to execute while the splash screen is shown (initializing your db, shared preferences, firebase...etc)
- Screen to be shown after splash screen
- Duration of Splash Screen
Import the package
import 'package:animated_splash/animated_splash.dart';
Create an object of Function that gets executed while splash screen is shown
Function duringSplash = () {
//Write your code here
...
};
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 duringSplash: the function you have written above duration: duration of splash screen in milliseconds
runApp(MaterialApp(
home: SplashScreen(
imagePath: 'your_logo_path',
home: YourHomeScreen(),
duringSplash: duringSplash,
duration: 2500),
));