showPdfDialog static method

Future<void> showPdfDialog({
  1. required BuildContext context,
  2. String? filePath,
  3. String? url,
  4. String? assetPath,
  5. PDFViewSource source = PDFViewSource.file,
  6. String? title,
  7. bool barrierDismissible = true,
  8. bool enableNavigation = true,
  9. bool enableTextSelection = true,
  10. IconData? fabIcon,
  11. VoidCallback? onFabPressed,
})

Implementation

static Future<void> showPdfDialog({
  required BuildContext context,
  String? filePath,
  String? url,
  String? assetPath,
  PDFViewSource source = PDFViewSource.file,
  String? title,
  bool barrierDismissible = true,
  bool enableNavigation = true,
  bool enableTextSelection = true,
  IconData? fabIcon,
  VoidCallback? onFabPressed,
}) async {
  return showDialog(
    context: context,
    barrierDismissible: barrierDismissible,
    builder: (context) => Dialog(
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(16.r),
      ),
      child: ClipRRect(
        borderRadius: BorderRadius.circular(16.r),
        child: SizedBox(
          width: MediaQuery.of(context).size.width * 0.9,
          height: MediaQuery.of(context).size.height * 0.8,
          child: BoltPDFViewer(
            filePath: filePath,
            url: url,
            assetPath: assetPath,
            source: source,
            title: title,
            enableNavigation: enableNavigation,
            enableTextSelection: enableTextSelection,
            isModal: true,
            fabIcon: fabIcon,
            onFabPressed: onFabPressed,
          ),
        ),
      ),
    ),
  );
}