Replace WillPopScope to PopScope

(cherry picked from commit 0c610bd08916fc91273994e1a961247432b58e75)
This commit is contained in:
dab246
2023-12-05 01:44:31 +07:00
committed by Dat H. Pham
parent 3b1df9e3b6
commit 49830df0e7
3 changed files with 18 additions and 10 deletions
@@ -34,11 +34,9 @@ class MobileContainerView extends StatelessWidget {
@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async {
onCloseViewAction.call();
return false;
},
return PopScope(
onPopInvoked: (didPop) => !didPop ? onCloseViewAction : null,
canPop: false,
child: GestureDetector(
onTap: onClearFocusAction,
child: Scaffold(
@@ -31,11 +31,9 @@ class TabletContainerView extends StatelessWidget {
@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async {
onCloseViewAction.call();
return false;
},
return PopScope(
onPopInvoked: (didPop) => !didPop ? onCloseViewAction : null,
canPop: false,
child: GestureDetector(
onTap: onClearFocusAction,
child: Scaffold(
@@ -1199,6 +1199,18 @@ class ThreadController extends BaseController with EmailActionController {
return DismissDirection.startToEnd;
}
bool get inboxMailboxSelected => mailboxDashBoardController.selectedMailbox.value?.isInbox == true;
bool get systemBackGesturesEnable => inboxMailboxSelected && !mailboxDashBoardController.isDrawerOpen;
void backButtonPressedCallbackAction(BuildContext context) {
if (mailboxDashBoardController.isDrawerOpen) {
mailboxDashBoardController.closeMailboxMenuDrawer();
} else {
mailboxDashBoardController.openDefaultMailbox();
}
}
void scrollToTop() {
if (listEmailController.hasClients) {
listEmailController.animateTo(0, duration: const Duration(milliseconds: 500), curve: Curves.fastOutSlowIn);