Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Inline Pdf Viewing #1

Open
MaskyS opened this issue Jul 29, 2018 · 32 comments
Open

Support Inline Pdf Viewing #1

MaskyS opened this issue Jul 29, 2018 · 32 comments
Labels
enhancement New feature or request

Comments

@MaskyS
Copy link

MaskyS commented Jul 29, 2018

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!

@devxpy
Copy link
Member

devxpy commented Jul 29, 2018

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
Copy link
Member

devxpy commented Jul 30, 2018

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 devxpy changed the title Add AppBar functionality to this amazing plugin? Support Inline Pdf Viewing Jul 30, 2018
@devxpy devxpy added the enhancement New feature or request label Jul 30, 2018
@MaskyS
Copy link
Author

MaskyS commented Jul 31, 2018

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

@allanwolski
Copy link

I look forward to this too :D

@devxpy
Copy link
Member

devxpy commented Aug 25, 2018

Been quite busy with zproc.

This is definitely on my to-do list.

@ghost
Copy link

ghost commented Aug 26, 2018 via email

@ghost
Copy link

ghost commented Aug 26, 2018 via email

@devxpy
Copy link
Member

devxpy commented Aug 26, 2018

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.

@ghost
Copy link

ghost commented Aug 26, 2018

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.

@devxpy
Copy link
Member

devxpy commented Aug 29, 2018

Not fast of course.

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

@ghost
Copy link

ghost commented Sep 6, 2018

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

@allanwolski
Copy link

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

flutter/flutter#19030 (comment)
flutter/plugins#743 (review)

@ghost
Copy link

ghost commented Sep 6, 2018

@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

@allanwolski
Copy link

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

@ghost
Copy link

ghost commented Sep 9, 2018 via email

@allanwolski
Copy link

allanwolski commented Sep 10, 2018

Yes, I want written in dart.

This is the layout I need port to Flutter:

e4b37cb9-c35a-4911-9cbd-0a3089b367c4

@devxpy
Copy link
Member

devxpy commented Oct 9, 2018

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

@allanwolski
Copy link

Any progress on this?

@devxpy
Copy link
Member

devxpy commented Nov 10, 2018

@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?

@allanwolski
Copy link

Great job, @devxpy!

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

@dariotrombello
Copy link

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

@dariotrombello
Copy link

But anyways thank you very much for this 👍

@devxpy
Copy link
Member

devxpy commented Nov 25, 2018

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

@dariotrombello
Copy link

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

@MaskyS
Copy link
Author

MaskyS commented Nov 25, 2018

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

@dariotrombello
Copy link

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!

@devxpy
Copy link
Member

devxpy commented Dec 6, 2018

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

@allanwolski
Copy link

@devxpy

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

@devxpy
Copy link
Member

devxpy commented Dec 15, 2018

@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 pushed a commit that referenced this issue Jan 26, 2019
update kotlin and gradle versions
@MaskyS
Copy link
Author

MaskyS commented Feb 1, 2019

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

@Xaeroxaero
Copy link

Xaeroxaero commented Mar 19, 2019

I found i out that if you add to AndroidManifest.xml
<application> <activity android:name=".PdfActivity" android:configChanges="orientation" /> </application>
and create Activity Listener

class PdfActivity : Activity() {}
and include it in PdfViewerThread
class PdfViewerThread( val instance: FlutterPdfViewerPlugin, val methodCall: MethodCall, val result: MethodChannel.Result, val activity: PdfActivity = PdfActivity() ) : Thread()

the view will rerender after changing orientation. But some stack trace error occurs during that

@marianoarga
Copy link

@Xaeroxaero where is PdfViewerThread?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants