Skip to content

Conversation

@HansMuller
Copy link
Contributor

@HansMuller HansMuller commented Apr 4, 2017

Clarify the roles of the two buildTransitions() animation parameters. I've renamed them primaryAnimation and secondaryAnimation to make it easier to write about them.

Fixes #9132

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you rename all the overrides to be consistent?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Certainly.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we'd usually ave a comma after child and put the ) on the next line.

Copy link
Contributor

Choose a reason for hiding this comment

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

s/PageRouteBuilder/[PageRouteBuilder]/ to linkify it.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe we don't need this paragraph. A bit verbose.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, that's backwards than what I would have assumed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You assumed correctly, I've fixed that.

@abarth
Copy link
Contributor

abarth commented Apr 4, 2017

Gold star

@eseidelGoogle
Copy link
Contributor

FYI @xster

@HansMuller HansMuller force-pushed the build_transitions_doc branch from 91bebc8 to bf58ae3 Compare April 4, 2017 18:59
Copy link
Member

Choose a reason for hiding this comment

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

'that was previously on the top'?

Copy link
Member

Choose a reason for hiding this comment

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

'the secondaryAnimation executed in reverse defines how the route below it'?

Copy link
Member

Choose a reason for hiding this comment

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

I think it's the other way around

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's correct. I've fixed it.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe we don't need this paragraph. A bit verbose.

Copy link
Member

Choose a reason for hiding this comment

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

I think this paragraph is too much opinion on how users would use the API

Copy link
Member

Choose a reason for hiding this comment

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

'this route's transition as the new top of the navigator stack'?

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 think it's important to note that this parameter is rarely used but I've left out my opnion as to why.

Copy link
Member

Choose a reason for hiding this comment

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

This whole paragraph sounds like it's referring to something that's not 'self' but the API is still asking the user to build animated widgets associated with the same 'self' route.

Perhaps 'The animation for this route when it's the second topmost route on the stack. It runs from 0.0 to 1.0 as another route is pushed on top of this one and from 1.0 to 0.0 as another route above this one is popped.

This animation runs together with the [primaryAnimation] of the route above it'?

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 agree, the way this is written (likewise for the other animation parameter) could be confusing. I've rewritten it in the same terms as the introductory material.

@xster
Copy link
Member

xster commented Apr 4, 2017

Let's chat in person. I still like Adam's idea of splitting the API into 2 methods for clarity.

@xster
Copy link
Member

xster commented Apr 4, 2017

re: #9182 (comment)
We can do that in a different PR as well. Either way, I think this PR is a monotonically upward step for clarity

p.s. there are more animations in cupertino/page.dart to swap incoming->primary and outgoing->secondary for consistency

@HansMuller HansMuller force-pushed the build_transitions_doc branch from e771174 to a4267c0 Compare April 4, 2017 21:13
///
/// ```dart
/// new PageRouteBuilder(
/// pageBuilder: (BuildContext context, _, __) {
Copy link
Contributor

Choose a reason for hiding this comment

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

an argument for not using _: when someone copies this code, they will wonder what those parameters are. It will be a pain for them to find out, because they'll have to first look at PageRouteBuilder, then look up pageBuilder from there, then look up the typedef, then study it. If we just type and name the parameters here, it will be self-documenting.

/// BuildContext context,
/// Animation<double> animation,
/// Animation<double> secondaryAnimation,
/// Widget child) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: newline before )

@Hixie
Copy link
Contributor

Hixie commented Apr 4, 2017

LGTM

@HansMuller HansMuller merged commit 20e214f into flutter:master Apr 5, 2017
@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.

Clarify the names animation and forwardAnimation

6 participants