Skip to content

Commit 31e912d

Browse files
Felix Wortmanndaadu
andauthored
Quick fix for #83 (#84)
* Quick fix for #83 Co-authored-by: Harsh Bhikadia <[email protected]>
1 parent 3c6da7e commit 31e912d

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [0.5.3] - Coming soon
2+
3+
* Fix bug where `_animationController.dispose()` is not called correctly in `BackdropScaffold`[[#83](https://github.com/fluttercommunity/backdrop/pull/83)]
4+
15
## [0.5.2] - 27 February 2021
26

37
* `example`: referring "live demo" so that it shows up in pub.dev

lib/scaffold.dart

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -399,9 +399,10 @@ class BackdropScaffoldState extends State<BackdropScaffold>
399399
duration: Duration(milliseconds: 200),
400400
value: widget.revealBackLayerAtStart ? 0 : 1,
401401
);
402-
if (widget.animationController == null && widget.controller == null) {
403-
_shouldDisposeAnimationController = true;
404-
}
402+
403+
// should only dispose of `_animationController`, if it was initialised inside this widget.
404+
_shouldDisposeAnimationController =
405+
(widget.animationController ?? widget.controller) == null;
405406

406407
_backLayerScrimColorTween = _buildBackLayerScrimColorTween();
407408

@@ -424,8 +425,8 @@ class BackdropScaffoldState extends State<BackdropScaffold>
424425

425426
@override
426427
void dispose() {
427-
super.dispose();
428428
if (_shouldDisposeAnimationController) _animationController.dispose();
429+
super.dispose();
429430
}
430431

431432
/// Deprecated. Use [isBackLayerConcealed] instead.

0 commit comments

Comments
 (0)