animated_fav_button 0.0.2 copy "animated_fav_button: ^0.0.2" to clipboard
animated_fav_button: ^0.0.2 copied to clipboard

A Flutter package for creating animated favorite buttons with attractive visual effects like hearts, likes, and other reactions. Easy to use, highly customizable with smooth animations and splash effects.

example/lib/main.dart

import 'package:flutter/material.dart';

import 'package:animated_react_button/animated_react_button.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;
  bool isFavorite = false;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text('You have pushed the button this many times:'),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headlineMedium,
            ),
            Stack(
              children: [
                AnimatedReactButton(
                  enableTap: true,
                  isFavorite: isFavorite,
                  onPressed: () async {
                    // Simular una llamada a API
                    await Future.delayed(const Duration(seconds: 1));
                    setState(() {
                      isFavorite = !isFavorite;
                    });
                  },
                  reactColor: Colors.pink,
                  defaultColor: Colors.grey,
                  // defaultIcon: Icons.pets,
                  splashIcons: [Icons.pets],
                  splashColors: [Colors.pink],
                ),
              ],
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ),
    );
  }
}
2
likes
125
points
103
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package for creating animated favorite buttons with attractive visual effects like hearts, likes, and other reactions. Easy to use, highly customizable with smooth animations and splash effects.

Repository (GitHub)
View/report issues

Topics

#animation #button #favorite #flutter #widget

Documentation

Documentation
API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on animated_fav_button