-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Create a CupertinoPageRoute #10686
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
Create a CupertinoPageRoute #10686
Conversation
| /// 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 { |
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.
does this have to be public? It seems like an internal implementation detail.
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.
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>; |
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.
alternatively, you could say nextRoute is MaterialPageRoute<dynamic> || (_cupertinoPageRoute != null && _cupertinoPageRoute.canTransitionFrom(nextRoute)) or some such?
Same below.
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.
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.
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.
Yeah, fair enough. Pity. :-)
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.
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
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.
| CupertinoPageRoute<T> _internalCupertinoPageRoute; | ||
| CupertinoPageRoute<T> get _cupertinoPageRoute { | ||
| if (_internalCupertinoPageRoute == null) { | ||
| _internalCupertinoPageRoute = new CupertinoPageRoute<T>( |
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.
nit: you could use ??= to make this more idiomatic
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.
Woohoo, new dart syntax unlocked! Thanks
* 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
#10468
Mainly extracted components out of the MaterialPageRoute so pages can be pushed and referred to by the CupertinoScaffold without references to material.