@@ -382,7 +382,7 @@ class BoxTransformer {
382382 return InternalResizeResult (
383383 rect: newRect,
384384 largest: effectiveInitialRect,
385- isValid : isValid,
385+ hasInvalidFlip : isValid,
386386 );
387387 }
388388
@@ -397,7 +397,7 @@ class BoxTransformer {
397397 Flip flip,
398398 ) {
399399 Box area = getAvailableAreaForHandle (
400- rect: rect ,
400+ rect: initialRect ,
401401 clampingRect: clampingRect,
402402 handle: handle,
403403 constraints: constraints,
@@ -453,7 +453,8 @@ class BoxTransformer {
453453
454454 final isValid = isValidBox (rect, constraints, clampingRect);
455455
456- return InternalResizeResult (rect: rect, largest: largest, isValid: isValid);
456+ return InternalResizeResult (
457+ rect: rect, largest: largest, hasInvalidFlip: isValid);
457458 }
458459
459460 /// Handle resizing for the right handle.
@@ -529,7 +530,8 @@ class BoxTransformer {
529530
530531 final isValid = isValidBox (rect, constraints, clampingRect);
531532
532- return InternalResizeResult (rect: rect, largest: largest, isValid: isValid);
533+ return InternalResizeResult (
534+ rect: rect, largest: largest, hasInvalidFlip: isValid);
533535 }
534536
535537 /// handle resizing for the left handle
@@ -605,7 +607,8 @@ class BoxTransformer {
605607
606608 final isValid = isValidBox (rect, constraints, clampingRect);
607609
608- return InternalResizeResult (rect: rect, largest: largest, isValid: isValid);
610+ return InternalResizeResult (
611+ rect: rect, largest: largest, hasInvalidFlip: isValid);
609612 }
610613
611614 /// handle resizing for the bottom handle.
@@ -681,7 +684,8 @@ class BoxTransformer {
681684
682685 final isValid = isValidBox (rect, constraints, clampingRect);
683686
684- return InternalResizeResult (rect: rect, largest: largest, isValid: isValid);
687+ return InternalResizeResult (
688+ rect: rect, largest: largest, hasInvalidFlip: isValid);
685689 }
686690
687691 /// handle resizing for the top handle.
@@ -757,7 +761,8 @@ class BoxTransformer {
757761
758762 final isValid = isValidBox (rect, constraints, clampingRect);
759763
760- return InternalResizeResult (rect: rect, largest: largest, isValid: isValid);
764+ return InternalResizeResult (
765+ rect: rect, largest: largest, hasInvalidFlip: isValid);
761766 }
762767
763768 /// Handles the symmetric resize mode for corner handles.
@@ -987,7 +992,8 @@ class BoxTransformer {
987992
988993 final isValid = isValidBox (rect, constraints, clampingRect);
989994
990- return InternalResizeResult (rect: rect, largest: largest, isValid: isValid);
995+ return InternalResizeResult (
996+ rect: rect, largest: largest, hasInvalidFlip: isValid);
991997 }
992998
993999 /// Handle resizing for [HandlePosition.bottomLeft] handle
@@ -1057,7 +1063,8 @@ class BoxTransformer {
10571063
10581064 final isValid = isValidBox (rect, constraints, clampingRect);
10591065
1060- return InternalResizeResult (rect: rect, largest: largest, isValid: isValid);
1066+ return InternalResizeResult (
1067+ rect: rect, largest: largest, hasInvalidFlip: isValid);
10611068 }
10621069
10631070 /// Handle resizing for [HandlePosition.topRight] handle
@@ -1127,7 +1134,8 @@ class BoxTransformer {
11271134
11281135 final isValid = isValidBox (rect, constraints, clampingRect);
11291136
1130- return InternalResizeResult (rect: rect, largest: largest, isValid: isValid);
1137+ return InternalResizeResult (
1138+ rect: rect, largest: largest, hasInvalidFlip: isValid);
11311139 }
11321140
11331141 /// Handle resizing for [ResizeMode.symmetric] .
@@ -1229,9 +1237,13 @@ class BoxTransformer {
12291237 break ;
12301238 }
12311239
1232- if (! result.isValid) {
1240+ if (! result.hasInvalidFlip) {
1241+ // Since we can't flip the box, rect (which is a raw rect with delta applied)
1242+ // would be flipped so we can't use that because it would make the size
1243+ // calculations wrong. Instead we use box from the result which is the
1244+ // flipped box but with correct constraints applied. (min rect always).
12331245 return handleScaleResizing (
1234- rect: rect,
1246+ rect: result. rect,
12351247 initialBox: initialBox,
12361248 clampingRect: clampingRect,
12371249 handle: handle,
@@ -1282,13 +1294,13 @@ class InternalResizeResult {
12821294 final Box largest;
12831295
12841296 /// Whether the resulting rect is valid and adheres to the constraints.
1285- final bool isValid ;
1297+ final bool hasInvalidFlip ;
12861298
12871299 /// The result of a resize operation.
12881300 InternalResizeResult ({
12891301 required this .rect,
12901302 required this .largest,
1291- this .isValid = true ,
1303+ this .hasInvalidFlip = true ,
12921304 });
12931305
12941306 @override
@@ -1298,13 +1310,13 @@ class InternalResizeResult {
12981310 runtimeType == other.runtimeType &&
12991311 rect == other.rect &&
13001312 largest == other.largest &&
1301- isValid == other.isValid ;
1313+ hasInvalidFlip == other.hasInvalidFlip ;
13021314
13031315 @override
1304- int get hashCode => Object .hash (rect, largest, isValid );
1316+ int get hashCode => Object .hash (rect, largest, hasInvalidFlip );
13051317
13061318 @override
13071319 String toString () {
1308- return 'InternalResizeResult(rect: $rect , largest: $largest , isValid: $isValid )' ;
1320+ return 'InternalResizeResult(rect: $rect , largest: $largest , isValid: $hasInvalidFlip )' ;
13091321 }
13101322}
0 commit comments