小编sal*_*ler的帖子

Flutter-如何自动启用AnimatedOpacity?

我正在创建一个仪表板,其中包含两个小部件(文本和两个容器)的Tween动画。但是,我想使两个Container的不透明度从不可见变为缓慢...因此我使用了AnimatedOpacity。但是我不知道该怎么做...

任何帮助,将不胜感激..

class _IntroState extends State<Intro> with SingleTickerProviderStateMixin {
  Animation animation;
  AnimationController animationController;

   @override
   void initState() {
     super.initState();
      animationController = AnimationController(
        duration: Duration(seconds: 2),
        vsync: this,
     );

    animation = Tween(begin: -1.0, end: 0.0).animate(CurvedAnimation(
        parent: animationController, curve: Curves.fastOutSlowIn));
    animationController.forward();
  }

  @override
  Widget build(BuildContext context) {
    bool _visible = false;
    final double width = MediaQuery.of(context).size.width;

  return AnimatedBuilder(
      animation: animationController,
      builder: (BuildContext context, Widget child) {
         return Scaffold(
           //BODDY
            body: ListView(
              hildren:<Widget>[
                 new Stack(
                   children: <Widget>[
                     new Transform(
                       //ANIMATED OPACITY
                       new AnimatedOpacity(
                          opacity: …
Run Code Online (Sandbox Code Playgroud)

dart flutter flutter-animation

1
推荐指数
2
解决办法
1519
查看次数

标签 统计

dart ×1

flutter ×1

flutter-animation ×1