颤动的动画数字,旋转

时间:2020-10-01 18:18:20

标签: flutter dart

如何从视频中创建动画,该动画必须显示特定的数字。动画就像在赌场。 https://github.hubspot.com/odometer/docs/welcome/就像在第二个示例中显示10一样,

enter image description here

1 个答案:

答案 0 :(得分:0)

您可以使用来实现设计 Number Slide Animation

将此添加到您程序包的pubspec.yaml文件中:

number_slide_animation: ^0.1.1

使用以下命令在终端上安装它:

flutter pub get

导入:

import 'package:number_slide_animation/number_slide_animation.dart';

示例代码:

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