Flutter network pdf viewer showing a white screen with no exception

85 Views Asked by At

Hello this is my code for the pdf viewer page

import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart';

class ReaderPDF extends StatefulWidget {
  const ReaderPDF({Key? key, required this.docUrl}) : super(key: key);

  final String docUrl;

  @override
  _ReaderPDFState createState() => _ReaderPDFState();
}

class _ReaderPDFState extends State<ReaderPDF> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      body: SafeArea(
        child: Column(
          children: [
            Expanded(child: SfPdfViewer.network(widget.docUrl)),
          ],
        ),
      ),
    );
  }
}

and this is how im using it in MyContainer

Padding(
                    padding: const EdgeInsets.only(top: 20),
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        MyButton(
                          width: 154,
                          height: 42,
                          text: 'Summary',
                          backgroundColor: Colors.white,
                          textColor: const Color(0xff2E8CFE),
                          borderColor: const Color(0xff2E8CFE),
                          onPressed: () {
                            Navigator.push(
                              context,
                              MaterialPageRoute(
                                builder: (context) => ReaderPDF(
                                  docUrl: docUrl,
                                ),
                              ),
                            );
                          },
                        ),
                        MyButton(
                          width: 154,
                          height: 42,
                          text: 'Notes',
                          backgroundColor: Colors.blue,
                          borderColor: const Color(0xff2E8CFE),
                          textColor: Colors.white,
                          onPressed: onPressedButton2,
                        ),
                      ],
                    ),
                  )
                ],
              ),
            ),

for some reason when i call the Url in another screen
docUrl: 'https://www.africau.edu/images/default/sample.pdf', only a white screen shows not the url also it doesn't show exception what could be the problem?

So far i tried to swap between packages but all of the in the end show the same error

0

There are 0 best solutions below