File tree Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change
1
+ import 'package:apidash/consts.dart' ;
2
+ import 'package:apidash_design_system/apidash_design_system.dart' ;
3
+ import 'package:flutter/material.dart' ;
4
+
5
+ showOkCancelDialog (
6
+ BuildContext context, {
7
+ String ? dialogTitle,
8
+ String ? content,
9
+ String ? buttonLabelOk,
10
+ VoidCallback ? onClickOk,
11
+ String ? buttonLabelCancel,
12
+ VoidCallback ? onClickCancel,
13
+ }) {
14
+ showDialog (
15
+ context: context,
16
+ builder: (context) {
17
+ return AlertDialog (
18
+ title: Text (dialogTitle ?? "" ),
19
+ titleTextStyle: Theme .of (context).textTheme.titleLarge,
20
+ content: Container (
21
+ padding: kPt20,
22
+ width: 300 ,
23
+ child: Text (content ?? "" ),
24
+ ),
25
+ actions: < Widget > [
26
+ TextButton (
27
+ onPressed: () {
28
+ onClickCancel? .call ();
29
+ if (context.mounted) {
30
+ Navigator .pop (context);
31
+ }
32
+ },
33
+ child: Text (buttonLabelCancel ?? kLabelCancel),
34
+ ),
35
+ TextButton (
36
+ onPressed: () {
37
+ onClickOk? .call ();
38
+ if (context.mounted) {
39
+ Navigator .pop (context);
40
+ }
41
+ },
42
+ child: Text (buttonLabelOk ?? kLabelOk),
43
+ ),
44
+ ],
45
+ );
46
+ });
47
+ }
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ export 'codegen_previewer.dart';
16
16
export 'dialog_about.dart' ;
17
17
export 'dialog_history_retention.dart' ;
18
18
export 'dialog_import.dart' ;
19
+ export 'dialog_ok_cancel.dart' ;
19
20
export 'dialog_rename.dart' ;
20
21
export 'dialog_text.dart' ;
21
22
export 'drag_and_drop_area.dart' ;
You can’t perform that action at this time.
0 commit comments