I have a single TopAppBar that all the backButton does currently is navController.popBackStack(). I have a screen in my app where I need to check if there are dirty changes, and if there are instead of going back I show a dialog prompting for confirmation about losing the data that's entered. I have a backHandler in my Screen where this Dialog lives, and when I use the system back button it works fine, but obviously using the single TopAppBar which lives in my main app composable is just calling navController.popBackStack() so it's not caring about the backHandler. Is there a way to instead of having the button popBackStack() to have it just replicate the behavior of the system back button, or would it be best to just have a function passed all the way through NavHost/Nested navigation graphs all the way to where I'm needing the different back behavior, or is this enough of a reason to look into using an AppBar per screen instead of a Global one. I know some people use global app bars and some use app bars per screen, and it seems like they both have their tradeoffs.
Video showing me using system back button first, showing the dialog, and then pressing the cancel button in the global TopAppBar which does not care about the backHandler since it just does "navController.popBackStack()"