Skip to main content

animated_count 0.3.0 copy "animated_count: ^0.3.0" to clipboard
animated_count: ^0.3.0 copied to clipboard

Tiny Flutter widgets that count a number up or down to its new value, as plain text or as odometer-style rolling digits. Accessible, no dependencies.

example/lib/main.dart

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

void main() => runApp(const ExampleApp());

/// Shows a [RollingCount] and an [AnimatedCount] side by side that go to a new number on every tap.
class ExampleApp extends StatelessWidget {
  /// Creates the example app.
  const ExampleApp({super.key});

  @override
  Widget build(BuildContext context) => MaterialApp(
    theme: ThemeData(colorSchemeSeed: Colors.teal),
    home: const _Home(),
  );
}

class _Home extends StatefulWidget {
  const _Home();

  @override
  State<_Home> createState() => _HomeState();
}

class _HomeState extends State<_Home> {
  int _posters = 12;

  @override
  Widget build(BuildContext context) => Scaffold(
    appBar: AppBar(title: const Text('animated_count')),
    body: Center(
      child: Column(
        mainAxisSize: MainAxisSize.min,
        spacing: 24,
        children: [
          RollingCount(
            value: _posters,
            suffix: _posters == 1 ? ' poster' : ' posters',
            countFromZero: true,
            style: Theme.of(context).textTheme.displaySmall,
          ),
          AnimatedCount(
            value: _posters,
            suffix: _posters == 1 ? ' poster' : ' posters',
            countFromZero: true,
            style: Theme.of(context).textTheme.displaySmall,
          ),
        ],
      ),
    ),
    floatingActionButton: Row(
      mainAxisSize: MainAxisSize.min,
      spacing: 12,
      children: [
        FloatingActionButton(
          onPressed: () => setState(() => _posters = _posters > 0 ? _posters - 7 : 0),
          child: const Icon(Icons.remove),
        ),
        FloatingActionButton(
          onPressed: () => setState(() => _posters += 130),
          child: const Icon(Icons.add),
        ),
      ],
    ),
  );
}
0
likes
160
points
42
downloads
screenshot

Documentation

API reference

Publisher

verified publisherdev.plakat-kompass.de

Weekly Downloads

Tiny Flutter widgets that count a number up or down to its new value, as plain text or as odometer-style rolling digits. Accessible, no dependencies.

Repository (GitHub)
View/report issues

Topics

#animation #counter #text #widget

License

MIT (license)

Dependencies

flutter

More

Packages that depend on animated_count