Splash Screen in Flutter


We are going to Explain About Splash Screen In Flutter. Please follow the Following step given Below.


Step1.

Write click on flutter App(root)and click on directory.open dialog box then give  name is images paste any images here.




We need to import the image files into the project. It is common practice to put image files in a images or assets folder at the root of a Flutter project.

Step 2.

Flutter actually gives a simpler way to add Splash Screen to our application.
In lib folder you just create dart name is home.dart



Step :3

In Main.dart Class you just write this code given below

import 'package:flutter/material.dart';
import 'package:flutter_app/home.dart';

void main() {
  runApp(new MaterialApp(
    home: new SplashScreen(),

    routes: <String, WidgetBuilder>{
      '/HomeScreen': (BuildContext context) => new HomeScreen()
    },
  ));
}

class SplashScreen extends StatefulWidget {
  @override
  _SplashScreenState createState() => new _SplashScreenState();
}

class _SplashScreenState extends State<SplashScreen> {
  startTime() async {
    var _duration = new Duration(seconds: 5);
    return new Timer(_duration, navigationPage);
  }

  void navigationPage() {
    Navigator.of(context).pushReplacementNamed('/HomeScreen');
  }

  @override
  void initState() {
    super.initState();
    startTime();
  }

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      body: new Center(
        child: new Image.asset('images/flutter.jpg'),
        
      ),
    );
  }

Full Code Download 

Splash Screen in Flutter





Post a Comment

1 Comments

  1. NetEnt is dedicated to gaming that is fun, secure, and safe. The most vital factor here are are|listed beneath are} new technologies and that new 코인카지노 video games shall be added to the portfolio quickly after their launch. Take a stroll down the red carpet and meet up with some of the the} most iconic characters from the world of leisure in NetEnt's Superstars™ slot. Note that the content material on this site shouldn't be thought of betting advice. This web site is free that you simply can} use however we could receive commission from the businesses we characteristic on this site.

    ReplyDelete