Skip to content

Commit add23dc

Browse files
committed
[auto_animated] Forvard animation on items count changed in AutoAnimatedList
1 parent 3b6362c commit add23dc

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

packages/auto_animated/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.2.3
2+
3+
* Forvard animation on items count changed in `AutoAnimatedList`
4+
15
## 1.2.2
26

37
* Fixed dispose in `AutoAnimatedIconButton`

packages/auto_animated/example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ packages:
1414
path: ".."
1515
relative: true
1616
source: path
17-
version: "1.2.2"
17+
version: "1.2.3"
1818
boolean_selector:
1919
dependency: transitive
2020
description:

packages/auto_animated/lib/src/auto_animated_list.dart

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,11 @@ class AutoAnimatedListState extends State<AutoAnimatedList>
329329
@override
330330
void initState() {
331331
super.initState();
332+
init();
333+
}
334+
335+
void init() {
336+
_itemsCount = 0;
332337
Future.delayed(widget.delay, () {
333338
_timer = Timer.periodic(widget.showItemInterval, (Timer timer) {
334339
if (_itemsCount == widget.itemCount || !mounted) {
@@ -342,6 +347,14 @@ class AutoAnimatedListState extends State<AutoAnimatedList>
342347
});
343348
}
344349

350+
@override
351+
void didUpdateWidget(AutoAnimatedList oldWidget) {
352+
super.didUpdateWidget(oldWidget);
353+
if (oldWidget.itemCount != widget.itemCount) {
354+
init();
355+
}
356+
}
357+
345358
@override
346359
void dispose() {
347360
_timer?.cancel();

packages/auto_animated/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: auto_animated
22
description: Widgets starting auto play animation when mounted. It is already possible to animate the list and icons.
3-
version: 1.2.2
3+
version: 1.2.3
44
author: Serge Shkurko <sergeshkurko@outlook.com>
55
homepage: https://github.com/rbcprolabs/flutter_plugins/tree/master/packages/auto_animated
66

0 commit comments

Comments
 (0)