パッケージ、リポジトリ、アプリカテゴリを検索

add_to_cart_animation のカバー
パッケージ詳細v2.0.4

add_to_cart_animation

カートに追加するアニメーションを提供するFlutterプラグインです。私はこれをショッピングアプリ専用に準備しましたが、他のアプリでも使用できます。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
2560
いいね数
324
Pub ポイント
150

パッケージをインストール

flutter pub add add_to_cart_animation

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

Flutterプラグインで、スムーズなカート追加アニメーションを提供し、ショッピングアプリに最適です。ユーザーがアイテムがカートに追加される様子をダイナミックで魅力的な動きで視覚的に体験できるようにします。アニメーションはカスタマイズ可能で、さまざまなUIコンポーネントに統合できます。電子商取引アプリ専用に設計されていますが、直感的なカート操作が必要な他の文脈でも十分に柔軟に使用可能です。このパッケージはAndroid、iOS、Web、macOS、Windows、Linuxなどすべての主要プラットフォームをサポートしています。

用途

  • ECアプリ製品の追加
  • インタラクティブなショッピングカート体験
  • アイテム選択の視覚フィードバック
  • 小売アプリにおけるユーザー参加の向上
  • モバイルおよびウェブアプリでのカスタムアニメーション

主な機能

  • スムーズなカートへの追加アニメーション
  • クロスプラットフォーム互換性
  • 既存のUIとの簡単な統合
  • カスタマイズ可能なアニメーション動作
  • 複数のターゲット先をサポートしています

適している対象

  • ショッピングおよび小売アプリ
  • 視覚的なカートフィードバックが必要なアプリ
  • シンプルなアニメーションソリューションを探している開発者
  • 複数のプラットフォームをターゲットとするFlutterプロジェクト
  • UI/UXの向上に注力する開発者

注意事項

  • カートアイコンまたはターゲットの適切な配置が必要です
  • 低性能デバイスではパフォーマンスチューニングが必要になる場合があります
  • 基本的なカートアニメーションパターンに限定
  • 複雑なインタラクティブなフローには適していません
  • 最適な結果を得るためには正しいウィジェット階層に依存します

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Add To Cart Animaiton

A flutter plugin which provide you add to cart animation. I have prepared it to special to shopping apps however you can use it on the others apps too, becasue it accept every widget to drag as in the gif. So It can be useful at shopping, game, news and other category apps.

Icon Preview Gif | Image Preview Gif | Text Preview Gif

Features
  • Product container accepts every widget.
  • The cart and cart's badge can be invisible.
  • The product animation is fully controlled(duration, curve)
  • The first jump animation is fully controlled(active, duration, curve)

If you need it, you can add it to your project easily. It is easy to use

Add the dependency to your pubspec.yaml:

add_to_cart_animation: ^2.0.4

And check the example code to solve how it works.

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

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

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

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Add To Cart Animation Example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Add To Cart Animation Example'),
      debugShowCheckedModeBanner: false,
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);
  final String title;

  @override
  MyHomePageState createState() => MyHomePageState();
}

class MyHomePageState extends State<MyHomePage> {
  // We can detect the location of the cart by this  GlobalKey<CartIconKey>
  GlobalKey<CartIconKey> cartKey = GlobalKey<CartIconKey>();
  late Function(GlobalKey) runAddToCartAnimation;
  var _cartQuantityItems = 0;

  @override
  Widget build(BuildContext context) {
    return AddToCartAnimation(
      // To send the library the location of the Cart icon
      cartKey: cartKey,
      height: 30,
      width: 30,
      opacity: 0.85,
      dragAnimation: const DragToCartAnimationOptions(
        rotation: true,
      ),
      jumpAnimation: const JumpAnimationOptions(),
      createAddToCartAnimation: (runAddToCartAnimation) {
        // You can run the animation by addToCartAnimationMethod, just pass trough the the global key of  the image as parameter
        this.runAddToCartAnimation = runAddToCartAnimation;
      },
      child: Scaffold(
        appBar: AppBar(
          title: Text(widget.title),
          centerTitle: false,
          actions: [
            //  Adding 'clear-cart-button'
            IconButton(
              icon: const Icon(Icons.cleaning_services),
              onPressed: () {
                _cartQuantityItems = 0;
                cartKey.currentState!.runClearCartAnimation();
              },
            ),
            const SizedBox(width: 16),
            AddToCartIcon(
              key: cartKey,
              icon: const Icon(Icons.shopping_cart),
              badgeOptions: const BadgeOptions(
                active: true,
                backgroundColor: Colors.red,
              ),
            ),
            const SizedBox(
              width: 16,
            )
          ],
        ),
        body: ListView(
          children: List.generate(
            15,
            (index) => AppListItem(
              onClick: listClick,
              index: index,
            ),
          ),
        ),
      ),
    );
  }

  void listClick(GlobalKey widgetKey) async {
    await runAddToCartAnimation(widgetKey);
    await cartKey.currentState!
        .runCartAnimation((++_cartQuantityItems).toString());
  }
}

class AppListItem extends StatelessWidget {
  final GlobalKey widgetKey = GlobalKey();
  final int index;
  final void Function(GlobalKey) onClick;

  AppListItem({super.key, required this.onClick, required this.index});
  @override
  Widget build(BuildContext context) {
    //  Container is mandatory. It can hold images or whatever you want
    Container mandatoryContainer = Container(
      key: widgetKey,
      width: 60,
      height: 60,
      color: Colors.transparent,
      child: Image.network(
        "https://cdn.jsdelivr.net/gh/omerbyrk/add_to_cart_animation/example/assets/apple.png",
        width: 60,
        height: 60,
      ),
    );

    return ListTile(
      onTap: () => onClick(widgetKey),
      leading: mandatoryContainer,
      title: Text(
        "Animated Apple Product Image $index",
      ),
    );
  }
}

By the way, you can run the example project in the plugin to check it deeply.

Have a good days.

Thanks for contributing:

codegtd

Support

Did you find this plugin useful? Please consider to buy me a coffe!

カテゴリー

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。