Remove reference to MaterialApp and showCupertinoModalPopup from CupertinoAlertDialog (#150725)

This PR removes the usage of Material widgets from unit tests of `CupertinoAlertDialog`. Other than it being just wrong, it also introduces bad behavior, such as the scroll view can't be overscrolled so that the overscroll behavior can't be tested.
* Since there are no longer M2 or M3 variants of tests, I straight up rewrote the unit tests for "default look" with similar tests as those of `CupertinoActionSheet` ([here](https://github.com/flutter/flutter/blob/master/packages/flutter/test/cupertino/action_sheet_test.dart#L21))

This PR also replaces `showCupertinoModalPopup` with `showCupertinoDialog` in `CupertinoAlertDialog`'s example code. The former should only be used by `CupertinoActionSheet`, which has a different animation from the correct `showCupertinoDialog`.
This commit is contained in:
Tong Mu
2024-06-25 15:45:05 -07:00
committed by GitHub
parent a6a8caaa73
commit 98fb56fc05
2 changed files with 138 additions and 97 deletions

View File

@@ -23,9 +23,8 @@ class AlertDialogApp extends StatelessWidget {
class AlertDialogExample extends StatelessWidget {
const AlertDialogExample({super.key});
// This shows a CupertinoModalPopup which hosts a CupertinoAlertDialog.
void _showAlertDialog(BuildContext context) {
showCupertinoModalPopup<void>(
showCupertinoDialog<void>(
context: context,
builder: (BuildContext context) => CupertinoAlertDialog(
title: const Text('Alert'),