Skip to content

Commit

Permalink
Merge pull request #11 from RikitoNoto/develop
Browse files Browse the repository at this point in the history
1.1.2
  • Loading branch information
RikitoNoto authored Jan 25, 2024
2 parents 8b2398f + 0f406ff commit 7e91824
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@

## 1.1.1
* fix the bug what AnimateChangeIcon inversioned

## 1.1.2
* fix the bug what AnimateChangeIcon don't change the icon when use the AnimationCotroller used another button.
9 changes: 4 additions & 5 deletions lib/animate_change_icon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ class AnimateChangeIcon extends StatefulWidget {
class AnimateChangeIconState extends State<AnimateChangeIcon>
with SingleTickerProviderStateMixin {
late AnimationController _controller;
bool _isPushed = false;

@override
void initState() {
Expand All @@ -102,7 +101,6 @@ class AnimateChangeIconState extends State<AnimateChangeIcon>
});

if (widget.initialPushed) {
_isPushed = true;
_controller.value = _controller.upperBound;
}
super.initState();
Expand All @@ -113,13 +111,14 @@ class AnimateChangeIconState extends State<AnimateChangeIcon>
return GestureDetector(
onTap: () {
widget.onTap?.call();
if (_isPushed) {
// if the animation value is 1.0 or forwarding,
// animate reverse.
if (_controller.value == _controller.upperBound ||
_controller.status == AnimationStatus.forward) {
_controller.reverse();
} else {
_controller.forward();
}

_isPushed = !_isPushed;
},
child: Stack(
children: [
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description:
An animated icon button for Flutter apps.
This package allows you to create animated icons and a particle easily.

version: 1.1.1
version: 1.1.2
homepage: https://github.com/RikitoNoto/flutter_animated_icon_button/tree/develop/lib
repository: https://github.com/RikitoNoto/flutter_animated_icon_button

Expand Down

0 comments on commit 7e91824

Please sign in to comment.