mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-26 08:36:50 +08:00
Fix Folders navigation
Clicking on Folders in AppBar when inside a Folder wouldn't take you back to the Folder Listing.
This commit is contained in:
@ -84,19 +84,38 @@ class AppDrawer extends StatelessWidget {
|
||||
title: "Folders",
|
||||
onTap: () {
|
||||
var m = ModalRoute.of(context);
|
||||
// FIXME: This is a terrible hack, I should figure out how to make
|
||||
// transitions work with named routes
|
||||
if (m.settings.name == null) {
|
||||
Navigator.pop(context);
|
||||
} else {
|
||||
if (m.settings.name == '/') {
|
||||
Navigator.pop(context);
|
||||
Navigator.push(
|
||||
context,
|
||||
PageTransition(
|
||||
type: PageTransitionType.fade,
|
||||
child: FolderListingScreen(),
|
||||
settings: const RouteSettings(name: '/folders'),
|
||||
),
|
||||
);
|
||||
} else if (m.settings.name == '/folders') {
|
||||
Navigator.pop(context);
|
||||
} else {
|
||||
// Check if '/folders' is a parent
|
||||
var wasParent = false;
|
||||
Navigator.popUntil(
|
||||
context,
|
||||
(route) {
|
||||
wasParent = route.settings.name == '/folders';
|
||||
return wasParent;
|
||||
},
|
||||
);
|
||||
if (!wasParent) {
|
||||
Navigator.push(
|
||||
context,
|
||||
PageTransition(
|
||||
type: PageTransitionType.fade,
|
||||
child: FolderListingScreen(),
|
||||
settings: const RouteSettings(name: '/folders'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
selected: currentRoute == null,
|
||||
|
Reference in New Issue
Block a user