processNavigation method
This method processes the navigation from a particular screen to another via the navigation drawer. Essentially performs 2 checks, 1: If already on the screen that was selected, then ignore. 2: If on a screen other than home, then push a named replacement, otherwise just push the new screen. This ensures that we always display the home screen if back is pressed on any other screen.
Implementation
void processNavigation(BuildContext context, String route, String navigationPressed) {
if (navigationPressed == _screenName) {
return;
} if(_screenName != 'Home'){
if(_screenName == 'Education Articles'){
Navigator.pop(context);
}
Navigator.pushReplacementNamed(context, route);
return;
} else {
Navigator.pop(context);
Navigator.pushNamed(context, route);
return;
}
}