From 8136dd5c0c9e75573bfc3043de514b7bd9a7f5cf Mon Sep 17 00:00:00 2001 From: David <8vsxdxd@gmail.com> Date: Mon, 21 Sep 2020 13:29:11 +0200 Subject: [PATCH] The miniplayer can now only be dismissed if onDismiss is set --- lib/miniplayer.dart | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/miniplayer.dart b/lib/miniplayer.dart index 109d91d..7b975d2 100644 --- a/lib/miniplayer.dart +++ b/lib/miniplayer.dart @@ -199,11 +199,12 @@ class _MiniplayerState extends State with TickerProviderStateMixin { else ///DismissedPercentage > 0.2 -> dismiss - if (_percentageFromValueInRange( - min: widget.minHeight, - max: 0, - value: _dragHeight) > - snapPercentage) snap = SnapPosition.DISMISS; + if (widget.onDismiss != null && + _percentageFromValueInRange( + min: widget.minHeight, + max: 0, + value: _dragHeight) > + snapPercentage) snap = SnapPosition.DISMISS; } ///Snap to position @@ -230,11 +231,15 @@ class _MiniplayerState extends State with TickerProviderStateMixin { ///Determines whether the panel should be updated in height or discarded void handleHeightChange() { + ///Drag above minHeight if (_dragHeight >= widget.minHeight) { heightNotifier.value = _dragHeight; if (dragDownPercentage.value != 0) dragDownPercentage.value = 0; - } else { + } + + ///Drag below minHeight + else if (widget.onDismiss != null) { var percentageDown = _borderDouble( minRange: 0, maxRange: 1,