Skip to content

Conversation

@HansMuller
Copy link
Contributor

  • Navigator.popUntil() applies pop() until predicate(currentRoute) returns true.
  • Revised pesto route popping and pushing procedures

Fixes #5159
Fixes #5103

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should provide a currying function that returns this predicate...

So this becomes:

Navigator.popUntil(context, ModalRoute.matches('/pesto'));
// in ModalRoute:
static RoutePredicate matches(String routeName) {
  return (Route<dynamic> route) {
    return !route.willHandlePopInternally && route is ModalRoute && route.settings.name == routeName;
  }
}

Copy link
Contributor

Choose a reason for hiding this comment

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

or maybe "withName" or "hasName" rather than "matches"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd thought about providing a utility function ModalRoute.withName(route, name) but it didn't seem useful enough. A ModalRoute.withName(name) that returns a predicate (and factors in willHandlePopInternally, which would be the common case) would be pretty slick.

@Hixie
Copy link
Contributor

Hixie commented Aug 1, 2016

add a gallery test that checks that the drawer works as expected in pesto (i.e. that the bugs are fixed, and that routes don't stack up).

add a framework test that checks that popUntil works correctly around local history routes.

@Hixie
Copy link
Contributor

Hixie commented Aug 1, 2016

LGTM

@HansMuller HansMuller merged commit 56a2d22 into flutter:master Aug 1, 2016
@HansMuller HansMuller deleted the pesto_home_stack branch August 1, 2016 22:10
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gallery Pesto: homes stack up Gallery, Pesto: back button does nothing after going home from drawer

2 participants