nisrulz / flutter-examples

[Examples] Simple basic isolated apps, for budding flutter devs.
https://nisrulz.com/flutter-examples/
Apache License 2.0
6.91k stars 1.66k forks source link

view_pdf_file example added #57

Closed tsvillain closed 3 years ago

tsvillain commented 3 years ago
nisrulz commented 3 years ago

Thank you for your contribution. I will validate this first and then comment if it works :)

tsvillain commented 3 years ago

Thank you for your contribution. I will validate this first and then comment if it works :)

Okay No Issues

nisrulz commented 3 years ago

@tsvillain I took a look at your PR and noted few changes that would make this example app's PR complete:

  1. Adding an entry in the readme with a link like other apps.

  2. I noticed this PR sets up the app to use a URL to download the pdf and the display it.

    • First you should use pdf url from something that will exist forever. I see the url you use can be removed in future. A good way to do is to create a simple "Hello Flutter" pdf file on your own and add it to the repo. Then use the github api to download that file. That way it is always available via the repo itself.
    • It is good practice to store the URL as a separate variable at the top of the file/function, somewhere it is easy to find when scanning code.
  3. An ability to load local pdf file from a assets directory within the app. That way you are covering both usecases i.e local file loading while also covering remote file loading via a URL. Within the app, that would mean that you now have 2 buttons at the beginning "Load PDF via URL" and "Load local PDF". When user clicks one, all buttons are hidden and progress shows up and then you load the file.

  4. When the progress is showing, then the raised button shouldn't be visible. Right now it is showing up.

tsvillain commented 3 years ago

Okay will make the required changes.

tsvillain commented 3 years ago

@nisrulz the package you have recommended to use does not allow to load pdf from the asset. Can I use another package that can load from the asset as well as the URL? Can I use this: https://pub.dev/packages/advance_pdf_viewer

nisrulz commented 3 years ago

Yes, definitely. When I created the related issue, back then maybe this other package was not present.

But the idea was to cover both usecases. Switch the lib to support both usecase.

Thank you for bringing it up. :)

tsvillain commented 3 years ago

Yes, definitely. When I created the related issue, back then maybe this other package was not present.

But the idea was to cover both usecases. Switch the lib to support both usecase.

Thank you for bringing it up. :)

Thanks for the confirmation will update this PR in few hours.

tsvillain commented 3 years ago

@nisrulz in load from URL, I am loading the pdf that is in the assets folder using the full URL.

nisrulz commented 3 years ago

I will add the code for you to start using the github based asset url. Give me some time. The PR looks good otherwise.

nisrulz commented 3 years ago

Good work @tsvillain 🌮 This looks good now. Thank you for your contribution 😸

Make sure to check other issues if your want contribute more 😄