WrapSuper constructor

WrapSuper({
  1. Key? key,
  2. WrapType wrapType = WrapType.balanced,
  3. WrapFit wrapFit = WrapFit.min,
  4. double spacing = 0.0,
  5. double lineSpacing = 0.0,
  6. WrapSuperAlignment alignment = WrapSuperAlignment.left,
  7. List<Widget> children = const [],
})

WrapSuper is a Wrap with a better, minimum raggedness algorithm for line-breaks. Just like a regular Wrap widget with direction = Axis.horizontal, WrapSuper displays its children in lines. It will leave spacing horizontal space between each child, and it will leave lineSpacing vertical space between each line. Each line will then be aligned according to the alignment.

WrapSuper with WrapType.fit is just like Wrap.

However, WrapSuper with WrapType.balanced (the default) follows a more balanced layout. It will result in the same number of lines as Wrap, but lines will tend to be more similar in width.

You can see my original StackOverflow question that prompted this widget here: https://stackoverflow.com/questions/51679895/in-flutter-how-to-balance-the-children-of-the-wrap-widget

And you can see the algorithm I am using here (Divide and Conquer): https://xxyxyz.org/line-breaking/

Implementation

WrapSuper({
  Key? key,
  this.wrapType = WrapType.balanced,
  this.wrapFit = WrapFit.min,
  this.spacing = 0.0,
  this.lineSpacing = 0.0,
  this.alignment = WrapSuperAlignment.left,
  List<Widget> children = const [],
}) : super(key: key, children: children);