Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can I animate numbers in flutter?

How can I animate number starting from 0 to the number’s value like the following example :

enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

So there is a Flutter package that helps to do this. You can add it to your pubspec.yaml by using the following command in your terminal :

flutter pub add countup 

and now add this line to your dart code :

import 'package:countup/countup.dart';

and finally add the widget by writing this code :

     Countup(
              begin: 0,
              end: 268000, //here you insert the number or its variable
              duration: Duration(seconds: 3),
              separator: ',', //this is the character you want to add to seperate between every 3 digits
              style: TextStyle(
                fontSize: 36,
              ),
            ),
      
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading