player_animation 1.0.0 copy "player_animation: ^1.0.0" to clipboard
player_animation: ^1.0.0 copied to clipboard

A powerful Flutter animation widget that simplifies creating animations without AnimationController boilerplate. Supports loop animations, play/pause control, and custom builders.

Player Animation #

A simple and powerful Flutter animation widget that lets you create animations without dealing with AnimationController directly.

Features #

  • 🎯 Simple API for creating animations
  • 🔄 Support for loop animations
  • ⏯️ Play/Pause control
  • ⚡ Zero boilerplate code
  • 📦 No need to use SingleTickerProviderStateMixin

Getting started #

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

dependencies:
  player_animation: ^0.0.1

Usage #

Here's a simple example that animates a container's size:

AnimationPlayer(
  begin: 100,
  end: 200,
  duration: const Duration(seconds: 1),
  play: true,
  loop: true,
  builder: (context, controller, child, animation) {
    return Center(
      child: Container(
        width: animation.value,
        height: animation.value,
        color: Colors.red,
      ),
    );
  },
)

Parameters #

  • begin: Starting value of the animation (default: 0)
  • end: Ending value of the animation (default: 100)
  • play: Controls whether the animation is playing or paused
  • loop: If true, animation will repeat indefinitely
  • duration: Length of the animation
  • builder: Builder function that returns the animated widget

Examples #

Pulsing Container

AnimationPlayer(
  begin: 50,
  end: 150,
  duration: const Duration(milliseconds: 800),
  play: true,
  loop: true,
  builder: (context, controller, child, animation) {
    return Container(
      width: animation.value,
      height: animation.value,
      decoration: BoxDecoration(
        color: Colors.blue,
        borderRadius: BorderRadius.circular(10),
      ),
    );
  },
)

Fade Animation

AnimationPlayer(
  begin: 0,
  end: 1,
  duration: const Duration(seconds: 2),
  play: true,
  builder: (context, controller, child, animation) {
    return Opacity(
      opacity: animation.value,
      child: YourWidget(),
    );
  },
)
2
likes
140
points
23
downloads

Publisher

unverified uploader

Weekly Downloads

A powerful Flutter animation widget that simplifies creating animations without AnimationController boilerplate. Supports loop animations, play/pause control, and custom builders.

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on player_animation