Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3bcecd3

Browse files
Add odometer package example
1 parent ffdd326 commit 3bcecd3

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed

‎assets/screenshots/odometer-example.jpg

247 KB
Loading[フレーム]

‎lib/pages/odometer_example.dart

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:odometer/odometer.dart';
3+
4+
class OdometerExample extends StatefulWidget {
5+
const OdometerExample({ Key? key }) : super(key: key);
6+
7+
@override
8+
OdometerExampleState createState() => OdometerExampleState();
9+
}
10+
11+
class OdometerExampleState extends State<OdometerExample> {
12+
int _counter = 10000;
13+
14+
void _incrementCounter() {
15+
setState(() {
16+
_counter += 10000;
17+
});
18+
}
19+
20+
@override
21+
Widget build(BuildContext context) {
22+
return Scaffold(
23+
appBar: AppBar(
24+
elevation: 0,
25+
backgroundColor: Colors.white,
26+
title: Text("Odometer Package Example", style: TextStyle(color: Colors.black),),
27+
),
28+
floatingActionButton: FloatingActionButton(
29+
onPressed: _incrementCounter,
30+
child: Icon(Icons.add),
31+
),
32+
body: Container(
33+
width: double.infinity,
34+
child: Column(
35+
mainAxisAlignment: MainAxisAlignment.center,
36+
children: [
37+
AnimatedSlideOdometerNumber(
38+
odometerNumber: OdometerNumber(_counter),
39+
duration: Duration(milliseconds: 1000),
40+
letterWidth: 35,
41+
numberTextStyle: TextStyle(
42+
fontSize: 35,
43+
fontWeight: FontWeight.bold
44+
),
45+
)
46+
],
47+
),
48+
),
49+
);
50+
}
51+
}

‎pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ dependencies:
3737
dio: ^4.0.0
3838
url_launcher: ^6.0.12
3939
concentric_transition: ^1.0.1
40+
odometer: ^2.1.0
4041

4142
dev_dependencies:
4243
flutter_test:

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /