Skip to content

Commit

Permalink
Fix menu toggle callback related issue
Browse files Browse the repository at this point in the history
  • Loading branch information
rasitayaz committed Oct 23, 2021
1 parent ae16796 commit 18d3538
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## 0.0.5

* Fixed `onMenuToggle` callback of `PieMenu` is not being called when the canvas callback is null.

## 0.0.4

* `onMenuToggle` callback at the `PieCanvas` also added for the `PieMenu`.
* `onMenuToggle` callback at `PieCanvas` also added for `PieMenu`.

## 0.0.3

Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.0.4"
version: "0.0.5"
plugin_platform_interface:
dependency: transitive
description:
Expand Down
20 changes: 10 additions & 10 deletions lib/src/displayed_canvas.dart
Original file line number Diff line number Diff line change
Expand Up @@ -341,18 +341,18 @@ class DisplayedCanvasState extends State<DisplayedCanvas>
}

void toggleMenu(bool menuVisible) {
if (_onActiveMenuToggle != null) {
_onActiveMenuToggle!(menuVisible);
}
if (widget.onMenuToggle != null) {
if (_onActiveMenuToggle != null) {
_onActiveMenuToggle!(menuVisible);
}
widget.onMenuToggle!(menuVisible);
if (menuVisible) {
WidgetsBinding.instance!.addPostFrameCallback((duration) {
/// This rebuild prevents menu child being displayed
/// in the wrong offset when the scrollable swiped fast.
setState(() {});
});
}
}
if (menuVisible) {
WidgetsBinding.instance!.addPostFrameCallback((duration) {
/// This rebuild prevents menu child being displayed
/// in the wrong offset when the scrollable swiped fast.
setState(() {});
});
}
}

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: pie_menu
description: A customizable Flutter library that provides a circular context menu.
version: 0.0.4
version: 0.0.5
homepage: https://github.com/RasitAyaz/flutter-pie-menu

environment:
Expand Down

0 comments on commit 18d3538

Please sign in to comment.