Fix can not show saving dialog anymore when click on back system button
This commit is contained in:
@@ -23,6 +23,7 @@ mixin MessageDialogActionMixin {
|
||||
bool alignCenter = false,
|
||||
bool outsideDismissible = true,
|
||||
bool autoPerformPopBack = true,
|
||||
bool usePopScope = false,
|
||||
List<TextSpan>? listTextSpan,
|
||||
Widget? icon,
|
||||
TextStyle? titleStyle,
|
||||
@@ -32,14 +33,14 @@ mixin MessageDialogActionMixin {
|
||||
Color? actionButtonColor,
|
||||
Color? cancelButtonColor,
|
||||
EdgeInsetsGeometry? marginIcon,
|
||||
PopInvokedCallback? onPopInvoked,
|
||||
}
|
||||
) async {
|
||||
final responsiveUtils = Get.find<ResponsiveUtils>();
|
||||
final imagePaths = Get.find<ImagePaths>();
|
||||
|
||||
if (alignCenter) {
|
||||
return await Get.dialog(
|
||||
PointerInterceptor(
|
||||
final childWidget = PointerInterceptor(
|
||||
child: (ConfirmDialogBuilder(imagePaths, listTextSpan: listTextSpan)
|
||||
..key(const Key('confirm_dialog_action'))
|
||||
..title(title ?? '')
|
||||
@@ -76,15 +77,17 @@ mixin MessageDialogActionMixin {
|
||||
)
|
||||
..onCloseButtonAction(onCloseButtonAction)
|
||||
).build()
|
||||
),
|
||||
);
|
||||
return await Get.dialog(
|
||||
usePopScope && PlatformInfo.isMobile
|
||||
? PopScope(onPopInvoked: onPopInvoked, canPop: false, child: childWidget)
|
||||
: childWidget,
|
||||
barrierColor: AppColor.colorDefaultCupertinoActionSheet,
|
||||
barrierDismissible: outsideDismissible
|
||||
);
|
||||
} else {
|
||||
if (responsiveUtils.isMobile(context)) {
|
||||
if (showAsBottomSheet) {
|
||||
return await Get.bottomSheet(
|
||||
PointerInterceptor(
|
||||
final childWidget = PointerInterceptor(
|
||||
child: (ConfirmDialogBuilder(
|
||||
imagePaths,
|
||||
showAsBottomSheet: true,
|
||||
@@ -125,9 +128,14 @@ mixin MessageDialogActionMixin {
|
||||
onCancelAction?.call();
|
||||
}
|
||||
)
|
||||
..onCloseButtonAction(onCloseButtonAction ?? () => popBack()))
|
||||
.build()
|
||||
),
|
||||
..onCloseButtonAction(onCloseButtonAction ?? () => popBack())
|
||||
).build()
|
||||
);
|
||||
if (showAsBottomSheet) {
|
||||
return await Get.bottomSheet(
|
||||
usePopScope && PlatformInfo.isMobile
|
||||
? PopScope(onPopInvoked: onPopInvoked, canPop: false, child: childWidget)
|
||||
: childWidget,
|
||||
isScrollControlled: true,
|
||||
barrierColor: AppColor.colorDefaultCupertinoActionSheet,
|
||||
backgroundColor: Colors.transparent,
|
||||
@@ -159,8 +167,7 @@ mixin MessageDialogActionMixin {
|
||||
})).show();
|
||||
}
|
||||
} else {
|
||||
return await Get.dialog(
|
||||
PointerInterceptor(
|
||||
final childWidget = PointerInterceptor(
|
||||
child: (ConfirmDialogBuilder(imagePaths, listTextSpan: listTextSpan)
|
||||
..key(const Key('confirm_dialog_action'))
|
||||
..title(title ?? '')
|
||||
@@ -194,9 +201,13 @@ mixin MessageDialogActionMixin {
|
||||
onCancelAction?.call();
|
||||
}
|
||||
)
|
||||
..onCloseButtonAction(onCloseButtonAction ?? () => popBack()))
|
||||
.build()
|
||||
),
|
||||
..onCloseButtonAction(onCloseButtonAction ?? () => popBack())
|
||||
).build()
|
||||
);
|
||||
return await Get.dialog(
|
||||
usePopScope && PlatformInfo.isMobile
|
||||
? PopScope(onPopInvoked: onPopInvoked, canPop: false, child: childWidget)
|
||||
: childWidget,
|
||||
barrierColor: AppColor.colorDefaultCupertinoActionSheet,
|
||||
barrierDismissible: outsideDismissible
|
||||
);
|
||||
|
||||
@@ -1923,6 +1923,7 @@ class ComposerController extends BaseController with DragDropFileMixin {
|
||||
alignCenter: true,
|
||||
outsideDismissible: false,
|
||||
autoPerformPopBack: false,
|
||||
usePopScope: true,
|
||||
onConfirmAction: () => _handleSaveMessageToDraft(context),
|
||||
onCancelAction: () {
|
||||
_closeComposerButtonState = ButtonState.enabled;
|
||||
@@ -1933,6 +1934,14 @@ class ComposerController extends BaseController with DragDropFileMixin {
|
||||
popBack();
|
||||
_autoFocusFieldWhenLauncher();
|
||||
},
|
||||
onPopInvoked: (didPop) {
|
||||
log('ComposerController::_showConfirmDialogSaveMessage: didPop = $didPop');
|
||||
if (!didPop) {
|
||||
_closeComposerButtonState = ButtonState.enabled;
|
||||
popBack();
|
||||
_autoFocusFieldWhenLauncher();
|
||||
}
|
||||
},
|
||||
marginIcon: EdgeInsets.zero,
|
||||
icon: SvgPicture.asset(
|
||||
imagePaths.icQuotasWarning,
|
||||
|
||||
Reference in New Issue
Block a user