animated_count_text 1.1.0 copy "animated_count_text: ^1.1.0" to clipboard
animated_count_text: ^1.1.0 copied to clipboard

A lightweight Flutter widget that smoothly animates numeric text with support for decimals, prefixes, suffixes, and custom curves.

example/lib/main.dart

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

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

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

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      debugShowCheckedModeBanner: false,
      home: AnimatedCountExamplePage(),
    );
  }
}

class AnimatedCountExamplePage extends StatefulWidget {
  const AnimatedCountExamplePage({super.key});

  @override
  State<AnimatedCountExamplePage> createState() =>
      _AnimatedCountExamplePageState();
}

class _AnimatedCountExamplePageState extends State<AnimatedCountExamplePage> {
  double _value = 0;

  void _increase() {
    setState(() {
      _value += 250;
    });
  }

  void _decrease() {
    setState(() {
      _value -= 150;
    });
  }

  void _reset() {
    setState(() {
      _value = 0;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text("Animated Count Example")),
      body: Center(
        child: AnimatedCount(
          value: _value,
          prefix: "₹ ",
          fractionDigits: 0,
          duration: const Duration(milliseconds: 800),
          style: const TextStyle(fontSize: 42, fontWeight: FontWeight.bold),
        ),
      ),
      bottomNavigationBar: Padding(
        padding: const EdgeInsets.all(20),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          children: [
            ElevatedButton(onPressed: _increase, child: const Text("+250")),
            ElevatedButton(onPressed: _decrease, child: const Text("-150")),
            ElevatedButton(onPressed: _reset, child: const Text("Reset")),
          ],
        ),
      ),
    );
  }
}
2
likes
155
points
236
downloads

Publisher

unverified uploader

Weekly Downloads

A lightweight Flutter widget that smoothly animates numeric text with support for decimals, prefixes, suffixes, and custom curves.

Repository (GitHub)
View/report issues

Topics

#animation #counter #animated-text #numeric #count-up

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on animated_count_text