Skip to content
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

update physics simulation article based on review feedback #2890

Merged
merged 8 commits into from Aug 8, 2019

Conversation

@johnpryan
Copy link
Collaborator

@johnpryan johnpryan commented Aug 6, 2019

@johnpryan johnpryan requested review from RedBrogdon and sfshaza2 Aug 6, 2019
Copy link
Collaborator

@sfshaza2 sfshaza2 left a comment

LGTM

Copy link
Contributor

@RedBrogdon RedBrogdon left a comment

All nits. LGTM otherwise. 😄

@@ -153,25 +152,26 @@ Widget build(BuildContext context) {

When the widget is released, it should spring back to the center.

Add an `Animation<Alignment>` field and an `_updateAnimation()` method. This
Add an `Animation<Alignment>` field and an `_runAnimation()` method. This

This comment has been minimized.

@RedBrogdon

RedBrogdon Aug 8, 2019
Contributor

nit: I don't see the parens for parameters included on any of the other function names in the text. I could be missing one, though.

end: Alignment.center,
),
);
_controller.reset();

This comment has been minimized.

@RedBrogdon

RedBrogdon Aug 8, 2019
Contributor

nit: indenting.

@@ -184,7 +184,6 @@ void initState() {
});
});
_updateAnimation();
super.initState();

This comment has been minimized.

@RedBrogdon

RedBrogdon Aug 8, 2019
Contributor

This was moved to the top, wasn't it?

This comment has been minimized.

@RedBrogdon

RedBrogdon Aug 8, 2019
Contributor

(super.initState, I mean)

method already sets the direction by setting the animation's start and end
alignment.)
continues at that speed before being snapped back. (The `_runAnimation()` method
already sets the direction by setting the animation's start and end alignment.)

This comment has been minimized.

@RedBrogdon

RedBrogdon Aug 8, 2019
Contributor

nit: extra space after "direction."

var spring = SpringDescription(
const spring = SpringDescription(

This comment has been minimized.

@RedBrogdon

RedBrogdon Aug 8, 2019
Contributor

It's slightly weird to have a constant declared in a function scope rather than in the scope of the file or Widget class itself. If this is the only way to make the article readable, then it's cool to leave it. If you can somehow tell people to add this constant in a more appropriate place without overly complicating the instructions, though, that'd be a good idea.

This comment has been minimized.

@johnpryan

johnpryan Aug 8, 2019
Author Collaborator

discussed in the other review, but I think we should leave it here for readability

}
```

Don't forget to call `_runAnimation()` with the velocity and size:

This comment has been minimized.

@RedBrogdon

RedBrogdon Aug 8, 2019
Contributor

nit: Same note on the parens here as on L155.

/// Update the animation so that it runs from the dragged point back to the
/// center.
void _updateAnimation() {
/// Calculates and runs a [SpringSimulation]

This comment has been minimized.

@RedBrogdon

RedBrogdon Aug 8, 2019
Contributor

nit: period on the end of the comment.

johnpryan added 7 commits Aug 8, 2019
@johnpryan johnpryan merged commit efefdc7 into flutter:master Aug 8, 2019
3 checks passed
3 checks passed
WIP Ready for review
Details
cla/google All necessary CLAs are signed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.