Skip to content

Commit

Permalink
Give isPanelOpen and isPanelClosed tolerance equal to _kFlingTolerance
Browse files Browse the repository at this point in the history
Without this, sometimes after a fling open isPanelOpen would return false, or after a fling closed isPanelClosed would return false.
  • Loading branch information
willbryant committed Apr 4, 2021
1 parent c7066a0 commit 23ec458
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/src/panel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -586,11 +586,19 @@ class _SlidingUpPanelState extends State<SlidingUpPanel> with SingleTickerProvid

//returns whether or not the
//panel is open
bool get _isPanelOpen => _ac.value == 1.0;
bool get _isPanelOpen {
// allow 0.01 deviation to match
// AnimationController's _kFlingTolerance
return _ac.value >= 0.99;
}

//returns whether or not the
//panel is closed
bool get _isPanelClosed => _ac.value == 0.0;
bool get _isPanelClosed {
// allow 0.01 deviation to match
// AnimationController's _kFlingTolerance
return _ac.value <= 0.01;
}

//returns whether or not the
//panel is shown/hidden
Expand Down

0 comments on commit 23ec458

Please sign in to comment.