@@ -24,47 +24,39 @@ void showNativeDialog(
2424 if (defaultTargetPlatform == TargetPlatform .iOS) {
2525 showCupertinoDialog <void >(
2626 context: context,
27- builder: (context) => CupertinoAlertDialog (
28- title: Text (title),
29- content: Text (content),
30- actions: actions
31- .map (
32- (action) => CupertinoDialogAction (
33- onPressed: action.onTap,
34- isDestructiveAction: action.isDestructiveAction,
35- child: Text (action.text),
36- ),
37- )
38- .toList (),
39- ),
27+ builder:
28+ (context) => CupertinoAlertDialog (
29+ title: Text (title),
30+ content: Text (content),
31+ actions:
32+ actions
33+ .map (
34+ (action) => CupertinoDialogAction (
35+ onPressed: action.onTap,
36+ isDestructiveAction: action.isDestructiveAction,
37+ child: Text (action.text),
38+ ),
39+ )
40+ .toList (),
41+ ),
4042 );
4143 } else {
4244 showDialog <void >(
4345 context: context,
44- builder: (context) => AlertDialog (
45- title: Text (title),
46- content: Text (content),
47- actions: actions
48- .map (
49- (action) => TextButton (
50- onPressed: action.onTap,
51- child: Text (action.text),
52- ),
53- )
54- .toList (),
55- ),
46+ builder:
47+ (context) => AlertDialog (
48+ title: Text (title),
49+ content: Text (content),
50+ actions: actions.map ((action) => TextButton (onPressed: action.onTap, child: Text (action.text))).toList (),
51+ ),
5652 );
5753 }
5854}
5955
6056/// A dialog action which is used to show the actions of a native dialog.
6157class DialogAction {
6258 /// Creates a [DialogAction] .
63- const DialogAction ({
64- required this .text,
65- required this .onTap,
66- this .isDestructiveAction = false ,
67- });
59+ const DialogAction ({required this .text, required this .onTap, this .isDestructiveAction = false });
6860
6961 /// The text of the action.
7062 final String text;
0 commit comments