-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Added a NavgationBar example with nested Navigators #98440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added a NavgationBar example with nested Navigators #98440
Conversation
chunhtai
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly looks good, left some comments
| if (destinationFaders[index].isAnimating) { | ||
| return IgnorePointer(child: view); | ||
| } | ||
| return Offstage(child: view); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can wrap all child with Offstage and toggle the flag instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, that way the tree doesn't need to change.
| title: Text('${destination.title} AlertDialog'), | ||
| actions: <Widget>[ | ||
| TextButton( | ||
| onPressed: () { Navigator.pop(context, 'OK'); }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the result for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, there's no need for the 'OK' argument.
chunhtai
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| title: Text('${destination.title} AlertDialog'), | ||
| actions: <Widget>[ | ||
| TextButton( | ||
| onPressed: () { Navigator.pop(context); }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be arrow method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I prefer to only use the => notation for functions that return a value.
|
When running this on iOS, scroll to top functionality doesn't work when tapping the status bar |
Added an example of a NavigationBar where each destination is managed by a nested Navigator.
Try the example in DartPad: https://dartpad.dev/?id=37a8f13c000cf229857f6c36b4a55ee6
Addresses issues raised in #18740. Similar examples to come for NavigationRail, BottomNavigationBar, and TabBar.