@@ -2476,10 +2476,8 @@ class _ConstraintRenderBox extends RenderBox
2476
2476
resolvedHeight == wrapContent
2477
2477
? constraints.minHeight
2478
2478
: resolvedHeight);
2479
- double contentLeft = double .infinity;
2480
- double contentTop = double .infinity;
2481
- double contentRight = - double .infinity;
2482
- double contentBottom = - double .infinity;
2479
+ double contentWidth = - double .infinity;
2480
+ double contentHeight = - double .infinity;
2483
2481
for (int j = 0 ; j < i; j++ ) {
2484
2482
_ConstrainedNode sizeConfirmedChild = _layoutOrderList[j];
2485
2483
@@ -2509,69 +2507,43 @@ class _ConstraintRenderBox extends RenderBox
2509
2507
2510
2508
sizeConfirmedChild.offset =
2511
2509
calculateChildOffset (sizeConfirmedChild);
2512
- EdgeInsets margin = sizeConfirmedChild.margin;
2513
- EdgeInsets goneMargin = sizeConfirmedChild.goneMargin;
2514
- double childLeft = max (sizeConfirmedChild.getX (), 0 );
2515
- double childTop = max (sizeConfirmedChild.getY (), 0 );
2516
- double childRight =
2517
- childLeft + sizeConfirmedChild.getMeasuredWidth ();
2518
- double childBottom =
2519
- childTop + sizeConfirmedChild.getMeasuredHeight ();
2520
-
2521
- if (element.leftConstraint != null ) {
2522
- if (element.leftConstraint! .notLaidOut) {
2523
- childLeft -= _getLeftInsets (goneMargin);
2524
- } else {
2525
- childLeft -= _getLeftInsets (margin);
2526
- }
2527
- }
2528
-
2529
- if (element.topConstraint != null ) {
2530
- if (element.topConstraint! .notLaidOut) {
2531
- childTop -= _getTopInsets (goneMargin);
2532
- } else {
2533
- childTop -= _getTopInsets (margin);
2534
- }
2535
- }
2536
-
2537
- if (element.rightConstraint != null ) {
2538
- if (element.rightConstraint! .notLaidOut) {
2539
- childRight += _getRightInsets (goneMargin);
2540
- } else {
2541
- childRight += _getRightInsets (margin);
2542
- }
2543
- }
2544
-
2545
- if (element.bottomConstraint != null ) {
2546
- if (element.bottomConstraint! .notLaidOut) {
2547
- childBottom += _getBottomInsets (goneMargin);
2548
- } else {
2549
- childBottom += _getBottomInsets (margin);
2550
- }
2551
- }
2552
-
2553
- if (childLeft < contentLeft) {
2554
- contentLeft = childLeft;
2510
+ double childSpanWidth = sizeConfirmedChild.getMeasuredWidth ();
2511
+ double childSpanHeight = sizeConfirmedChild.getMeasuredHeight ();
2512
+
2513
+ if (sizeConfirmedChild.leftConstraint != null &&
2514
+ sizeConfirmedChild.rightConstraint != null ) {
2515
+ } else if (sizeConfirmedChild.leftConstraint != null ) {
2516
+ childSpanWidth += sizeConfirmedChild.getX ();
2517
+ } else if (sizeConfirmedChild.rightConstraint != null ) {
2518
+ childSpanWidth += size.width - sizeConfirmedChild.getRight ();
2519
+ } else {
2520
+ /// It is not possible to execute this branch
2555
2521
}
2556
2522
2557
- if (childTop < contentTop) {
2558
- contentTop = childTop;
2523
+ if (sizeConfirmedChild.topConstraint != null &&
2524
+ sizeConfirmedChild.bottomConstraint != null ) {
2525
+ } else if (sizeConfirmedChild.topConstraint != null ) {
2526
+ childSpanHeight += sizeConfirmedChild.getY ();
2527
+ } else if (sizeConfirmedChild.bottomConstraint != null ) {
2528
+ childSpanHeight += size.height - sizeConfirmedChild.getBottom ();
2529
+ } else {
2530
+ /// It is not possible to execute this branch
2559
2531
}
2560
2532
2561
- if (childRight > contentRight ) {
2562
- contentRight = childRight ;
2533
+ if (childSpanWidth > contentWidth ) {
2534
+ contentWidth = childSpanWidth ;
2563
2535
}
2564
2536
2565
- if (childBottom > contentBottom ) {
2566
- contentBottom = childBottom ;
2537
+ if (childSpanHeight > contentHeight ) {
2538
+ contentHeight = childSpanHeight ;
2567
2539
}
2568
2540
}
2569
2541
size = Size (
2570
2542
resolvedWidth == wrapContent
2571
- ? constraints.constrainWidth (contentRight - contentLeft )
2543
+ ? constraints.constrainWidth (contentWidth )
2572
2544
: resolvedWidth,
2573
2545
resolvedHeight == wrapContent
2574
- ? constraints.constrainHeight (contentBottom - contentTop )
2546
+ ? constraints.constrainHeight (contentHeight )
2575
2547
: resolvedHeight);
2576
2548
for (int j = 0 ; j < i; j++ ) {
2577
2549
_ConstrainedNode sizeConfirmedChild = _layoutOrderList[j];
0 commit comments