afgprogrammer / Flutter-Splash-Screen-Animation

Flutter Splash Screen design and Animation - day 8

Home Page:https://youtu.be/3O8VcpTgDMc

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

simple_annimations 2.2.1

jgismondi22 opened this issue · comments

I am having trouble updating the faded animation code due to the MultiTrackTween and controlledAnimation being deprecated. How would the new code appear?

@jgismondi22
import 'package:flutter/material.dart';
import 'package:simple_animations/simple_animations.dart';

enum AniProps { opacity, translateY }

class FadeAnimation extends StatelessWidget {
final double delay;
final Widget child;

FadeAnimation(this.delay, this.child);

@OverRide
Widget build(BuildContext context) {

final tween = MultiTween<AniProps>()
  ..add(AniProps.opacity, Tween(begin: 0.0, end: 1.0),
      Duration(milliseconds: 500))
  ..add(AniProps.translateY, Tween(begin: -130.0, end: 0.0),
      Duration(milliseconds: 500), Curves.easeOut);

return CustomAnimation<MultiTweenValues<AniProps>>(
  delay: Duration(milliseconds: (500 * delay).round()),
  duration: tween.duration,
  tween: tween,
  child: child,
  builder: (context, child, animation) => Opacity(
    opacity: animation.get(AniProps.opacity),
    child: Transform.translate(
        offset: Offset(0, animation.get(AniProps.translateY)),
        child: child),
  ),
);

}
}