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