number_animation 0.1.2 copy "number_animation: ^0.1.2" to clipboard
number_animation: ^0.1.2 copied to clipboard

A simple and easy to use widget to help you show numbers by animation.

example/number_animation.dart

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

void main() {
  runApp(AppDemo());
}

class AppDemo extends StatefulWidget {
  @override
  _AppDemoState createState() => _AppDemoState();
}

class _AppDemoState extends State<AppDemo> {
  double number = 100;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        title: 'NumberAnimation Demo',
        theme: ThemeData(
          primarySwatch: Colors.pink,
        ),
        home: Scaffold(
            appBar: AppBar(
              title: Text('NumberAnimation Demo'),
            ),
            body: Container(
              padding: EdgeInsets.all(20),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  FloatingActionButton(
                    onPressed: () {
                      setState(() {
                        number = number - 10;
                      });
                    },
                    tooltip: 'reduction',
                    child: Icon(Icons.remove),
                  ),
                  NumberAnimation(
                    start: 0, // default is 0, can remove
                    end: number,
                    style: TextStyle(color: Colors.pinkAccent, fontSize: 30),
                    after: '%',
                  ),
                  FloatingActionButton(
                    onPressed: () {
                      setState(() {
                        number = number + 10;
                      });
                    },
                    tooltip: 'Increment',
                    child: Icon(Icons.add),
                  ),
                ],
              ),
            )));
  }
}
9
likes
40
pub points
0%
popularity

Publisher

unverified uploader

A simple and easy to use widget to help you show numbers by animation.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter

More

Packages that depend on number_animation