animated_flip_counter 0.1.2
animated_flip_counter: ^0.1.2 copied to clipboard
An implicit animation widget that flips from one number to another, with support for customize styles, decimals and negative values.
example/lib/main.dart
import 'package:animated_flip_counter/animated_flip_counter.dart';
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
double _value = 0.0;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("AnimatedFlipCounter Demo"),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
AnimatedFlipCounter(
value: 2000 + _value,
),
AnimatedFlipCounter(
value: _value,
duration: Duration(seconds: 1),
curve: Curves.bounceOut,
textStyle: TextStyle(fontSize: 100, color: Colors.blue),
),
AnimatedFlipCounter(
value: _value,
prefix: "Level ",
textStyle: TextStyle(
fontSize: 80,
fontWeight: FontWeight.bold,
letterSpacing: -8.0,
color: Colors.yellow,
shadows: [
BoxShadow(
color: Colors.orange,
offset: Offset(2, 4),
blurRadius: 4,
),
],
),
),
AnimatedFlipCounter(
value: _value + 0.48,
fractionDigits: 2,
),
],
),
),
floatingActionButton: FloatingActionButton(
child: Icon(Icons.add),
onPressed: () {
setState(() => _value += 1.0);
},
),
);
}
}