zoukankan      html  css  js  c++  java
  • flutter 动画

    1. App闪屏动画(应用进入界面广告)案例:

    import 'package:flutter/material.dart';
    import 'home_page.dart';    // MyHomePage()
    
    class SplashScreen extends StatefulWidget {
      @override
      _SplashScreenState createState() => _SplashScreenState();
    }
    
    // 混入
    class _SplashScreenState extends State<SplashScreen>
        with SingleTickerProviderStateMixin {
      // 动画控制器
      AnimationController _container;
      Animation _animation;
    
      @override
      void initState() {
        super.initState();
        _container = AnimationController(
            vsync: this, duration: Duration(milliseconds: 3000));
        _animation = Tween(begin: 0.0, end: 1.0).animate(_container);
    
        _animation.addStatusListener((status) {
          if (status == AnimationStatus.completed) {
            Navigator.of(context).pushAndRemoveUntil(
              MaterialPageRoute(builder: (cintext) => MyHomePage()), // 显示完后跳转到首页
              (route) => route == null,
            );
          }
        });
    
        _container.forward(); // 播放动画
      }
    
      @override
      void dispose() {
        _container.dispose(); // 销毁控制器
        super.dispose();
      }
    
      @override
      Widget build(BuildContext context) {
        return FadeTransition(
          opacity: _animation,
          child: Image.network(
            'http://hbimg.b0.upaiyun.com/615efb61cbc8ec8aad8febdf5a74541fb79c54862658a-mPdqeZ_fw658',
            scale: 2.0,
            fit: BoxFit.cover,
          ),
        );
      }
    }
    部分代码实现
  • 相关阅读:
    cholesky分解
    LU分解(2)
    LU分解(1)
    自定义UITableView的Seperator
    iOS屏蔽高频点击技巧
    iOS动态管理AutoLayout的约束NSLayoutConstraint
    Reachability几个常用方法
    XCode4 下制作Framework的方法
    StoryBoard 的使用
    Objective-C RunTime
  • 原文地址:https://www.cnblogs.com/cap-rq/p/12778917.html
Copyright © 2011-2022 走看看