Skip to content

Issue with Persistent Bottom Nav Bar and Back Navigation on Android 13 #1

@Junaidlc

Description

@Junaidlc

Hi,

I'm experiencing an issue with the persistent_bottom_nav_bar_plus package when running my Flutter app on Android 13. The same code works perfectly on Android 9, but on Android 13, the back navigation behavior is inconsistent.

Here are the details:

Issue: The ConditionalWillPopScope logic to handle back navigation with a confirmation GetSnackBar works fine on Android 9. However, on Android 13, it seems to either not trigger the snackbar or ignore the back navigation logic altogether.
Expected Behavior: When the user presses the back button, if they are not on the home tab, the app should navigate to the home tab. If they are on the home tab, it should show a confirmation GetSnackBar asking if they want to exit the app.
Observed Behavior on Android 13: The GetSnackBar either does not appear or the back navigation bypasses the ConditionalWillPopScope logic.
Android 13 Changes: I've considered possible permission or UI handling changes in Android 13 but couldn't pinpoint the cause of this issue.

Code Snippet:
ConditionalWillPopScope(
onWillPop: () async {
if (navController.tabController.value.index != 0) {
navController.changeTabIndex(0); // Navigate to Home tab
return false; // Prevent the app from exiting
} else {
// Show confirmation snackbar
bool shouldExit = await _showExitConfirmationSnackbar(context);
return shouldExit;
}
},
shouldAddCallback: true,
child: PersistentTabView(
context,
controller: navController.tabController.value,
screens: navController.buildScreens(),
items: navController.navBarsItems(),
confineInSafeArea: true,
backgroundColor: Colors.white,
resizeToAvoidBottomInset: true,
stateManagement: true,
hideNavigationBarWhenKeyboardShows: true,
decoration: NavBarDecoration(
borderRadius: BorderRadius.circular(10.0),
colorBehindNavBar: Colors.white,
),
navBarStyle: NavBarStyle.style9,
),
);

Steps Taken:

Verified that all dependencies are up to date.
Added debug logs to confirm the flow of execution.
Tested with a simpler snackbar implementation, but the issue persists.
Could you please look into this? It seems like the package might not be fully compatible with the changes introduced in Android 13.

Thank you for your help!

Best regards,
Junaid

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions