Flutter animated number, spinning

1,504

You can achieve the design by using Number Slide Animation

Add this to your package's pubspec.yaml file:

number_slide_animation: ^0.1.1

Install it with terminal with the command:

flutter pub get

Import:

import 'package:number_slide_animation/number_slide_animation.dart';

Sample Code:

class Example extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Simple Example"),
      ),
      body: Container(
        child: Center(
          child: NumberSlideAnimation(
            number: "12345678987654321",
            duration: const Duration(seconds: 2),
            curve: Curves.bounceIn,
            textStyle: TextStyle(
              fontSize: 20.0,
              fontWeight: FontWeight.bold
            ),
          ),
        ),
      ),
    );
  }
}

enter image description here

Share:
1,504
user13034054
Author by

user13034054

Updated on December 18, 2022

Comments

  • user13034054
    user13034054 over 1 year

    How to create animation like from video, that must show specific number. Animation is like in casino. https://github.hubspot.com/odometer/docs/welcome/ Like in second example where is 10, 000 is showed

    enter image description here

  • Vivek
    Vivek almost 3 years
    How Can I change number with animation by plus, minus with button click?
  • sleighty
    sleighty almost 3 years
    Check out the counter app example.
  • sleighty
    sleighty almost 3 years
    This solution doesn't actually animate from one number to another, it just displays the first number with the animation. This one does.