I'm trying to load a fairly large Html content but Flutter throws the following error. I do not have any control over the content as it comes from another source.
RenderSemanticsGestureHandler object was given an infinite size during layout.
The relevant error-causing widget was
HtmlWidget
lib\view\ArticleView.dart:334
The following RenderObject was being processed when the exception was fired: RenderSemanticsGestureHandler#77fc9 relayoutBoundary=up25 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
RenderObject: RenderSemanticsGestureHandler#77fc9 relayoutBoundary=up25 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
parentData: <none> (can use size)
constraints: BoxConstraints(0.0<=w<=281.4, 0.0<=h<=Infinity)
size: Size(281.4, Infinity)
gestures: tap
child: RenderPointerListener#19f40 relayoutBoundary=up26 NEEDS-PAINT
parentData: <none> (can use size)
constraints: BoxConstraints(0.0<=w<=281.4, 0.0<=h<=Infinity)
size: Size(281.4, Infinity)
behavior: opaque
listeners: down
Is there a way for me to detect when there's an issue while rendering content with HtmlWidget so that I can display a user friendly error in those cases?
Html (from this link "description"): https://habaru.mv/api/news/article?id=TWloYWFydSRodHRwczovL21paGFhcnUuY29tL25ld3MvNzYzOTY1
I have isolated the bug caused by your HTML and fixed it, this will be included in the next release. By the way, if you want to render Instagram embed, you have to wrap it in a WebView.
Regarding the fallback behavior, it is not possible to catch layout error using built-in Flutter widget. However, this package looks promising. You should be able to wrap HtmlWidget inside a Boundary to capture the error.
Will wait for the next release. Boundary sure looks promising. Will try it out. Thanks.
Version 0.4.2 has just been released with the fix for this. Please try upgrading and see whether it works for you. Thank you for the patience.