Showing
1 changed file
with
17 additions
and
2 deletions
@@ -314,6 +314,9 @@ extension ExtensionDialog on GetInterface { | @@ -314,6 +314,9 @@ extension ExtensionDialog on GetInterface { | ||
314 | double radius = 20.0, | 314 | double radius = 20.0, |
315 | // ThemeData themeData, | 315 | // ThemeData themeData, |
316 | List<Widget> actions, | 316 | List<Widget> actions, |
317 | + | ||
318 | + // onWillPop Scope | ||
319 | + WillPopCallback onWillPop, | ||
317 | }) { | 320 | }) { |
318 | var leanCancel = onCancel != null || textCancel != null; | 321 | var leanCancel = onCancel != null || textCancel != null; |
319 | var leanConfirm = onConfirm != null || textConfirm != null; | 322 | var leanConfirm = onConfirm != null || textConfirm != null; |
@@ -362,8 +365,7 @@ extension ExtensionDialog on GetInterface { | @@ -362,8 +365,7 @@ extension ExtensionDialog on GetInterface { | ||
362 | } | 365 | } |
363 | } | 366 | } |
364 | 367 | ||
365 | - return dialog<T>( | ||
366 | - AlertDialog( | 368 | + Widget baseAlertDialog = AlertDialog( |
367 | titlePadding: EdgeInsets.all(8), | 369 | titlePadding: EdgeInsets.all(8), |
368 | contentPadding: EdgeInsets.all(8), | 370 | contentPadding: EdgeInsets.all(8), |
369 | backgroundColor: backgroundColor ?? theme.dialogBackgroundColor, | 371 | backgroundColor: backgroundColor ?? theme.dialogBackgroundColor, |
@@ -392,10 +394,23 @@ extension ExtensionDialog on GetInterface { | @@ -392,10 +394,23 @@ extension ExtensionDialog on GetInterface { | ||
392 | ), | 394 | ), |
393 | // actions: actions, // ?? <Widget>[cancelButton, confirmButton], | 395 | // actions: actions, // ?? <Widget>[cancelButton, confirmButton], |
394 | buttonPadding: EdgeInsets.zero, | 396 | buttonPadding: EdgeInsets.zero, |
397 | + ); | ||
398 | + | ||
399 | + if (onWillPop != null) { | ||
400 | + return dialog<T>( | ||
401 | + WillPopScope( | ||
402 | + onWillPop: onWillPop, | ||
403 | + child: baseAlertDialog, | ||
395 | ), | 404 | ), |
396 | barrierDismissible: barrierDismissible, | 405 | barrierDismissible: barrierDismissible, |
397 | ); | 406 | ); |
398 | } | 407 | } |
408 | + | ||
409 | + return dialog<T>( | ||
410 | + baseAlertDialog, | ||
411 | + barrierDismissible: barrierDismissible, | ||
412 | + ); | ||
413 | + } | ||
399 | } | 414 | } |
400 | 415 | ||
401 | extension ExtensionBottomSheet on GetInterface { | 416 | extension ExtensionBottomSheet on GetInterface { |
-
Please register or login to post a comment