79082802

Date: 2024-10-13 09:25:03
Score: 0.5
Natty:
Report link

Even when placing a WebView inside the Flutter app, it is possible to face such an issue when taps on buttons or lists stop working. This happens as the WebView works in a platform related layer that occupies entire area of screen, thus blocking touch events from hitting other widgets which may be located over or under the WebView. Thus, when using components such as ListView.builder the application may freeze when they are positioned right or below the WebView.

To address this, the usual approach is to control how the WebView communicates with other widgets. There is also one approach to which a WebView should not occupy the entire size of the screen which in turn makes it impossible to access the other widgets located underneath it. This can be done by setting the size of the WebView to be a small portion of the screen, while making the other widgets again clickable.

Another possibility is to encase the WebView in an ignore pointer widget, which gives a pointer to when it should accept or reject a touch input. By doing this, you should be able to provide special handling for other components & at the same time, allow touch events to bubble down to other targets where required.

Reasons:
  • Long answer (-1):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Naman