showPeek function

Future<void> showPeek(
  1. BuildContext context, {
  2. Peek? peek,
  3. PeekStrings strings = const PeekStrings(),
  4. PeekShareDelegate? share,
  5. PeekBodyLoader? bodyLoader,
  6. bool fullscreenDialog = true,
  7. bool rootNavigator = true,
})

Opens Peek over context and completes when it is closed.

await showPeek(context);

Shows peek, or Peek.instance when omitted. rootNavigator keeps the screen above a nested navigator, such as a tab bar.

Works from MaterialApp.builder too, where the app's navigator is below context rather than above it.

Implementation

Future<void> showPeek(
  BuildContext context, {
  Peek? peek,
  PeekStrings strings = const PeekStrings(),
  PeekShareDelegate? share,
  PeekBodyLoader? bodyLoader,
  bool fullscreenDialog = true,
  bool rootNavigator = true,
}) => _navigatorFor(context, rootNavigator).push(
  PeekRoute(
    peek: peek,
    strings: strings,
    share: share,
    bodyLoader: bodyLoader,
    fullscreenDialog: fullscreenDialog,
  ),
);