zo_collection_animation

pub package pub points License: MIT

A lightweight Flutter package to create smooth "collect" animations — perfect for gamification, reward systems, add to cart . Animate any widget (like coins, stars, or points) from one widget to another.

Getting started

First, add zo_collection_animation as a dependency in your pubspec.yaml file.

  zo_collection_animation: ^0.0.1

Import the package

import 'package:zo_collection_animation/zo_collection_animation.dart'

Usage

Create Global Key

final GlobalKey _coinDestKey = GlobalKey();

Wrap your source widget with ZoCollectionSource.

ZoCollectionSource(
  destinationKey: _coinDestKey,
  count: 5,
  collectionWidget: Icon(
    Icons.monetization_on,
    color: Colors.amber,
  ),
  onAnimationComplete: () {
    setState(() {
      coinCount++;
    });
  },
  child: Container(
    width: 150,
    height: 150,
    decoration: BoxDecoration(
      color: Colors.green,
      borderRadius: BorderRadius.circular(20),
    ),
    child: const Center(
      child: Text(
        "Tap to Collect",
        style: TextStyle(
          fontSize: 18,
          color: Colors.white,
        ),
      ),
    ),
  ),
);

Wrap your destination widget with ZoCollectionDestination.

ZoCollectionDestination(
  key: _coinDestKey,
  child: Row(
    children: [
      const Icon(
        Icons.monetization_on,
        color: Colors.amber,
      ),
      const SizedBox(width: 4),
      Text(
        '$coinCount',
        style: const TextStyle(
          fontSize: 18,
          fontWeight: FontWeight.bold,
        ),
      ),
    ],
  ),
);

Feel free to post a feature requests or report a bug here.

My Other packages

  • zo_animated_border: A package that provides a modern way to create gradient borders with animation in Flutter
  • zo_screenshot: The zo_screenshot plugin helps restrict screenshots and screen recording in Flutter apps, enhancing security and privacy by preventing unauthorized screen captures.
  • connectivity_watcher: A Flutter package to monitor internet connectivity with subsecond response times, even on mobile networks.
  • ultimate_extension: Enhances Dart collections and objects with utilities for advanced data manipulation and simpler coding.
  • theme_manager_plus: Allows customization of your app's theme with your own theme class, eliminating the need for traditional
  • date_util_plus: A powerful Dart API designed to augment and simplify date and time handling in your Dart projects.
  • pick_color: A Flutter package that allows you to extract colors and hex codes from images with a simple touch.