sa_multi_tween 0.0.4 copy "sa_multi_tween: ^0.0.4" to clipboard
sa_multi_tween: ^0.0.4 copied to clipboard

discontinuedreplaced by: simple_animations
outdated

MultiTween (part of Simple Animations Framework) can animate multiple properties at once.

example/example.md

Note: This example uses supercharged package for syntactic sugar and simple_animations for using ControlledAnimation widget.

import 'package:flutter/material.dart';
import 'package:simple_animations/simple_animations.dart';
import 'package:supercharged/supercharged.dart';
import 'package:sa_multi_tween/sa_multi_tween.dart';

void main() => runApp(MyApp());

// Create enum that defines the animated properties
enum AniProps { width, height }

class MyApp extends StatelessWidget {
  // Specify your tween
  final _tween = MultiTween<AniProps>()
    ..add(AniProps.width, Tween(begin: 0.0, end: 100.0), 1000.milliseconds)
    ..add(AniProps.width, Tween(begin: 100.0, end: 200.0), 500.milliseconds)
    ..add(AniProps.height, Tween(begin: 0.0, end: 200.0), 2500.milliseconds);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        backgroundColor: Colors.white,
        body: Center(
          child: ControlledAnimation<MultiTweenAnimatable<AniProps>>(
            tween: _tween,
            // Obtain duration from MultiTween
            duration: _tween.duration,
            playback: Playback.PLAY_FORWARD,
            builder: (context, animation) {
              return Container(
                // Get animated values for width and height
                width: animation.get<double>(AniProps.width),
                height: animation.get<double>(AniProps.height),
                color: Colors.yellow,
              );
            },
          ),
        ),
      ),
    );
  }
}


23
likes
0
pub points
61%
popularity

Publisher

verified publisherfelix-blaschke.de

MultiTween (part of Simple Animations Framework) can animate multiple properties at once.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, supercharged

More

Packages that depend on sa_multi_tween