I am prototyping an Epub reader in Flutter. Each chapter is displayed in a WebView and these WebViews are placed inside a PageView. The contents of each WebView is paginated thanks to a multi-column layout: 1 column = 1 visible page.
During a horizontal swipe gesture, the expected behavior is to have the WebView's contents scrolling while possible, and then have the PageView scrolling between pages as soon as the WebView has reached its limit. Note: during 1 swipe gesture, both can happen: WebView scrolling first, then the PageView.
On Android, it's easily handled thanks to overscroll notifications, as in This code.
But in Flutter, the WebViews are not scrollable and we cannot use the OverscrollNotifications (AFAIK). So I have a few working solutions based on injecting JS code inside the WebView to broadcast the scroll position to the Flutter side, but this is very dirty and frustrating, I hate this kind of code...
Does anyone have a good solution? Thanks a lot in advance!
EDIT: I have a new idea based on Javascript. Instead of continuously sending scroll notifications to the Flutter side during scrolling, I will insert transparent pixels at the beginning and end of each "chapter", and send events to Flutter only when these elements become visible/invisible (thanks to the IntersectionObserver API). But such a solution requires injecting stuff into the chapter's HTML, which is not the best solution. Any better idea is still welcome!
Related
I'm fairly new to Flutter and am trying to accomplish something similar to what is being used in the Pigeon app for iOS. Basically I want an interactive page as a background in the app (like the map in the Pigeon app), and then have different screens appear over that background. These screens should be scrollable, but start at the bottom of the device screen, thus showing both the screen and the dynamic background at the same time. As long as the background is visible in you can interact both with it and the scrollable screen.
I have added a gif below which hopefully helps explaining the issues.
Any guidance on which widgets to look into would be appreciated. I've been experimenting with the Stack widget but can't yet figure out how to accomplish my desired behaviour.
For doing this kind of stuff you have to use sliver widget, which is provide by flutter material package
for more info you can check
Flutter Sliver
I have a page with infinite scroll at the bottom and it is working well but the issue is that the app is meant for browsers also. On browsers, the first paginated result taking almost 50% of the page, and hence the infinite scroll is not working unless I resize down the browser and make it scroll down.
How can I fix this issue?
There are images with some text in a div that contains native scroll bar. I want to make those images dragable keep allowing native scrolling to be functional on that div. Sliding fast on images shouldn't fire drag events, like what iOS home screen does. I'm looking to do this in iPad and iPhone with iOS6.1 for now.
Any suggestion and jQuery plugin will be helpful!
I was wondering if there was a way to freeze a certain section of a webview so that when you scroll through the webview that part of the webview still shows instead of hiding. For example, When having facebook in a webview how could it be possible to keep the blue bar with the notifications, messages, and friend request to always stay on the top when scrolling down the webview just like it is done in the facebook app?
If you want a element inside the webview stays pinned on the screen without affected by the scrolling, you may try to apply position:fixed CSS style on that DOM element.
Please note that position:fixed is not supported before iOS5.
And the native scroll bouncing effect of the UIWebView also affects the fixed position DOM element so you may determine if you also need to disable that bouncing effect.
I have a web app that wraps the main site content in an Iframe to enable some elements that are persistent across the site (only way to do what I'm after as far as I can tell).
It works fine on most browsers, but there is a scrolling problem on the Iphone: The content displays, but trying to scroll does a drag and drop operation instead.
Is there any way to tell the Iphone browser to use normal scrolling in that specific Iframe?
Example site: http://carlocapocasa.com
Thanks a ton and a half,
Carlo
Use two fingers to scroll up and down.
I also had problems getting an iframe to scroll on iOS devices. My iframe was inside a DIV, which had it's overflow set to hidden.
My solution was to set the overflow of the containing DIV to visible.