sa_v1_migration 1.1.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 97

Simple Animations 1.x migration #

Thank you for using Simple Animations in your recent projects. Every framework needs to evolve and Simple Animation is no exception.

Migration guide #

This guide will lead you through the upgrading process of Simple Animation.

Upgrade project dependencies #

Change your pubspec.yaml:

  • Set the latest Simple Animations dependency simple_animations: ^2.x.x (find latest) and execute a pub upgrade.

  • Simple Animations will expose the content of this package.

Content of this package #

This package (sa_v1_migration) contains the lastest stable release of Simple Animation version 1.x. This way you can use classes from version 1.x.x along with 2.x.x.

All classes from version 1.x.x has been marked as deprecated.

Replacing deprecated classes #

Now you can focus on replacing your existing code with the new mechanisms.

ControlledAnimation widget

All aspects of the ControlledAnimation widget are available on version 2.x.x. The new CustomAnimation comes closest to the feature set of ControlledAnimation.

You might also take a look at PlayAnimation, LoopAnimation and MirrorAnimation widgets as they represent simpler variants of CustomAnimation.

Look at Stateless Animation README for further details.

MultiTrackTween

The MultiTrackTween has been reworked into a new MultiTween. It has the same feature set but it's easier to use and fully type-safe.

Look at MultiTween README for further details.

AnimationControllerX

The AnimationControllerX or a similar alternative implementation of an AnimationController is not available in version 2.x.x.

Simple Animations version 2.x.x focuses on utilizing the core mechanics of the Flutter framework and to simplify on top of them. Providing an alternative to a core feature of Flutter may introduce problems in the future. Further investions into that direction are not rewarding to the platform.

AnimationControllerMixin

The AnimationControllerMixin came along with AnimationControllerX and helped with initializing and disposing an AnimationControllerX instance inside a stateful class.

Simple Animations version 2.x.x offers a similar mechanism called AnimationMixin that effordlessly creates managed AnimationController instances.

Look at Anicoto README for further details.

Rendering

A similar mechanism to Rendering widget isn't available in Simple Animation version 2.x.x. The use cases for that widget are rare. Also the Rendering widget alone doesn't help developers enough.

You can replace the Rendering widget by using a LoopAnimaton with a ConstantTween(1) and ignore the animated value.

LoopAnimation<int>(
  tween: ConstantTween(1), // <-- any tween will satisfy the API here
  builder: (context, child, value) { // <-- ignore 'value'
    // endless rendering loop
    return ...
  },
)

The Rendering widget supplied you with the passed time. You can get that behavior by using the following snippet (uses supercharged syntactic sugar):

var startTime = DateTime.now().duration(); // Duration() passed since 01.01.1970

Instead of using AnimationProgress class to track the progression of your particle animation you can just save a startTime and a duration for your particle. You can get the current progress with:

double progress() {
  return ((DateTime.now().duration() - startTime) / duration)
    .clamp(0.0, 1.0)
    .toDouble();
}

1.1.2 #

  • Update: readme file

1.1.1 #

  • Fix: typo

1.1.0 #

  • Change: Marked all classes as deprecated.
  • Change: Reworked introductions in the migration guide.
  • Fix: Fixed examples pubspec.yaml path

1.0.0 #

  • New: Added state of simple_animations 1.3.12

example/example.md

Examples #

This directory contains the Simple Animations Example App for version 1.x.x.

You can also find it on github: https://github.com/felixblaschke/sa_v1_migration/tree/master/example

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  sa_v1_migration: ^1.1.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:sa_v1_migration/sa_v1_migration.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
98
Health:
Code health derived from static analysis. [more]
94
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
97
Learn more about scoring.

We analyzed this package on Jul 2, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

because of import path [sa_v1_migration] that is in a package requiring null.

Health suggestions

Fix lib/simple_animations/controlled_animation.dart. (-4.89 points)

Analysis of lib/simple_animations/controlled_animation.dart reported 10 hints, including:

line 112 col 50: 'ControlledAnimation' is deprecated and shouldn't be used. See migration guide: https://pub.dev/packages/sa_v1_migration.

line 149 col 24: 'ControlledAnimation' is deprecated and shouldn't be used. See migration guide: https://pub.dev/packages/sa_v1_migration.

line 165 col 28: 'Playback' is deprecated and shouldn't be used. See migration guide: https://pub.dev/packages/sa_v1_migration.

line 168 col 28: 'Playback' is deprecated and shouldn't be used. See migration guide: https://pub.dev/packages/sa_v1_migration.

line 171 col 28: 'Playback' is deprecated and shouldn't be used. See migration guide: https://pub.dev/packages/sa_v1_migration.

Fix lib/simple_animations/animation_controller_x/animation_controller_x.dart. (-1 points)

Analysis of lib/simple_animations/animation_controller_x/animation_controller_x.dart reported 2 hints:

line 191 col 30: 'AnimationControllerX' is deprecated and shouldn't be used. See migration guide: https://pub.dev/packages/sa_v1_migration.

line 201 col 40: 'AnimationTask' is deprecated and shouldn't be used. See migration guide: https://pub.dev/packages/sa_v1_migration.

Fix lib/simple_animations/rendering.dart. (-0.50 points)

Analysis of lib/simple_animations/rendering.dart reported 1 hint:

line 37 col 37: 'Rendering' is deprecated and shouldn't be used. See migration guide: https://pub.dev/packages/sa_v1_migration.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.3.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8
Dev dependencies
flutter_test