Skip to content

Commit 406446a

Browse files
committed
feat: Add a number flip animation for the scanning screen
1 parent aada65d commit 406446a

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

lib/screens/welcome/scanning.dart

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:provider/provider.dart';
22
import 'package:fluent_ui/fluent_ui.dart';
33
import 'package:mesh_gradient/mesh_gradient.dart';
4+
import 'package:animated_flip_counter/animated_flip_counter.dart';
45

56
import '../../utils/color_brightness.dart';
67
import '../../messages/library_manage.pb.dart';
@@ -68,17 +69,18 @@ class _ScanningPageState extends State<ScanningPage>
6869
textAlign: TextAlign.center,
6970
),
7071
const SizedBox(height: 12),
71-
Text(
72-
count > 1
73-
? task == ScanTaskType.IndexFiles
74-
? '$count tracks found'
75-
: '$count cover arts collected'
76-
: "Sit back and relax",
77-
style: typography.bodyLarge?.apply(
72+
AnimatedFlipCounter(
73+
value: count,
74+
duration: const Duration(milliseconds: 400),
75+
curve: Curves.easeInOut,
76+
suffix: task == ScanTaskType.IndexFiles
77+
? ' tracks found'
78+
: ' cover arts collected',
79+
textStyle: typography.bodyLarge?.apply(
7880
color: Colors.white,
7981
fontWeightDelta: -50,
8082
),
81-
)
83+
),
8284
],
8385
),
8486
),

pubspec.lock

+8
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ packages:
2222
url: "https://pub.dev"
2323
source: hosted
2424
version: "6.7.0"
25+
animated_flip_counter:
26+
dependency: "direct main"
27+
description:
28+
name: animated_flip_counter
29+
sha256: "73f852d84c461c3e4c1ddf320bee334dde8dba89441922ab11a8013be0b2fad1"
30+
url: "https://pub.dev"
31+
source: hosted
32+
version: "0.3.4"
2533
args:
2634
dependency: transitive
2735
description:

pubspec.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ dependencies:
7272
device_info_plus: ^10.1.2
7373
macos_secure_bookmarks: ^0.2.1
7474
permission_handler: ^11.3.1
75+
animated_flip_counter: ^0.3.4
7576

7677
dev_dependencies:
7778
build_runner: ^2.4.11

0 commit comments

Comments
 (0)