Added WillPopScope
This commit is contained in:
parent
d99551203d
commit
6918f18f8a
|
@ -142,7 +142,15 @@ class _MiniplayerState extends State<Miniplayer> with TickerProviderStateMixin {
|
|||
Widget build(BuildContext context) {
|
||||
if (dismissed) return Container();
|
||||
|
||||
return ValueListenableBuilder(
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
if (heightNotifier.value > widget.minHeight) {
|
||||
_snapToPosition(PanelState.MIN);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
child: ValueListenableBuilder(
|
||||
builder: (BuildContext context, double value, Widget child) {
|
||||
var _percentage = ((value - widget.minHeight)) /
|
||||
(widget.maxHeight - widget.minHeight);
|
||||
|
@ -206,8 +214,8 @@ class _MiniplayerState extends State<Miniplayer> with TickerProviderStateMixin {
|
|||
},
|
||||
onPanEnd: (details) async {
|
||||
///Calculates drag speed
|
||||
double speed =
|
||||
(_dragHeight - _startHeight * _dragHeight < _startHeight
|
||||
double speed = (_dragHeight - _startHeight * _dragHeight <
|
||||
_startHeight
|
||||
? 1
|
||||
: -1) /
|
||||
updateCount *
|
||||
|
@ -268,6 +276,7 @@ class _MiniplayerState extends State<Miniplayer> with TickerProviderStateMixin {
|
|||
);
|
||||
},
|
||||
valueListenable: heightNotifier,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue