autoLeading static method

Widget? autoLeading(
  1. BuildContext context, {
  2. Key? key,
})

The route's own exit: the way back on a pushed page, the close on a sheet, nothing on a root.

Implementation

static Widget? autoLeading(BuildContext context, {Key? key}) {
  final register = RoutePresentation.of(context);
  if (register == RoutePresentation.root) return null;
  return ComicBackButton(
    key: key,
    close: register == RoutePresentation.sheet,
    onPressed: () => Navigator.of(context).maybePop(),
  );
}