skip to Main Content

I am using the Simple_animations package on flutter and I am running into the following issue:

I am using the methods that are provided in the official documentation but for some reason It’s not "defined", I have tried upgrading flutter and reinstalling the package but it didn’t seem to work

Picture for reference:
Example

And here’s the code:

import 'package:flutter/material.dart';
import 'package:simple_animations/simple_animations.dart';
import 'package:flutter/animation.dart';


// Create your Animation Example
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>() // <== ISSUE IS HERE
      ..add(AniProps.opacity, Tween(begin: 0.0, end: 1.0))
      ..add(AniProps.translateY, Tween(begin: -30.0, end: 0.0), const Duration(milliseconds: 500), Curves.easeOut);

    return PlayAnimation<MultiTweenValues<AniProps>>( // <== ISSUE IS ALSO HERE
      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
        ),
      ),
    );
  }
}

Thanks a lot in advnace.

2

Answers


  1. Chosen as BEST ANSWER

    So I have found the solution in case anyone runs into the same issue

    Simply go into your pubspec.yaml and change the dependency from the latest version to 4.2.0


  2. I have found a solution, Just go to your pubspec.yaml file and change the version of the simple_animations package like this

    simple_animations : ^5.2.0 to simple_animations : 4.2.0

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search