Support for wrapping the resulting widget in AnimationConfiguration.toStaggeredList() in another widget, also in an Expanded widget #56
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds a new optional parameter
wrapperBuilder
in the helper functionAnimationConfiguration.toStaggeredList()
.This function can be used to wrap the resulting widget of a child widget, located at any index in the children list, in another widget.
Declaration
Widget? Function(int index, Widget child)? wrapperBuilder
Motivation
This helper function wraps each of the children in a
AnimationConfiguration.staggeredList
. So, you cannot wrap your widget in aExpanded
orFlexible
widget, as they needs to be directly placed under aFlex
widget likeRow
orColumn
. This function gives the opportunity to do that, by letting you wrap the resulting widget wrapped inAnimationConfiguration.staggeredList
, in another widget.Use Cases:
This function can be used to wrap your widget in
Expanded
orFlex
widget.How to use?
If you want to wrap the resulting child widget at index 2 in your children list in an
Expanded
widget, you can do that using this function like this:if
null
is returned, the resulting widget wrapped inAnimationConfiguration.staggeredList
is used.The parameter is optional. If not passed, the resulting widgets wrapped in
AnimationConfiguration.staggeredList
are used.