fitted_box_with_siblings 2.0.0
fitted_box_with_siblings: ^2.0.0 copied to clipboard
A Flutter widget that scales a first child like FittedBox while letting sibling widgets fill rects you compute alongside it.
2.0.0 #
-
BREAKING: Replaced the
computeRectscallback with adelegateof typeFittedBoxWithSiblingsDelegate, which has acomputeRectsmethod and ashouldRelayoutmethod. Rebuilding with an equivalent delegate (sameruntimeType,shouldRelayoutreturns false) no longer triggers an unnecessary relayout on every rebuild. To migrate, move your callback body into a delegate subclass:class MyDelegate extends FittedBoxWithSiblingsDelegate { const MyDelegate(); @override List<Rect> computeRects(BoxConstraints constraints, Size boxSize) => [...]; @override bool shouldRelayout(MyDelegate oldDelegate) => false; } -
Fix:
clipBehaviornow clips siblings (and the fitted child's destination) that extend outside the widget's bounds, not just fit-cropped content. -
Fix:
computeRectsreturning an empty list or too many rects now reports a single descriptiveFlutterError(previously an internalArgumentErroror silent acceptance); too few rects no longer cascades secondary exceptions, and dry layout reports the same error as real layout. -
Fix: the dry baseline now matches the actual baseline (it previously used
Stack-style positioning logic that ignored the computed rects). -
Docs: corrected the
stackFitdocumentation (it transforms the constraints passed tocomputeRects; the first child is always laid out unconstrained) and documented the intrinsic-dimensions approximation.
1.0.0 #
- First stable release.
- Expanded README with a "Why use this package?" section.
- Updated package description.
0.1.0 #
- Initial release.
FittedBoxWithSiblingswidget that scales a first child likeFittedBoxwhile positioning sibling widgets at computed rects.computeRectscallback receives constraints and the first child's natural size, returns aList<Rect>for all children.- Supports
BoxFit,Alignment,StackFit, andClipproperties. - Fix: siblings are now painted and hit-tested even when the fitted child has an empty size.
- Fix: render object default alignment matches widget default (
Alignment.center).