diff --git a/CHANGELOG.md b/CHANGELOG.md index 7931666a..e47b7a3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.4.8 +### Addded +* onSlideAnimationChanged and onSlideIsOpenChanged on `SlidableController`. + ## 0.4.7 ### Fixed * https://github.com/letsar/flutter_slidable/issues/31 (Issue with dismiss animation). diff --git a/README.md b/README.md index ecab99ca..b8108a0b 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ In the `pubspec.yaml` of your flutter project, add the following dependency: ```yaml dependencies: ... - flutter_slidable: "^0.4.7" + flutter_slidable: "^0.4.8" ``` In your library add the following import: @@ -233,7 +233,32 @@ new Slidable( controller: slidableController, ... ); -``` +``` + +#### How can I animate an external widget at the same time as the active Slidable? + +You have to set the callbacks of a `SlidableController` instance: +The `onSlideAnimationChanged` let you get the animation of the current Slidable. +The `onSlideIsOpenChanged` let you know when the current Slidable opens and closes. + +```dart +final SlidableController slidableController = new SlidableController( + onSlideAnimationChanged: handleSlideAnimationChanged, + onSlideIsOpenChanged: handleSlideIsOpenChanged, + ); +... + void handleSlideAnimationChanged(Animation slideAnimation) { + setState(() { + _rotationAnimation = slideAnimation; + }); + } + + void handleSlideIsOpenChanged(bool isOpen) { + setState(() { + _fabColor = isOpen ? Colors.green : Colors.blue; + }); + } +``` ## Changelog diff --git a/pubspec.yaml b/pubspec.yaml index 1c1abf8e..1e76db8f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_slidable description: A Flutter implementation of slidable list item with directional slide actions that can be dismissed. -version: 0.4.7 +version: 0.4.8 author: Romain Rastel homepage: https://github.com/letsar/flutter_slidable