flutter_pdf_viewer icon indicating copy to clipboard operation
flutter_pdf_viewer copied to clipboard

Support Inline Pdf Viewing

Open MaskyS opened this issue 6 years ago • 32 comments

Thank you a lot for this plugin. It's amazing, the one thing it lacks is to add an AppBar in the pdfViewer activity. Any idea how it could be done? Maybe like the flutter webview plugin does?

Thanks again!

MaskyS avatar Jul 29 '18 11:07 MaskyS

I can get you a Android native appBar, but that's pretty useless since its just a top bar with the name of the app.

In Android, we have the back button so going back to the app is not an issue?

To get any sort of flutter component onto that PDF screen requires some sort of compositing engine that combines both flutter and Android views into one.

I'll look more into how webview plugin does it, with it's rect analogy, whether that applies to Android PDF viewer...

devxpy avatar Jul 29 '18 13:07 devxpy

Update-

The webview plugin uses a FrameLayout, which works fine. But IMO, provides a mediocre experience. It feels like a weird mix of android and flutter views to me...

I personally, would like to try out flutter Texture. I believe that it should look and feel like a non-GMO flutter widget.

For instance, it's used by fluttie.

The library can render the animations by piping the output from the Lottie Android library into a Flutter texture.

devxpy avatar Jul 30 '18 05:07 devxpy

Great, thanks for the prompt reply. I look forward to this :D

MaskyS avatar Jul 31 '18 15:07 MaskyS

I look forward to this too :D

allanwolski avatar Aug 25 '18 19:08 allanwolski

Been quite busy with zproc.

This is definitely on my to-do list.

devxpy avatar Aug 25 '18 22:08 devxpy

Zproc looks cool. Using IPC. You should also consider NATS. I get 800 k transactions a second on my old MacBook. Has drivers in python and very easy to use. It's a well known compeditoor to zmq. I use it with flutter as well as for servers

On Sun, 26 Aug 2018, 00:41 Dev Aggarwal, [email protected] wrote:

Been busy with zproc https://github.com/pycampers/zproc.

This is definitely on my to-do list.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pycampers/flutter_pdf_viewer/issues/1#issuecomment-416001131, or mute the thread https://github.com/notifications/unsubscribe-auth/ATuCwsJT6JKcxw5UzcdgcdJVJS7bRIejks5uUdK2gaJpZM4VlYpL .

ghost avatar Aug 26 '18 07:08 ghost

Great research here. Flutter Textures is an interesting approach. But it will mean you will loose any clipboard ability maybe ? No sure. But yes I was using the Textures approach to render 3d models and spin them. Not fast of course.

On Mon, 30 Jul 2018, 07:27 Dev Aggarwal, [email protected] wrote:

Update-

The webview plugin uses a FrameLayout https://developer.android.com/reference/android/widget/FrameLayout, which works fine. But IMO, provides a mediocre experience. It feels like a weird mix of android and flutter views to me...

I personally, would like to try out flutter Textures https://docs.flutter.io/flutter/widgets/Texture-class.html. Since they are flutter widgets, I hope that they look and feel like a non-GMO flutter app ;)

For instance, it's used by fluttie https://pub.dartlang.org/packages/fluttie.

The library can render the animations by piping the output from the Lottie Android library into a Flutter texture.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pycampers/flutter_pdf_viewer/issues/1#issuecomment-408750745, or mute the thread https://github.com/notifications/unsubscribe-auth/ATuCwsBdL7R0nuhs6PY_PgYnvIViEof8ks5uLpkqgaJpZM4VlYpL .

ghost avatar Aug 26 '18 07:08 ghost

Thanks, will check it out.

zproc is also compatible with TCP btw.

I'm trying to get a stable feature-set first. (Working on a PUSH-PULL model right now)

But if NATS really is faster than ZMQ, I wouldn't mind putting it as an alternative backend.

devxpy avatar Aug 26 '18 07:08 devxpy

Checkout liftbridge. It's NATS exposed over grpc. Replaces Kafka. I can then use this high transaction MQ to talk to flutter over grpc. Grpc Dart with grpc golang - easy.

Also because it's like Kafka you get distributed logs. You also get multi data centre multi master for free.

When you add another node it joins and load balancers. Nothing else needed.

Liftbridge is just one of the many systems you can build on top of NATS.

ghost avatar Aug 26 '18 11:08 ghost

Not fast of course.

What exactly was the bottleneck, the 3d rendering library or the Textures API?

devxpy avatar Aug 29 '18 05:08 devxpy

Pumping the textures to the flutter texture object is not fast. The fluttie team use it and when you try it it's not that fast. But I would still go with it to just get going.

I saw another flutter project also using the Texture Flutter object. It was a 3d model viewer. Slow but worked. They were designed to use opengl I think. Can't find the link now.

Anyway I think getting a MVP going is first Step

ghost avatar Sep 06 '18 10:09 ghost

Would it be possible to use the new AndroidView created for Inline Google Maps?

https://github.com/flutter/flutter/issues/19030#issuecomment-416393456 https://github.com/flutter/plugins/pull/743#pullrequestreview-150361671

allanwolski avatar Sep 06 '18 13:09 allanwolski

@allanwolski thats looks very interesting !

I think it worth trying and then comparing what it gives with the Flutter Texture approach.

One thing i noticed between the two approaches is he z buffer. With Android Views it seems to be top always. With Flutter Texture you have control of the z buffer. I have not tried it but only read it.

SO when you open the drawer you might get bad UX experience with android view. But gotta try it, and its very new

ghost avatar Sep 06 '18 14:09 ghost

I also think it's worth a try.

This may help: https://medium.com/flutter-community/flutter-platformview-how-to-create-flutter-widgets-from-native-views-366e378115b6 https://docs.flutter.io/flutter/widgets/AndroidView-class.html

allanwolski avatar Sep 08 '18 16:09 allanwolski

So this is basically rastisinh it to an image ?

There are tons of libs that do that but I presume you want it written in dart ?

On Sat, 8 Sep 2018, 18:36 allanwolski, [email protected] wrote:

I also think it's worth a try.

This may help:

https://medium.com/flutter-community/flutter-platformview-how-to-create-flutter-widgets-from-native-views-366e378115b6 https://docs.flutter.io/flutter/widgets/AndroidView-class.html

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/pycampers/flutter_pdf_viewer/issues/1#issuecomment-419656095, or mute the thread https://github.com/notifications/unsubscribe-auth/ATuCwmZYRfrB435lytGqq0SUs5AqGnqcks5uY_ITgaJpZM4VlYpL .

ghost avatar Sep 09 '18 15:09 ghost

Yes, I want written in dart.

This is the layout I need port to Flutter:

e4b37cb9-c35a-4911-9cbd-0a3089b367c4

allanwolski avatar Sep 10 '18 23:09 allanwolski

Quick Status update - will look into this issue after iOS support is enabled.

devxpy avatar Oct 09 '18 19:10 devxpy

Any progress on this?

allanwolski avatar Nov 03 '18 02:11 allanwolski

@allanwolski

I have a MVP working at the inline branch.

(example)

Screenshot

However, it seems that there are still some rough edges; Here are some I encountered.

  • Hot reload breaks the view
  • Changing orientation breaks the view

Once these are ironed out, I will merge into master.

Current implementation uses flutter's new AndroidView, which is considered a beta feature as of now. It is possible that bugs are inherited from upstream.

I might not be closing the PDFView on the Java side properly. Anyone with more experience here?

devxpy avatar Nov 10 '18 17:11 devxpy

Great job, @devxpy!

I tested here and found only the problems reported by you. The performance is very good!

allanwolski avatar Nov 13 '18 01:11 allanwolski

I experience crashes with multiple tabs and the plugin of the inline branch. Maybe i can send logs later.

dariotrombello avatar Nov 25 '18 10:11 dariotrombello

But anyways thank you very much for this :+1:

dariotrombello avatar Nov 25 '18 10:11 dariotrombello

@Borduni multiple tabs, can you please provide more context?

devxpy avatar Nov 25 '18 10:11 devxpy

I have a layout with a bottom navigation bar (3 pages). The app crashes when switching between them after implementing this plugin. If I revert it everything is fine again

dariotrombello avatar Nov 25 '18 10:11 dariotrombello

@Borduni I think it would really help if you could provide some error logs :smile_cat:

MaskyS avatar Nov 25 '18 11:11 MaskyS

Okay I think the error was because of my phone. I have installed a custom rom. Tried it on the same phone without any modifications and it worked, thanks!

dariotrombello avatar Dec 05 '18 15:12 dariotrombello

That's weird. This could be an issue upstream with flutter. Let me try upgrading to flutter 1.0

devxpy avatar Dec 06 '18 07:12 devxpy

@devxpy

Do you have any idea when this will merge into master? Also wanted to know if you have plans for iOS?

allanwolski avatar Dec 14 '18 22:12 allanwolski

@allanwolski I cannot say for sure when this will merge into master. I still have these issues, with really no idea why they're happening. The flutter Platform views are still a preview feature.

I really want to do ios, but cannot seem to get my hands on a compiler :/

devxpy avatar Dec 15 '18 00:12 devxpy

@devxpy, any updates on this? Do the bugs still occur?

MaskyS avatar Feb 01 '19 06:02 MaskyS