Skip to content

Conversation

@HansMuller
Copy link
Contributor

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.

@flutter-dashboard flutter-dashboard bot added d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos documentation f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. c: contributor-productivity Team-specific productivity, code health, technical debt. labels Feb 14, 2022
@HansMuller HansMuller requested a review from chunhtai February 14, 2022 23:51
Copy link
Contributor

@chunhtai chunhtai left a 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);
Copy link
Contributor

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

Copy link
Contributor Author

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'); },
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

@chunhtai chunhtai left a 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); },
Copy link
Contributor

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

Copy link
Contributor Author

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.

@HansMuller HansMuller merged commit db4c98f into flutter:master Feb 15, 2022
@HansMuller HansMuller deleted the nested_navigator_example branch February 15, 2022 21:28
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 15, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 15, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Feb 15, 2022
clocksmith pushed a commit to clocksmith/flutter that referenced this pull request Mar 8, 2022
@mark8044
Copy link

mark8044 commented Jun 6, 2022

@HansMuller
@chunhtai

When running this on iOS, scroll to top functionality doesn't work when tapping the status bar

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

Labels

c: contributor-productivity Team-specific productivity, code health, technical debt. d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants