flutter open the splash screen animation applications

import 'package:flutter/material.dart';
import 'package:flutter_app/pages/SplashScreen.dart';



void main() => runApp(MyApp());

class MyApp extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.green,  //定义主题风格    primarySwatch
      ),
      home:  SplashScreen(),
    );
  }

}
import 'package:flutter/material.dart';

import '../MyHomePage.dart';


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

class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderStateMixin {

  AnimationController _controller;
  Animation _animation;

  void initState() {
    super.initState();
    _controller = AnimationController(vsync:this,duration:Duration(milliseconds:3000));
    _animation Dispose () {Tween = (the begin: 0.0, End: 1.0 ) .animate (_controller); 


    / * Animation event listener, 
    it can monitor the execution state of the animation, 
    we only monitor the animation is completed, 
    if the end of the page jump action is performed. * / 
    _Animation.addStatusListener ((Status) { 
      IF (Status == AnimationStatus.completed) { 
        Navigator.of (context) .pushAndRemoveUntil ( 
            MaterialPageRoute (Builder: (context) => MyHomePage ()), 
                (route) => route = = null ); 
      } 
    }); 
    // play the animation 
    _controller.forward (); 
  } 

  @override 
  void
    _controller.dispose (); 
    Super       ),.Dispose (); 
  } 


  @override 
  the Widget Build (BuildContext context) { 
    return FadeTransition ( // transparency of animation elements 
      Opacity: _animation,   // Animate 
      Child: Image.network (   // Network Graphics 
          ' https://timgsa.baidu. ? COM / TIMg Image & Quality = 80 & size = b9999_10000 & sec = 1546851657199 & DI = fdd278c2029f7826790191d59279dbbe & imgtype = 0 & the src = HTTP%. 3A%. 2F% 2Fimg.zcool.cn% 2Fcommunity% 2F0112cb554438090000019ae93094f1.jpg% 401280w_1l_2o_100sh.jpg ' , 
          scale: 2.0,   // zoom 
          fit: BoxFit .cover   // filled with parent vessel 

    ); 
  } 
}

Guess you like

Origin www.cnblogs.com/loaderman/p/11350393.html