showImagePreview<T> function
Future<T?>
showImagePreview<T>({
- required BuildContext context,
- required List<
Widget> images, - int? startPosition,
- bool showIndex = true,
- bool? showIndicators = false,
- Duration? swipeDuration,
- bool closeable = false,
- IconData? closeIcon,
- String closeIconPosition = 'top-right',
- dynamic onChange(
- int val
- dynamic onClose(
- int index
Implementation
Future<T?> showImagePreview<T>(
{required BuildContext context,
required List<Widget> images,
int? startPosition,
bool showIndex: true,
bool? showIndicators: false,
Duration? swipeDuration,
bool closeable: false,
IconData? closeIcon,
String closeIconPosition: 'top-right',
Function(int val)? onChange,
Function(int index)? onClose}) {
return showDialog(
context: context,
barrierDismissible: !closeable,
barrierColor: Colors.black87,
builder: (BuildContext context) {
return WillPopScope(
onWillPop: () => Future.value(!closeable),
child: ImagePreview(
images: images,
showIndex: showIndex,
startPosition: startPosition,
showIndicators: showIndicators,
swipeDuration: swipeDuration,
closeable: closeable,
closeIcon: closeIcon,
closeIconPosition: closeIconPosition,
onChange: onChange,
onClose: onClose,
));
});
}