This repository was archived by the owner on Feb 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 98
This repository was archived by the owner on Feb 25, 2022. It is now read-only.
Breadcrumbs and Cupertino Back Context Menu #260
Copy link
Copy link
Closed
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation
Description
It would be great if we could make publicly accessible the current list of routes in the stack so it is possible to create Breadcrumbs and Cupertino Back Context Menu. The design of those components don't need to be part of this library, but it would be great if it makes it possible
RPReplay_Final1640194363.MP4
Simulator.Screen.Recording.-.iPhone.13.-.2021-12-22.at.18.33.38.mp4
Current approach
class BackButton extends StatelessWidget {
const BackButton({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
assert(debugCheckHasMaterialLocalizations(context));
return GestureDetector(
onLongPress: () async {
final router = GoRouter.of(context);
final navigator = Navigator.of(context);
if (router.routerDelegate.matches.isEmpty) return;
final location = await showMenu(
context: context,
position: const RelativeRect.fromLTRB(0, 0, 20, 20),
items: <PopupMenuEntry<String>>[
for (final match
in router.routerDelegate.matches.reversed.skip(1))
PopupMenuItem<String>(
value: match.route.name,
child: Text(match.route.name ?? 'Hey'),
),
]);
if (location != null) {
navigator.popUntil((route) => route.settings.name == location);
}
},
child: IconButton(
icon: const BackButtonIcon(),
onPressed: () {
Navigator.maybePop(context);
},
),
);
}
}Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation