@@ -534,6 +534,15 @@ extension ConstrainedWidgetsExt on Widget {
534
534
child: this ,
535
535
);
536
536
}
537
+
538
+ Widget debugWrap ([Color ? color]) {
539
+ return Center (
540
+ child: Container (
541
+ color: color ?? Colors .black,
542
+ child: this ,
543
+ ),
544
+ );
545
+ }
537
546
}
538
547
539
548
class OffBuildWidget extends StatelessWidget {
@@ -2606,6 +2615,14 @@ class _ConstraintRenderBox extends RenderBox
2606
2615
double contentBottom = - double .infinity;
2607
2616
for (int j = 0 ; j < i; j++ ) {
2608
2617
_ConstrainedNode sizeConfirmedChild = _layoutOrderList[j];
2618
+ if (sizeConfirmedChild.isBarrier) {
2619
+ if (sizeConfirmedChild.direction == BarrierDirection .top ||
2620
+ sizeConfirmedChild.direction == BarrierDirection .bottom) {
2621
+ sizeConfirmedChild.helperSize = Size (size.width, 0 );
2622
+ } else {
2623
+ sizeConfirmedChild.helperSize = Size (0 , size.height);
2624
+ }
2625
+ }
2609
2626
sizeConfirmedChild.offset = calculateChildOffset (sizeConfirmedChild);
2610
2627
EdgeInsets margin = sizeConfirmedChild.margin;
2611
2628
EdgeInsets goneMargin = sizeConfirmedChild.goneMargin;
@@ -2672,6 +2689,14 @@ class _ConstraintRenderBox extends RenderBox
2672
2689
: resolvedHeight);
2673
2690
for (int j = 0 ; j < i; j++ ) {
2674
2691
_ConstrainedNode sizeConfirmedChild = _layoutOrderList[j];
2692
+ if (sizeConfirmedChild.isBarrier) {
2693
+ if (sizeConfirmedChild.direction == BarrierDirection .top ||
2694
+ sizeConfirmedChild.direction == BarrierDirection .bottom) {
2695
+ sizeConfirmedChild.helperSize = Size (size.width, 0 );
2696
+ } else {
2697
+ sizeConfirmedChild.helperSize = Size (0 , size.height);
2698
+ }
2699
+ }
2675
2700
sizeConfirmedChild.offset = calculateChildOffset (sizeConfirmedChild);
2676
2701
if (sizeConfirmedChild.callback != null ) {
2677
2702
sizeConfirmedChild.callback! .call (
@@ -2911,9 +2936,7 @@ class _ConstraintRenderBox extends RenderBox
2911
2936
}
2912
2937
2913
2938
/// Helper widgets may have no RenderObject
2914
- if (element.renderBox == null ) {
2915
- element.helperSize = Size (minWidth, minHeight);
2916
- } else {
2939
+ if (element.renderBox != null ) {
2917
2940
/// Due to the design of the Flutter framework, even if a child element is gone, it still has to be laid out
2918
2941
/// I don't understand why the official design is this way
2919
2942
element.renderBox! .layout (
@@ -2925,7 +2948,18 @@ class _ConstraintRenderBox extends RenderBox
2925
2948
),
2926
2949
parentUsesSize: true ,
2927
2950
);
2928
- if (element.isGuideline || element.isBarrier) {
2951
+ }
2952
+ if (element.isGuideline) {
2953
+ element.helperSize = Size (minWidth, minHeight);
2954
+ } else if (element.isBarrier) {
2955
+ if (selfSizeConfirmed) {
2956
+ if (element.direction == BarrierDirection .top ||
2957
+ element.direction == BarrierDirection .bottom) {
2958
+ element.helperSize = Size (size.width, 0 );
2959
+ } else {
2960
+ element.helperSize = Size (0 , size.height);
2961
+ }
2962
+ } else {
2929
2963
element.helperSize = Size (minWidth, minHeight);
2930
2964
}
2931
2965
}
0 commit comments