From 21096144a337d5a1dd08526c9ec05994e608142b Mon Sep 17 00:00:00 2001 From: tension Date: Wed, 28 Aug 2024 10:10:07 +0800 Subject: [PATCH 1/2] fix: Black screenn when press back button --- lib/features/common/nested_app_bar.dart | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/features/common/nested_app_bar.dart b/lib/features/common/nested_app_bar.dart index 6848d181..194ba541 100644 --- a/lib/features/common/nested_app_bar.dart +++ b/lib/features/common/nested_app_bar.dart @@ -40,13 +40,7 @@ class NestedAppBar extends StatelessWidget { RootScaffold.stateKey.currentState?.openDrawer(); }, ) - : IconButton( - icon: Icon(context.isRtl ? Icons.arrow_forward : Icons.arrow_back), - padding: EdgeInsets.only(right: context.isRtl ? 50 : 0), - onPressed: () { - Navigator.of(context).pop(); // Pops the current route off the navigator stack - }, - ), + : null, title: title, actions: actions, pinned: pinned, From 5aa55b50a4187810d258c29f84b65510758fcad6 Mon Sep 17 00:00:00 2001 From: tension Date: Sat, 31 Aug 2024 11:57:39 +0800 Subject: [PATCH 2/2] revert: Keep button, add judgment --- lib/features/common/nested_app_bar.dart | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/features/common/nested_app_bar.dart b/lib/features/common/nested_app_bar.dart index 194ba541..6bf377f5 100644 --- a/lib/features/common/nested_app_bar.dart +++ b/lib/features/common/nested_app_bar.dart @@ -40,7 +40,15 @@ class NestedAppBar extends StatelessWidget { RootScaffold.stateKey.currentState?.openDrawer(); }, ) - : null, + : IconButton( + icon: Icon(context.isRtl ? Icons.arrow_forward : Icons.arrow_back), + padding: EdgeInsets.only(right: context.isRtl ? 50 : 0), + onPressed: () { + if (Navigator.of(context).canPop()){ + Navigator.of(context).pop(); // Pops the current route off the navigator stack + } + }, + ), title: title, actions: actions, pinned: pinned,