diff --git a/packages/flutter/lib/src/cupertino/action_sheet.dart b/packages/flutter/lib/src/cupertino/action_sheet.dart index 1158dbead6..2cd0d0e525 100644 --- a/packages/flutter/lib/src/cupertino/action_sheet.dart +++ b/packages/flutter/lib/src/cupertino/action_sheet.dart @@ -1185,7 +1185,7 @@ class _RenderCupertinoAlertActions extends RenderBox final Path backgroundFillPath = Path() ..fillType = PathFillType.evenOdd - ..addRect(Rect.largest); + ..addRect(Rect.fromLTWH(0.0, 0.0, size.width, size.height)); final Path pressedBackgroundFillPath = Path(); diff --git a/packages/flutter/lib/src/cupertino/dialog.dart b/packages/flutter/lib/src/cupertino/dialog.dart index a9d40fba62..eea7ce9aa8 100644 --- a/packages/flutter/lib/src/cupertino/dialog.dart +++ b/packages/flutter/lib/src/cupertino/dialog.dart @@ -1578,7 +1578,7 @@ class _RenderCupertinoDialogActions extends RenderBox // Create the button backgrounds path and paint it. final Path backgroundFillPath = Path() ..fillType = PathFillType.evenOdd - ..addRect(Rect.largest) + ..addRect(Rect.fromLTWH(0.0, 0.0, size.width, size.height)) ..addRect(verticalDivider); for (int i = 0; i < pressedButtonRects.length; i += 1) { @@ -1616,7 +1616,7 @@ class _RenderCupertinoDialogActions extends RenderBox final Path backgroundFillPath = Path() ..fillType = PathFillType.evenOdd - ..addRect(Rect.largest); + ..addRect(Rect.fromLTWH(0.0, 0.0, size.width, size.height)); final Path pressedBackgroundFillPath = Path(); diff --git a/packages/flutter/test/cupertino/dialog_test.dart b/packages/flutter/test/cupertino/dialog_test.dart index 1837918e88..52dcd34f84 100644 --- a/packages/flutter/test/cupertino/dialog_test.dart +++ b/packages/flutter/test/cupertino/dialog_test.dart @@ -678,14 +678,15 @@ void main() { // the dividers also paints a white background the size of Rect.largest. // That background ends up being clipped by the containing ScrollView. // - // Here we test that the largest Rect is contained within the painted Path. + // Here we test that the Rect(0.0, 0.0, renderBox.size.width, renderBox.size.height) + // is contained within the painted Path. // We don't test for exclusion because for some reason the Path is reporting // that even points beyond Rect.largest are within the Path. That's not an // issue for our use-case, so we don't worry about it. expect(actionsSectionBox, paints..path( includes: [ - Offset(Rect.largest.left, Rect.largest.top), - Offset(Rect.largest.right, Rect.largest.bottom), + const Offset(0.0, 0.0), + Offset(actionsSectionBox.size.width, actionsSectionBox.size.height), ], )); });