diff --git a/CHANGELOG.md b/CHANGELOG.md
index e26cd3a..6639358 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,6 @@
-# 4.1.1 Release
+# 4.1.2 Release
-- Optimized the Value Listeners
+- Handled the native pop to notify the status listeners as closing.
## 4.0.0 Release Notes
diff --git a/README.md b/README.md
index 2a2429c..d4238a5 100644
--- a/README.md
+++ b/README.md
@@ -2,10 +2,10 @@
-
+
-
+
diff --git a/example/pubspec.lock b/example/pubspec.lock
index d4b5d47..fbc5de8 100644
--- a/example/pubspec.lock
+++ b/example/pubspec.lock
@@ -47,7 +47,7 @@ packages:
path: ".."
relative: true
source: path
- version: "4.1.1"
+ version: "4.1.2"
fake_async:
dependency: transitive
description:
diff --git a/lib/src/draggable_menu/menu/menu.dart b/lib/src/draggable_menu/menu/menu.dart
index d236f05..dec6080 100644
--- a/lib/src/draggable_menu/menu/menu.dart
+++ b/lib/src/draggable_menu/menu/menu.dart
@@ -57,7 +57,7 @@ class DraggableMenu extends StatefulWidget {
///
/// *To understand better the usage of the "Status Listeners",
/// check out the [Draggable Menu Example](https://github.com/emresoysuren/draggable_menu/tree/main/example) app.*
- final Function(DraggableMenuStatus status, int level)? addStatusListener;
+ final void Function(DraggableMenuStatus status, int level)? addStatusListener;
/// Adds a listener to listen to its Menu Value.
///
@@ -69,7 +69,7 @@ class DraggableMenu extends StatefulWidget {
///
/// *To understand better the usage of the "Value Listeners",
/// check out the [Draggable Menu Example](https://github.com/emresoysuren/draggable_menu/tree/main/example) app.*
- final Function(double menuValue, double? raw, double levelValue)?
+ final void Function(double menuValue, double? raw, double levelValue)?
addValueListener;
/// Specifies the duration of the Draggable Menu's animations.
@@ -461,7 +461,7 @@ class _DraggableMenuState extends State
// CLOSE
_notifyStatusListener(DraggableMenuStatus.closing);
- Navigator.pop(context);
+ Navigator.maybePop(context);
}
// FAST DRAG
@@ -708,40 +708,47 @@ class _DraggableMenuState extends State
@override
Widget build(BuildContext context) {
- return GestureDetector(
- onVerticalDragStart: (details) => _onDragStart(details.globalPosition.dy),
- onVerticalDragUpdate: (details) =>
- _onDragUpdate(details.globalPosition.dy),
- onVerticalDragEnd: (details) => _onDragEnd(details),
- child: Stack(
- children: [
- GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTapUp: (details) {
- _close();
- },
- child: const SizedBox(
- height: double.infinity,
- width: double.infinity,
+ return WillPopScope(
+ onWillPop: () async {
+ _notifyStatusListener(DraggableMenuStatus.closing);
+ return true;
+ },
+ child: GestureDetector(
+ onVerticalDragStart: (details) =>
+ _onDragStart(details.globalPosition.dy),
+ onVerticalDragUpdate: (details) =>
+ _onDragUpdate(details.globalPosition.dy),
+ onVerticalDragEnd: (details) => _onDragEnd(details),
+ child: Stack(
+ children: [
+ GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTapUp: (details) {
+ _close();
+ },
+ child: const SizedBox(
+ height: double.infinity,
+ width: double.infinity,
+ ),
),
- ),
- Positioned(
- key: _widgetKey,
- bottom: _bottom,
- child: ScrollableManagerScope(
- status: _status,
- canExpand: _canExpand,
- onDragStart: (globalPosition) => _onDragStart(globalPosition),
- onDragUpdate: (globalPosition) => _onDragUpdate(globalPosition),
- onDragEnd: (details) => _onDragEnd(details),
- child: UiFormatter(
- maxHeight: _boxHeight ?? _maxHeight,
- minHeight: _boxHeight ?? _minHeight,
- child: _ui,
+ Positioned(
+ key: _widgetKey,
+ bottom: _bottom,
+ child: ScrollableManagerScope(
+ status: _status,
+ canExpand: _canExpand,
+ onDragStart: (globalPosition) => _onDragStart(globalPosition),
+ onDragUpdate: (globalPosition) => _onDragUpdate(globalPosition),
+ onDragEnd: (details) => _onDragEnd(details),
+ child: UiFormatter(
+ maxHeight: _boxHeight ?? _maxHeight,
+ minHeight: _boxHeight ?? _minHeight,
+ child: _ui,
+ ),
),
),
- ),
- ],
+ ],
+ ),
),
);
}
diff --git a/pubspec.yaml b/pubspec.yaml
index a6135ef..32f8194 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,6 +1,6 @@
name: draggable_menu
description: Create Draggable Menus like some popular apps like Instagram, Snapchat, Facebook, Twitter, Youtube etc. You can even make your Draggable Menus look identical to them.
-version: 4.1.1
+version: 4.1.2
repository: https://github.com/emresoysuren/draggable_menu
environment: