showImageViewerPager function
- BuildContext context,
- EasyImageProvider imageProvider, {
- bool immersive = true,
- void onPageChanged()?,
- void onViewerDismissed()?,
- bool useSafeArea = false,
- bool swipeDismissible = false,
- bool doubleTapZoomable = false,
- bool infinitelyScrollable = false,
- Color backgroundColor = _defaultBackgroundColor,
- String closeButtonTooltip = _defaultCloseButtonTooltip,
- Color closeButtonColor = _defaultCloseButtonColor,
Shows the images provided by the imageProvider
in a full-screen PageView Dialog.
Setting immersive
to false will prevent the top and bottom bars from being hidden.
The optional onPageChanged
callback function is called with the index of
the image when the user has swiped to another image.
The optional onViewerDismissed
callback function is called with the index of
the image that is displayed 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 optional infinitelyScrollable
boolean defaults to false and allows infinite scrolling.
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?> showImageViewerPager(
BuildContext context, EasyImageProvider imageProvider,
{bool immersive = true,
void Function(int)? onPageChanged,
void Function(int)? onViewerDismissed,
bool useSafeArea = false,
bool swipeDismissible = false,
bool doubleTapZoomable = false,
bool infinitelyScrollable = false,
Color backgroundColor = _defaultBackgroundColor,
String closeButtonTooltip = _defaultCloseButtonTooltip,
Color closeButtonColor = _defaultCloseButtonColor}) {
if (immersive) {
// Hide top and bottom bars
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive);
}
return showDialog<Dialog>(
context: context,
useSafeArea: useSafeArea,
builder: (context) {
return EasyImageViewerDismissibleDialog(imageProvider,
immersive: immersive,
onPageChanged: onPageChanged,
onViewerDismissed: onViewerDismissed,
useSafeArea: useSafeArea,
swipeDismissible: swipeDismissible,
doubleTapZoomable: doubleTapZoomable,
infinitelyScrollable: infinitelyScrollable,
backgroundColor: backgroundColor,
closeButtonColor: closeButtonColor,
closeButtonTooltip: closeButtonTooltip);
});
}