Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Commit

Permalink
native pop status
Browse files Browse the repository at this point in the history
  • Loading branch information
soemre committed Jun 26, 2023
1 parent 5c216cc commit 3ab32eb
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 40 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

<p align="center">
<a href="https://pub.dev/packages/draggable_menu">
<img src="https://img.shields.io/badge/pub-v4.1.1-%237f7eff?style=flat&logo=flutter">
<img src="https://img.shields.io/badge/pub-v4.1.2-%237f7eff?style=flat&logo=flutter">
</a>
<a href="https://github.com/emresoysuren/draggable_menu">
<img src="https://img.shields.io/badge/GitHub-v4.1.1-%237f7eff?style=flat&logo=github">
<img src="https://img.shields.io/badge/GitHub-v4.1.2-%237f7eff?style=flat&logo=github">
</a>
</p>

Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ packages:
path: ".."
relative: true
source: path
version: "4.1.1"
version: "4.1.2"
fake_async:
dependency: transitive
description:
Expand Down
75 changes: 41 additions & 34 deletions lib/src/draggable_menu/menu/menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand All @@ -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.
Expand Down Expand Up @@ -461,7 +461,7 @@ class _DraggableMenuState extends State<DraggableMenu>

// CLOSE
_notifyStatusListener(DraggableMenuStatus.closing);
Navigator.pop(context);
Navigator.maybePop(context);
}

// FAST DRAG
Expand Down Expand Up @@ -708,40 +708,47 @@ class _DraggableMenuState extends State<DraggableMenu>

@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,
),
),
),
),
],
],
),
),
);
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down

0 comments on commit 3ab32eb

Please sign in to comment.