WrapFit, proposed in PR #136161, is a new way to fit children of Wrap.
Since it's not clear when and if this PR is merged, I've created this package for those developers who need the feature right now.
Disclaimer
As soon, as WrapFit is available in the stable flutter release, I'll archive this package and publish a new version that @deprecates all the features.
Upgrading to the flutter implementation should be as simple as changing Wrap2 to Wrap.
In case the PR doesn't get merged, I might archive this package without an adequate alternative.
Features
Mainly, this package allows developers to stretch a child of Wrap2 to fill the remaining space of the current run.
Getting started
- Add the package to the dependencies:
flutter pub add wrapfit - Use
Wrap2instead ofWrap - Wrap a child of
Wrap2withWrappedand setfit.WrapFit.runTightWrapFit.runLooseWrapFit.tightWrapFit.loose
Usage
(Also have a look at the full app example.)
Wrap2(
children: [
Text("Default (loose)"),
Wrapped(
fit: WrapFit.runTight,
child: Text("runTight"),
),
Wrapped(
fit: WrapFit.runLoose,
child: Text("runLoose"),
),
Wrapped(
fit: WrapFit.tight,
child: Text("tight"),
),
Wrapped(
fit: WrapFit.loose,
child: Text("loose"),
),
]
)