Request to replace loading indicator in SfPdfViewer

As Request to customize loader in SfPdfViewer | Flutter Forums | Syncfusion does not fits my need, I would like to request an option to completely customize the loader. Currently the loader is just a progressbar on top of the page which looks quite odd if i load the PDF on fullscreen. I would like to show a custom widged at the center of the screen that informs the user that the PDF is being loaded.

Current situation

What I currently do is that I load the PDF in a FutureBuilder from a network URL then use that UInt8List as parameter to SfPdfViewer.memory.

The downside is now that even SfPdfViewer.memory takes some time and therefore I will see the top ProgressBar while loading from memory.

Not 100% working workaround

I tried to use a isLoaded field that, if false, shows a custom loading indicator and after calling onDocumentLoaded this field is set to true. The downside is then that SfPdfViewer.network will call the PDF url twice, since SfPdfViewer.network will be created twice.

Do you have a solution for this issue?


3 Replies

IP ImmanKumarP Palanikumar Syncfusion Team February 28, 2024 05:59 AM UTC

Hi Michael Mairegger,

At present, syncfusion_flutter_pdfviewer does not have the support to show a custom loading indicator or hide the loading indicator when the PDF document is loading.

What I currently do is that I load the PDF in a FutureBuilder from a network URL then use that UInt8List as parameter to SfPdfViewer.memory.

The downside is now that even SfPdfViewer.memory takes some time and therefore I will see the top ProgressBar while loading from memory.

Can you check the sample that we have attached, where we use a stack to show a custom progress indicator over the SfPdfViewer widget and hide the same once the document is loaded? Kindly let us know if your query is resolved.
Kindly note that the progress bar that the SfPdfViewer shows is not an indicator of the downloading process.
I tried to use a isLoaded field that, if false, shows a custom loading indicator and after calling onDocumentLoaded this field is set to true. The downside is then that SfPdfViewer.network will call the PDF url twice, since SfPdfViewer.network will be created twice.
On calling the setState in the onDocumentLoaded callback, the SfPdfViewer.network will make the network request to check whether the currently loaded document is changed or not. This is the behavior our SfPdfViewer widget.


Regards,

Imman Kumar P



MM Michael Mairegger March 21, 2024 04:30 PM UTC

I will check the sample the and come back with the testing results the next days.

Thanks for the response



IP ImmanKumarP Palanikumar Syncfusion Team March 22, 2024 04:08 AM UTC

Hi Michael Mairegger,

Please find the sample from the attachments and let us know if the sample meets your requirements.

Regards,
Imman Kumar P


Attachment: F186949_335a2995.zip

Loader.
Up arrow icon