这是indexloc提供的服务,不要输入任何密码
Skip to content

add AnimatedSlide widget #86395

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

Merged
merged 24 commits into from
Jul 17, 2021
Merged

add AnimatedSlide widget #86395

merged 24 commits into from
Jul 17, 2021

Conversation

emvaized
Copy link
Contributor

@emvaized emvaized commented Jul 14, 2021

While Flutter already provides easy-to-use implicitly animated widgets, like AnimatedOpacity or AnimatedPositioned (and now also AnimatedScale and AnimatedRotation), there's no such widget for item's offset animation — which would behave the same as SlideTransition, but wouldn't require AnimationController to be provided.

This PR adds AnimatedOffset widget to resolve this, which could be considered an implicitly animated version of Transform.translate.

Fixes: #86081

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt.
  • All existing and new tests are passing.

@flutter-dashboard flutter-dashboard bot added the framework flutter/packages/flutter repository. See also f: labels. label Jul 14, 2021
@google-cla google-cla bot added the cla: yes label Jul 14, 2021
Copy link
Contributor

@flar flar left a comment

Choose a reason for hiding this comment

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

This looks great. A couple of minor things to change and it should be good to go.

@flar flar requested a review from Hixie July 14, 2021 08:28
@emvaized emvaized requested a review from flar July 14, 2021 15:05
@emvaized
Copy link
Contributor Author

emvaized commented Jul 14, 2021

@flar
I've covered small things you mentioned, and also renamed widget to AnimatedSlide to make the naming more explicit.
I also noticed that IDE added unwanted formatting to the code in latest commits - sorry about that, will fix now

@emvaized emvaized changed the title add AnimatedOffset widget add AnimatedSlide widget Jul 14, 2021
@emvaized
Copy link
Contributor Author

I guess it became unclear now what lines I actually changed.
So I will revert latest 4 commits and create 2 new commits with actual changes — sorry for this mess.

@flar
Copy link
Contributor

flar commented Jul 14, 2021

It looks like you got the space at the end of the file, but the Linux analyze test is also complaining about spaces at the ends of lines.

@emvaized emvaized requested a review from flar July 15, 2021 04:24
@emvaized emvaized requested a review from flar July 16, 2021 16:00
@flar
Copy link
Contributor

flar commented Jul 16, 2021

The docs are failing with the following error:

dartdoc:stdout: Generating docs for library widgets from package:flutter/widgets.dart...
dartdoc:stderr:   error: unresolved doc reference [alignment]
dartdoc:stderr:     from widgets.AnimatedSlide: (file:///b/s/w/ir/x/w/flutter%20sdk/packages/flutter/lib/src/widgets/implicit_animations.dart:1735:7)

It looks like you mention another widget and in that comment you attempt to reference one of its properties (alignment) that is not in scope for the comment for your widget.

You might have copied the comment from AnimatedContainer which got away with this because it also has an alignment property - which means its comment has a bug in that it is referencing the wrong property and the checks failed to notice due to serendipity.

The AnimatedPadding makes this reference to another widget's property correctly [AnimatedAlign.alignment].

It would be nice to fix AnimatedContainer's comment reference as well while you are fixing that up in your own doc comment.

@emvaized
Copy link
Contributor Author

@flar Thanks a lot for your help. I changed docs references to AnimatedAlign.alignment for both AnimatedSlide and AnimatedContainer, and now all tests seem to pass with no errors.

Copy link
Contributor

@flar flar left a comment

Choose a reason for hiding this comment

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

LGTM

@fluttergithubbot fluttergithubbot merged commit 34f69ce into flutter:master Jul 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implicitly animated "AnimatedOffset" widget
6 participants