showImageViewer function

Future<Dialog?> showImageViewer(
  1. BuildContext context,
  2. ImageProvider<Object> imageProvider, {
  3. bool immersive = true,
  4. void onViewerDismissed()?,
  5. bool useSafeArea = false,
  6. bool swipeDismissible = false,
  7. bool doubleTapZoomable = false,
  8. Color backgroundColor = _defaultBackgroundColor,
  9. String closeButtonTooltip = _defaultCloseButtonTooltip,
  10. Color closeButtonColor = _defaultCloseButtonColor,
})

Shows the given imageProvider in a full-screen Dialog. Setting immersive to false will prevent the top and bottom bars from being hidden. The optional onViewerDismissed callback function is called when the dialog is closed. The optional useSafeArea boolean defaults to false and is passed to showDialog. The optional swipeDismissible boolean defaults to false and allows swipe-down-to-dismiss. The optional doubleTapZoomable boolean defaults to false and allows double tap to zoom. The backgroundColor defaults to black, but can be set to any other color. The closeButtonTooltip text is displayed when the user long-presses on the close button and is used for accessibility. The closeButtonColor defaults to white, but can be set to any other color.

Implementation

Future<Dialog?> showImageViewer(
    BuildContext context, ImageProvider imageProvider,
    {bool immersive = true,
    void Function()? onViewerDismissed,
    bool useSafeArea = false,
    bool swipeDismissible = false,
    bool doubleTapZoomable = false,
    Color backgroundColor = _defaultBackgroundColor,
    String closeButtonTooltip = _defaultCloseButtonTooltip,
    Color closeButtonColor = _defaultCloseButtonColor}) {
  return showImageViewerPager(context, SingleImageProvider(imageProvider),
      immersive: immersive,
      onViewerDismissed:
          onViewerDismissed != null ? (_) => onViewerDismissed() : null,
      useSafeArea: useSafeArea,
      swipeDismissible: swipeDismissible,
      doubleTapZoomable: doubleTapZoomable,
      backgroundColor: backgroundColor,
      closeButtonTooltip: closeButtonTooltip,
      closeButtonColor: closeButtonColor);
}