coditation_animator 0.0.3 copy "coditation_animator: ^0.0.3" to clipboard
coditation_animator: ^0.0.3 copied to clipboard

outdated

Flutter package to ease building animations

example/lib/main.dart

import 'dart:math';

import 'package:coditation_animator/coditation_animator.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const MainApp());
}

class MainApp extends StatelessWidget {
  const MainApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(home: AnimatorPlayground());
  }
}

class AnimatorPlayground extends StatelessWidget {
  AnimatorPlayground({Key? key}) : super(key: key);

  final GlobalKey<AnimatorWidgetState> rootAnimatorStateKey = GlobalKey();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text("Animator Playground")),
      body: Center(
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            MultiAnimator(
              rootAnimatorWidgetStateKey: rootAnimatorStateKey,
              animatorConfigs: [
                AnimatorConfig.rotate(
                  curve: Curves.bounceIn,
                  angle: pi / 4,
                ),
                AnimatorConfig.flipY(curve: Curves.bounceIn),
                AnimatorConfig.fadeOut(curve: Curves.linear),
                AnimatorConfig.fadeIn(curve: Curves.fastOutSlowIn),
                AnimatorConfig.flipX(curve: Curves.bounceIn),
                AnimatorConfig.scaleIn(
                  curve: Curves.bounceOut,
                  scaleIn: 1,
                ),
                AnimatorConfig.rotate(
                  curve: Curves.bounceIn,
                  angle: -pi / 4,
                ),
                AnimatorConfig.scaleOut(
                  curve: Curves.bounceInOut,
                  scaleOut: 1,
                ),
              ],
              child: Container(
                height: 50,
                width: 100,
                color: Colors.red,
              ),
            ),
            const SizedBox(height: 100),
            AnimatorActions(
              handleForward: rootAnimatorStateKey.forward,
              handleReverse: rootAnimatorStateKey.reverse,
              handleRepeat: rootAnimatorStateKey.repeat,
            )
          ],
        ),
      ),
    );
  }
}

class AnimatorActions extends StatelessWidget {
  const AnimatorActions({
    Key? key,
    this.handleForward,
    this.handleReverse,
    this.handleRepeat,
  }) : super(key: key);
  final void Function()? handleForward;
  final void Function()? handleReverse;
  final void Function()? handleRepeat;

  @override
  Widget build(BuildContext context) {
    return Row(
      children: [
        Expanded(
          child: Row(
            mainAxisAlignment: MainAxisAlignment.spaceEvenly,
            children: [
              FloatingActionButton.extended(
                heroTag: "Forward",
                onPressed: handleForward,
                tooltip: "Forward",
                label: const Text("Forward"),
                icon: const Icon(Icons.forward),
              ),
              FloatingActionButton.extended(
                heroTag: "Reverse",
                onPressed: handleReverse,
                tooltip: "Reverse",
                label: const Text("Reverse"),
                icon: const Icon(Icons.undo),
              ),
              FloatingActionButton.extended(
                heroTag: "Repeat",
                onPressed: handleRepeat,
                tooltip: "Repeat",
                label: const Text("Repeat"),
                icon: const Icon(Icons.repeat),
              ),
            ],
          ),
        ),
      ],
    );
  }
}
4
likes
0
points
27
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter package to ease building animations

Homepage
Repository (GitLab)
View/report issues

License

unknown (license)

Dependencies

collection, flutter, flutter_bloc, freezed, uuid

More

Packages that depend on coditation_animator