-
Notifications
You must be signed in to change notification settings - Fork 28k
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
Add SliverAnimatedGrid
and AnimatedGrid
#112982
Conversation
3f1b328
to
0552ff1
Compare
/// Signature for the builder callback used by [AnimatedGrid]. | ||
typedef AnimatedGridItemBuilder = Widget Function(BuildContext context, int index, Animation<double> animation); | ||
|
||
/// Signature for the builder callback used by [AnimatedGridState.removeItem]. | ||
typedef AnimatedGridRemovedItemBuilder = Widget Function(BuildContext context, Animation<double> animation); |
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.
Since the signatures are the same, do you think there is any benefit of creating one AnimatedItemBuilder and one AnimatedRemovedItemBuilder that both list and grid use?
We would probably have to add the new ones to AnimatedList, and deprecate the old ones... so if it feels like unnecessary churn we can have separate ones.
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.
I can explore this in the follow up refactor. I'll file an issue to track.
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.
In the meantime should I use AnimatedListItemBuilder here instead? That seems weird, though. I could just not use a typedef? Just trying to avoid introducing API surface that lasts only a until the next refactor, but I guess a typedef name is probably rarely actually used.
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.
Renamed to AnimatedItemBuilder
, and we'll refactor AnimatedList
later to take that instead.
/// * [SliverGridDelegateWithFixedCrossAxisCount], which creates a layout with | ||
/// a fixed number of tiles in the cross axis. | ||
/// * [SliverGridDelegateWithMaxCrossAxisExtent], which creates a layout with |
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.
Offline we chatted about adding convenience constructors like count
and extent
in order to spin up a delegate for the user. Can you add those?
Reference: #113107
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.
I'm going to wait to do this, since it became clear that this and AnimatedList might need some refactoring to take a child builder delegate instead of just a builder function.
auto label is removed for flutter/flutter, pr: 112982, due to - Please get at least one approved review if you are already a member or two member reviews if you are not a member before re-applying this label. Reviewers: If you left a comment approving, please use the "approve" review action instead. |
auto label is removed for flutter/flutter, pr: 112982, due to Validations Fail. |
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.
auto label is removed for flutter/flutter, pr: 112982, due to - The status or check suite Linux docs_test has failed. Please fix the issues identified (or deflake) before re-applying this label. |
7ef71df
to
4ba7c77
Compare
Where can we find the preview release and date for |
Description
This adds two widgets, analogous to
SliverAnimatedList
andAnimatedList
which allow items that are added or removed from aSliverGrid
to be animated on add and remove.Added samples for each too.
grid2.mp4
Related Issues
Tests