Flutter Advanced: PDF Viewer Tutorial Android & IOS | From URL & Asset | From URL & Asset

Overview
Comments
  • [ImgBot] Optimize images

    [ImgBot] Optimize images

    opened by imgbot[bot] 0
  • App clash after build the apk

    App clash after build the apk

    I am using flutter_pdfview which is version ^1.0.0+10 to open a PDF file in flutter apps. When my app is in debug mode, there is no error. After I build the app the PDF file cannot open in apps. My app will clash and close the app suddenly. I have open the permission in AndroidManifest.xml:

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    

    Here is my code:

    @override
      Widget build(BuildContext context) {
        return MaterialApp(
            body: Center(
              child: Builder(
                builder: (context) => Column(children: <Widget>[
                        RaisedButton(child: Text("Open PDF "),onPressed: () {
                         Navigator.push(context,MaterialPageRoute(builder: (context) =>
                           PdfViewPage(path: '/storage/emulated/0/Download/$pdfName')));
                            }
                          },
                        )
                      ],
                    ),
              ),
            ),
          ),
        );
      }
    }
    
    class PdfViewPage extends StatefulWidget {
      final String path;
    
      const PdfViewPage({Key key, this.path}) : super(key: key);
      @override
      _PdfViewPageState createState() => _PdfViewPageState();
    }
    
    class _PdfViewPageState extends State<PdfViewPage> {
      int _totalPages = 0;
      int _currentPage = 0;
      bool pdfReady = false;
      PDFViewController _pdfViewController;
    
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar(
          ),
          body: Stack(
            children: <Widget>[
              PDFView(
                filePath: widget.path,
                autoSpacing: true,
                enableSwipe: true,
                pageSnap: true,
                swipeHorizontal: true,
                nightMode: false,
                onError: (e) {
                  print(e);
                },
                onRender: (_pages) {
                  setState(() {
                    _totalPages = _pages;
                    pdfReady = true;
                  });
                },
                onViewCreated: (PDFViewController vc) {
                  _pdfViewController = vc;
                },
                onPageChanged: (int page, int total) {
                  setState(() {});
                },
                onPageError: (page, e) {},
              ),
              !pdfReady
                  ? Center(
                      child: CircularProgressIndicator(),
                    )
                  : Offstage()
            ],
          ),
        );
      }
    }
    

    How can solve this error? Thanks in advanced

    opened by Silerqin 1
  • Hi Fantastic Tutorial.

    Hi Fantastic Tutorial.

    Could you make it so that both buttons open a url? Eg: How do I duplicate the 'getFromUrl' on the Same screen Please? I have two different PDF Docs I want to fetch from the Same Database! ie: One for each Button.

    opened by rayct 0
  • Type Mistake

    Type Mistake

    You did a great job. It's very informative and the latest content. During deep study of this useful document, I highlighted one typo mistake that should be correct.

    https://github.com/iampawan/FlutterPDFViewer/blob/2931bb8e31b1809e0bbb2d22565b29d5b1a5a518/lib/main.dart#L89

    It should be urlPDFPath instead of assetPDFPath

    opened by sarmadmahmood969 0
  • NotUrLPath

    NotUrLPath

    In given example: PDF not read by URL. it read from assets path RaisedButton( color: Colors.amber, child: Text("Open from URL"), onPressed: () { if (urlPDFPath != null) { Navigator.push( context, MaterialPageRoute( builder: (context) => PdfViewPage(path: assetPDFPath))); } }, ),

    opened by hims9391 1
Owner
Pawan Kumar
GoogleDevExpert for Flutter, Firebase, Dart & Web Tech. Public Speaker, Blogger, Entrepreneur & YouTuber. Founder of MTechViral & Let's Flutter with Dart.
Pawan Kumar
Flutter Advanced: Background Fetch | Run code in the background Android & iOS | Run code in the background Android & iOS

flutterbackground A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you starte

Pawan Kumar 40 Dec 16, 2022
Flutter Advanced: ARCore Tutorial | Sceneform | Exploring New Possibilities || Exploring New Possibilities

flutter_ar A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if th

Pawan Kumar 58 Oct 13, 2022
Flutter: Integrate Google Maps Tutorial Flutter: Integrate Google Maps Tutorial

Flutter Google Maps APP Show some ❤️ and star the repo to support the project A new Flutter project. Getting Started Flutter Project Add this to your

Pawan Kumar 69 Oct 27, 2022
Create an Invoice PDF Document completely with Flutter and learn how to generate and view this invoice in Flutter.

Create an Invoice PDF Document completely with Flutter and learn how to generate and view this invoice in Flutter.

Johannes Milke 124 Jan 4, 2023
a simple Quran app made with flutter without any images or pdf

forqan A simple Quran app made with flutter without any images or pdf . screenshot Support If you like what we do, and would want to help us continue

null 15 Oct 22, 2022
Flutter Simple Invoice PDF generate

invoice_pdf_generate A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you sta

Md. Sabik Alam Rahat 25 Jan 2, 2023
Flutter based Open Source Hentai Viewer App

Flutter based Open Source Hentai Viewer App

Project Violet 283 Jan 2, 2023
Tutorial for integrating flutter to your new or existing android app.

AddFlutter2Existing Android App Tutorial for adding flutter to your new or existing android app. Link to tutorial Android Create a Flutter module Let'

Pawan Kumar 21 Jun 27, 2022
A Flutter application to demonstrate how to implement Google maps and its advanced options in a flutter app.

google_maps_flutter_example A new Flutter application to demonstrate how to implement flutter google maps in a flutter application and perfoem advance

Hesham Erfan 11.7k Jan 8, 2023
Fingerprint Local Auth App Flutter Advanced Face ID & Touch ID/Fingerprint Local Auth App

flutterlocalauth A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started

Pawan Kumar 71 Dec 17, 2022
Flutter Advanced: Auto Create Models from JSON | Serializable | Serializable

flutterautomodel A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started

Pawan Kumar 20 Jan 28, 2022
2 Flutter PWA Tutorial - 1/2

got_nagpur A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if th

Pawan Kumar 27 Aug 27, 2022
Tutorial about routes, push and pushNamed

flutterroutes A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if

Pawan Kumar 22 Mar 12, 2022
Collection of all the widgets with their tutorial

Flutter Widgets A collection of flutter widgets with tutorials. Season 1 Episode 1 - Sized Box Episode 2 - Animated Builder Episode 3 - Draggable and

Pawan Kumar 147 Oct 4, 2022
In this tutorial, we'll create a Quiz application using AQUEDUCT FRAMEWORK.

Quiz API Dart An application built with aqueduct. Topics Covered How to Setup Aqueduct ? How to write your first REST API ? How to make controllers ?

Pawan Kumar 19 Mar 2, 2022
The objective of this tutorial is to learn about asynchronous programming in Dart.

The objective of this tutorial is to learn about asynchronous programming in Dart. We'll look at how to carry out time consuming tasks such as getting device location and networking to get data from the internet.

Hritik Kumar 1 Oct 5, 2021
In this tutorial we will be reviewing Stateful and Stateless Widgets as well as learning about the fundamental building blocks of Object Oriented Programming (OOP

In this tutorial we will be reviewing Stateful and Stateless Widgets as well as learning about the fundamental building blocks of Object Oriented Programming (OOP) - Classes and Objects.

pedrozopayares 0 Oct 3, 2021
TutorialCoachMark - Create a beautiful and easy tutorial for your application.

TutorialCoachMark Create a beautiful and easy tutorial for your application. Example 1 Example 2 Usage To use this plugin, add tutorial_coach_mark as

Rafael Almeida Barbosa 423 Dec 25, 2022