ricardo-durao-3r
Committed by GitHub

Add custom loading widget to PdfPreview widget (#774)

* add custom loading widget to PdfPreview widget

* bump version to 5.5.0
# Changelog
## 5.5.0
- Add custom loading widget to PdfPreview widget
## 5.4.3
- Update Pdfium libraries
... ...
... ... @@ -59,6 +59,7 @@ class PdfPreview extends StatefulWidget {
this.previewPageMargin,
this.padding,
this.shouldRepaint = false,
this.loadingWidget,
}) : super(key: key);
static const _defaultPageFormats = <String, PdfPageFormat>{
... ... @@ -150,6 +151,10 @@ class PdfPreview extends StatefulWidget {
/// Force repainting the PDF document
final bool shouldRepaint;
/// Custom loading widget to use that is shown while PDF is being generated.
/// If null, a [CircularProgressIndicator] is used instead.
final Widget? loadingWidget;
@override
_PdfPreviewState createState() => _PdfPreviewState();
}
... ... @@ -287,7 +292,10 @@ class _PdfPreviewState extends State<PdfPreview> with PdfPreviewRaster {
}
if (pages.isEmpty) {
return const Center(child: CircularProgressIndicator());
return widget.loadingWidget ??
const Center(
child: CircularProgressIndicator(),
);
}
return ListView.builder(
... ...
... ... @@ -7,7 +7,7 @@ description: >
homepage: https://github.com/DavBfr/dart_pdf/tree/master/printing
repository: https://github.com/DavBfr/dart_pdf
issue_tracker: https://github.com/DavBfr/dart_pdf/issues
version: 5.4.3
version: 5.5.0
environment:
sdk: ">=2.12.0 <3.0.0"
... ...