showImageViewer function
Future<Dialog?>
showImageViewer(
- BuildContext context,
- ImageProvider<
Object> imageProvider, { - bool immersive = true,
- void onViewerDismissed()?,
- bool useSafeArea = false,
- bool swipeDismissible = false,
- bool doubleTapZoomable = false,
- Color backgroundColor = _defaultBackgroundColor,
- String closeButtonTooltip = _defaultCloseButtonTooltip,
- 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);
}