@@ -6,6 +6,10 @@ import 'package:flutter/material.dart';
6
6
import 'extensions/extensions.dart' ;
7
7
8
8
/// Show alert dialog, whose appearance is adaptive according to platform
9
+ ///
10
+ /// [useActionSheetForCupertino] (default: false) only works for
11
+ /// cupertino style. If it is set to true, [showModalActionSheet] is called
12
+ /// instead.
9
13
Future <T > showAlertDialog <T >({
10
14
@required BuildContext context,
11
15
String title,
@@ -87,6 +91,14 @@ Future<T> showAlertDialog<T>({
87
91
);
88
92
}
89
93
94
+ /// Show OK/Cancel alert dialog, whose appearance is adaptive according to platform
95
+ ///
96
+ /// This is convenient wrapper of [showAlertDialog] .
97
+ /// [barrierDismissible] (default: true) only works for material style,
98
+ /// and if it is set to false, pressing OK or Cancel buttons is only way to
99
+ /// close alert.
100
+ /// [defaultType] only works for cupertino style and if it is specified
101
+ /// OK or Cancel button label will be changed to bold.
90
102
Future <OkCancelResult > showOkCancelAlertDialog ({
91
103
@required BuildContext context,
92
104
String title,
@@ -129,6 +141,11 @@ Future<OkCancelResult> showOkCancelAlertDialog({
129
141
return result ?? OkCancelResult .cancel;
130
142
}
131
143
144
+ /// Show OK alert dialog, whose appearance is adaptive according to platform
145
+ ///
146
+ /// This is convenient wrapper of [showAlertDialog] .
147
+ /// [barrierDismissible] (default: true) only works for material style,
148
+ /// and if it is set to false, pressing OK button is only way to close alert.
132
149
Future <OkCancelResult > showOkAlertDialog ({
133
150
@required BuildContext context,
134
151
String title,
@@ -155,6 +172,7 @@ Future<OkCancelResult> showOkAlertDialog({
155
172
return result ?? OkCancelResult .cancel;
156
173
}
157
174
175
+ /// Used for specifying [showAlertDialog] 's actions.
158
176
@immutable
159
177
class AlertDialogAction <T > {
160
178
const AlertDialogAction ({
@@ -173,13 +191,20 @@ class AlertDialogAction<T> {
173
191
174
192
/// Make font color to destructive/error color(red).
175
193
final bool isDestructiveAction;
194
+
195
+ /// Change textStyle to another from default.
196
+ ///
197
+ /// Recommended to keep null.
176
198
final TextStyle textStyle;
177
199
}
178
200
201
+ // Used to specify [showOkCancelAlertDialog]'s [defaultType]
179
202
enum OkCancelAlertDefaultType {
180
203
ok,
181
204
cancel,
182
205
}
206
+
207
+ // Result type of [showOkAlertDialog] or [showOkCancelAlertDialog].
183
208
enum OkCancelResult {
184
209
ok,
185
210
cancel,
0 commit comments