showHistoryMenu method
- BuildContext context,
- Offset position, [
- String? format,
- String? locale,
Shows the history menu at the specified position.
Implementation
void showHistoryMenu(BuildContext context, Offset position, [String? format, String? locale]) async {
// show a context menu with the history.
final RenderBox overlay = Overlay.of(context).context.findRenderObject() as RenderBox;
await showMenu(
context: context,
position: RelativeRect.fromRect(
position & const Size(40, 40), // smaller rect, the touch area
Offset.zero & overlay.size // Bigger rect, the entire screen
),
items: [
for (var i in history)
PopupMenuItem(
enabled: history.indexOf(i) > 0,
value: i,
onTap: () {
back(history.indexOf(i));
},
child: ListTile(
leading: const Icon(Icons.history),
title: Text(routeTitle(i.$1, i.$2)),
subtitle: Text(i.$3.format(format, locale)),
),
),
],
elevation: 8.0,
);
}