Skip to content

Conversation

@xster
Copy link
Member

@xster xster commented Jun 14, 2017

#10468

Mainly extracted components out of the MaterialPageRoute so pages can be pushed and referred to by the CupertinoScaffold without references to material.

/// A delegate PageRoute to which iOS themed page operations are delegated to.
/// It's lazily created on first use.
CupertinoPageRoute<T> _cupertinoPageRoute;
CupertinoPageRoute<T> get cupertinoPageRoute {
Copy link
Contributor

Choose a reason for hiding this comment

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

does this have to be public? It seems like an internal implementation detail.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh great point! There's private getters everywhere I just noticed. Done

@override
bool canTransitionFrom(TransitionRoute<dynamic> nextRoute) {
return nextRoute is MaterialPageRoute<dynamic>;
return nextRoute is MaterialPageRoute<dynamic> || nextRoute is CupertinoPageRoute<dynamic>;
Copy link
Contributor

Choose a reason for hiding this comment

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

alternatively, you could say nextRoute is MaterialPageRoute<dynamic> || (_cupertinoPageRoute != null && _cupertinoPageRoute.canTransitionFrom(nextRoute)) or some such?

Same below.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's slightly semantically different I guess. _cupertinoPageRoute doesn't have to exist yet for the current one to be able to transition from and to the next one.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, fair enough. Pity. :-)

Copy link
Member Author

Choose a reason for hiding this comment

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

Really hoped too that since the analyzer can figure out automatic casting for a is A && a.somethingADoes, that it would also do (a is A || a is B) && a.somethingAAndB'sSuperclassDoes

Copy link
Contributor

Choose a reason for hiding this comment

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

@Hixie
Copy link
Contributor

Hixie commented Jun 14, 2017

LGTM

CupertinoPageRoute<T> _internalCupertinoPageRoute;
CupertinoPageRoute<T> get _cupertinoPageRoute {
if (_internalCupertinoPageRoute == null) {
_internalCupertinoPageRoute = new CupertinoPageRoute<T>(
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: you could use ??= to make this more idiomatic

Copy link
Member Author

Choose a reason for hiding this comment

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

Woohoo, new dart syntax unlocked! Thanks

@xster xster merged commit 36c3a96 into flutter:master Jun 15, 2017
@xster xster deleted the cupertino-page-route branch June 15, 2017 06:33
gspencergoog pushed a commit to gspencergoog/flutter that referenced this pull request Jul 1, 2017
* started copying stuff into cupertino page route

* extracted from material page route. Ready for testing

* works with button and gesture

* tests and docs

* review notes

* review notes
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 13, 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.

3 participants