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.
- Splash Screen is the first screen that we see when we run our application.
- It is also known as Launch Screen. We will implement three basic methods to add a splash screen in our app.
The constructor of the SplashScreen class
SplashScreen({Color loaderColor, int seconds, double photoSize, dynamic onClick, dynamic navigateAfterSeconds, Text title, Color backgroundColor, TextStyle styleTextUnderTheLoader, Image image, Text loadingText, ImageProvider<dynamic> imageBackground, Gradient gradientBackground})
import 'package:cjFlutter/home.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:splashscreen/splashscreen.dart'; class MySplash extends StatefulWidget { const MySplash({Key? key}) : super(key: key); @override _MySplashState createState() => _MySplashState(); } class _MySplashState extends State<MySplash> { @override Widget build(BuildContext context) { return SplashScreen( seconds: 2, // Active Time for Splashscreen navigateAfterSeconds: const Home(), // Specified Route to initialise after active time title: const Text( "Welcome To my Blog", style: TextStyle( fontWeight: FontWeight.bold, fontSize: 25, color: Colors.white), ), image: Image.asset('assets/logo.png'), backgroundColor: Colors.blueAccent, photoSize: 60, loaderColor: Colors.redAccent, // Loader Color ); } }