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

Is there anyway to solve the "size" problem, I set my height = web height #314

Closed
aboutmydreams opened this issue Mar 29, 2020 · 9 comments

Comments

@aboutmydreams
Copy link

Environment

Android
Flutter 1.15.4 pre.241

Description

W/PlatformViewsController( 9851): Creating a virtual display of size: [984, 17283] may result in problems(flutter/flutter#2897 is larger than the device screen size: [1080, 1920].

@aboutmydreams aboutmydreams changed the title Is there anyway to solve the "size" problem, I set my height == web height Is there anyway to solve the "size" problem, I set my height = web height Mar 29, 2020
@pichillilorenzo
Copy link
Owner

pichillilorenzo commented Jun 29, 2020

As the Flutter error says: "may result in problems".
This error is coming from the Flutter native API and not from my plugin.

It seems to be a Flutter native view limitation (see flutter/flutter#34138).

@robert-virkus
Copy link

Is there a possible workaround for this problem?

I'm using the InAppWebView inside of a more complex, scrollable page - it's an mail details view with meta data at the top and the actual mail contents below.
When I have long HTML pages, my app also crashes with the previous warning W/PlatformViewsController(16080): Creating a virtual display of size: [720, 11188] may result in problems(https://github.com/flutter/flutter/issues/2897).It is larger than the device screen size: [720, 1410].

In know the 'other' webview also struggles with this problem, compare for example flutter/flutter#45243

So this problem will probably not solved soon, so I am looking for alternatives.

  • One alternative is to use only HTML and not mix flutter code with web contents on the same page. This would be very very hard in my case....
  • Another workaround might be to restrict content up to a maximum height that does not crash the app. However, how could I find out this height as this is also device dependent?
  • Lastly, would it be possible to link the ScrollControllers of the InAppWebView and my outer page, e.g. in a NestedScrollView?

Any input is appreciated!

@pichillilorenzo
Copy link
Owner

@robert-virkus have you tried using new version 5.0.0 with the android-specific option useHybridComposition: true?
Maybe it should work.

However, how could I find out this height as this is also device dependent?

I don't think it is something that can be calculated.

Lastly, would it be possible to link the ScrollControllers of the InAppWebView and my outer page, e.g. in a NestedScrollView?

Doesn't exists any flutter ScrollController in it. It exists only on the native side, so you don't have access to it.

@robert-virkus
Copy link

Thanks a lot for the feedback, Lorenzo!

And yes, I can confirm that using hybrid composition works - thank you very very much!! Due to dependency hell I cannot switch to the preview release in my mail app project, but I do hope that the Flutter team will release nullsafety into production next week.

Trying out the preview release I noticed that the initialUrl is gone and replaced with the various other initial fields. Call me outfashioned, but I think intialUrl: 'https://domain.com/web' is much easier than initialUrlRequest: URLRequest(url: Uri.parse('https://domain.com/web')). As a matter of subjective taste, I also prefer camel case when it comes to class names, so in this specific case I prefer UrlRequest over URLRequest. But this is, of course, subjective.

Thank you very very much again for your InAppWebView project - it is very useful to have and offers so much more functionality than the webview project from the Flutter team. Keep up the good work!

@pichillilorenzo
Copy link
Owner

pichillilorenzo commented Feb 27, 2021

URLRequest style comes from the iOS URLRequest native class.

Yes, intialUrl: 'https://domain.com/web' is simpler, but initialUrlRequest offers better support as you need to use Uri and not String (using String sometimes can cause problems to you because of spaces or special chars).
Also with URLRequest you can make initial POST requests and use other properties on iOS, such as iosCachePolicy, iosHttpShouldHandleCookies, etc.

If it stayed that way (with intialUrl), in this case, this would result in a lot of properties for the initial load request to the same level of initialUrl property.

Also, using the class URLRequest, I can re-use it in other parts of my code, such as loadUrl method.

Thanks 😄 👍

@robert-virkus
Copy link

Thank you for the additional feedback about the class name and the API changes!

@FatmaMM
Copy link

FatmaMM commented Apr 22, 2021

hi @pichillilorenzo, I tried all solutions there update flutter version and InAppWebView version to the last one but the issue still exist.
When I add InAppWebView widget with other widgets into any scrollview I can't select any text to highlight it .

@pichillilorenzo
Copy link
Owner

@FatmaMM that's another issue. See #722.

Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants