Table of Contents

Flutter Animations

https://github.com/mjohnsullivan/dashcast/tree/flutterEurope

2. How to Idea

Animation? AnimationController?

Animation

AnimationController

AnimatedIcon

snippet.dart
IconButton(
  icon: AnimatedIcon(
    progress: _animationController,
    icon: AnimatedIcons.play_pause,
  ),
  onPressed: () {
    if (playStatus.isPlaying) {
      _animationController.reverse();
      _stop();
    } else {
      _animationController.forward();
      _play(downloadLocation ?? item.guid);
    }
  }
)

AlertWiggle

We need…

snippet.dart
static final sinePeriod = 2 * pi;
double _endValue = 0;
 
if (episode.percentDownloaded == 1 && !episode.hasNotified){
  _endValue = sinePeriod;
  episode.downloadNotified();
}
 
TweenAnimationBuilder(
  tween: Tween<double>(begin:0, end:_endValue),
  duration: Duration(milliseconds: 200),
  child: child,
  builder: (_, double value, Widget child){
    double offset = sin(value);
    return Transform.translate(
      offset: Offset(0, offset * 2),
      child: child,
    );
  }
)

AnimatedOpacity

snippet.dart
AnimatedOpacity(
  child: child,
  opaticy: _getOpacity(value.percentDownloaded),
  duration: Duration(milliseconds: 100),
)
 
double _getOpacity(double percentDownloaded) => percentDownloaded * (1- _defaultOpacity) + _defualt...

Try the simplest thing first

Is my animation more like a drawing
- Rive

“Pure Flutter Animatios”: Two kinds

Does my animation repeat forever?
Is is discontinuous?
Are multiple widgets animating together?

<uml>
if (Code-based animation questions) then (yes)

:Implicit animation;

else (
- Does it repeat 'forever'?
- Is it 'discontinuous'?
- Do multiple widgets animate together?
)

:Explicit animation;

</uml>

Implicit animation

Built-in implicit animation
TweenAnimationBuilder

Explicit animation

1. Flutter code or plugin?

  1. Is my animation more like a drawing?

2. Implicit or Explicit?

  1. Does my animation repeat 'forever'?
  2. Is it 'discontinuous'?
  3. Are multiple widgets animating together?

3. Built-in or custom?

  1. Is there a built-in widget for my needs?

Animated

wnARLByOtKA