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

Support for wrapping the resulting widget in AnimationConfiguration.toStaggeredList() in another widget, also in an Expanded widget #56

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

souradeep98
Copy link

This adds a new optional parameter wrapperBuilder in the helper function AnimationConfiguration.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 a Expanded or Flexible widget, as they needs to be directly placed under a Flex widget like Row or Column. This function gives the opportunity to do that, by letting you wrap the resulting widget wrapped in AnimationConfiguration.staggeredList, in another widget.

Use Cases:
This function can be used to wrap your widget in Expanded or Flex 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:

wrapperBuilder: (index, child) {
  if (index == 2) {
    return Expanded(
      child: child,
    );
  }
  return null;
},

if null is returned, the resulting widget wrapped in AnimationConfiguration.staggeredList is used.

The parameter is optional. If not passed, the resulting widgets wrapped in AnimationConfiguration.staggeredList are used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant