showPlaybackPagePreviewDialog function

void showPlaybackPagePreviewDialog(
  1. BuildContext context, {
  2. required DocumentPageIndexModel page,
  3. required bool offlineMode,
})

Implementation

void showPlaybackPagePreviewDialog(
  BuildContext context, {
  required DocumentPageIndexModel page,
  required bool offlineMode,
}) {
  showDialog(
    context: context,
    barrierColor: Colors.black.withValues(alpha: 0.9),
    builder:
        (context) => Dialog(
          backgroundColor: Colors.transparent,
          insetPadding: EdgeInsets.zero,
          child: Stack(
            fit: StackFit.expand,
            children: [
              GestureDetector(
                onTap: () => Navigator.of(context).pop(),
                behavior: HitTestBehavior.opaque,
                child: Container(color: Colors.transparent),
              ),
              Center(
                child: GestureDetector(
                  onTap: () => Navigator.of(context).pop(),
                  child: InteractiveViewer(
                    minScale: 0.5,
                    maxScale: 4.0,
                    child:
                        offlineMode
                            ? Image.file(File(page.url), fit: BoxFit.contain)
                            : Image.network(
                              page.url,
                              fit: BoxFit.contain,
                              errorBuilder:
                                  (_, __, ___) => Icon(
                                    Icons.broken_image_outlined,
                                    size: 64,
                                    color: Colors.white.withValues(alpha: 0.6),
                                  ),
                            ),
                  ),
                ),
              ),
            ],
          ),
        ),
  );
}