File tree Expand file tree Collapse file tree 3 files changed +23
-6
lines changed
Expand file tree Collapse file tree 3 files changed +23
-6
lines changed Original file line number Diff line number Diff line change 11# Changelog
22
3+ ## 0.0.13
4+ * added automatic closing of native dialog.
5+
36## 0.0.12
47* Updated dependencies
58* Added test_util: catch presentation event helper, DeviceSizes
Original file line number Diff line number Diff line change @@ -25,14 +25,17 @@ void showNativeDialog(
2525 showCupertinoDialog <void >(
2626 context: context,
2727 builder:
28- (context ) => CupertinoAlertDialog (
28+ (dialogContext ) => CupertinoAlertDialog (
2929 title: Text (title),
3030 content: Text (content),
3131 actions:
3232 actions
3333 .map (
3434 (action) => CupertinoDialogAction (
35- onPressed: action.onTap,
35+ onPressed: () {
36+ action.onTap ();
37+ Navigator .of (dialogContext).pop ();
38+ },
3639 isDestructiveAction: action.isDestructiveAction,
3740 child: Text (action.text),
3841 ),
@@ -44,16 +47,27 @@ void showNativeDialog(
4447 showDialog <void >(
4548 context: context,
4649 builder:
47- (context ) => AlertDialog (
50+ (dialogContext ) => AlertDialog (
4851 title: Text (title),
4952 content: Text (content),
50- actions: actions.map ((action) => TextButton (onPressed: action.onTap, child: Text (action.text))).toList (),
53+ actions:
54+ actions
55+ .map (
56+ (action) => TextButton (
57+ onPressed: () {
58+ action.onTap ();
59+ Navigator .of (dialogContext).pop ();
60+ },
61+ child: Text (action.text),
62+ ),
63+ )
64+ .toList (),
5165 ),
5266 );
5367 }
5468}
5569
56- /// A dialog action which is used to show the actions of a native dialog.
70+ /// A dialog action which is used to show the actions of a native dialog. Tapping a action will also close the dialog.
5771class DialogAction {
5872 /// Creates a [DialogAction] .
5973 const DialogAction ({required this .text, required this .onTap, this .isDestructiveAction = false });
Original file line number Diff line number Diff line change 11name : dcc_toolkit
22description : " Internal toolkit package used by the DCC team."
3- version : 0.0.12
3+ version : 0.0.13
44homepage : https://dutchcodingcompany.com
55repository : https://github.com/DutchCodingCompany/dcc_toolkit
66
You can’t perform that action at this time.
0 commit comments