Skip to content

Add onDrawerChanged event handler#36

Open
Fironn wants to merge 2 commits intoNikhilVadoliya:masterfrom
Fironn:fix/add-onDrawerChanged
Open

Add onDrawerChanged event handler#36
Fironn wants to merge 2 commits intoNikhilVadoliya:masterfrom
Fironn:fix/add-onDrawerChanged

Conversation

@Fironn
Copy link
Copy Markdown

@Fironn Fironn commented Jun 20, 2024

Changes: Adding the onDrawerChanged event handler for monitoring changes in the Drawer status.

Motivation: Hello, and thank you for creating this wonderful library. I am interested in using it and would like to capture events when the Drawer status changes. Therefore, I have already tested it and can confirm it works on iOS 18.0.

Usage: By including the argument

onDrawerChanged: (opened) {
  print(opened);
}

you can monitor the Drawer open/close events.

@bendangelo
Copy link
Copy Markdown

Can this get merged?

@bendangelo
Copy link
Copy Markdown

I reimplemented this on my own branch.

@NikhilVadoliya
Copy link
Copy Markdown
Owner

NikhilVadoliya commented Mar 17, 2025

  • PR comment fixed
  • Update document
  • Solve conflict

vsync: this, duration: Duration(milliseconds: widget.animationDuration))
..addStatusListener((status) {
if (status == AnimationStatus.completed) {
widget.onDrawerChanged!(true);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will throw the error if the user does not use onDrawerChanged.
use => onDrawerChanged?.call();

if (status == AnimationStatus.completed) {
widget.onDrawerChanged!(true);
} else if (status == AnimationStatus.dismissed) {
widget.onDrawerChanged!(false);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants