I'm trying to render a full HTML document in a scrollable view but I always got this error
════════ Exception caught by rendering library ═════════════════════════════════
RenderBox was not laid out: _RenderSingleChildViewport#1741c relayoutBoundary=up7 NEEDS-PAINT
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1940 pos 12: 'hasSize'
The relevant error-causing widget was
SingleChildScrollView
My code looks like this
Scaffold(
appBar: AppBar(),
body: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
(...),
Padding(
padding: EdgeInsets.all(16),
child: Html.fromDom(
document: dom.Document.html(data['generated']),
shrinkWrap: true,
)
)
],
),
)
)
The error appears only when I use Html.fromDom
, it works perfectly with Html
for rendering simple elements.
I've also tried with a ListView, constainted the widget, use Expanded or Flexible but nothing works and it's always the same error.
What's the right way for do this ?
Thanks you
Strangely I just run your code on this example and worked like a charm, meaning that made the it's not the widgets and yes the data['generated'] or maybe somenthing inside the widgets that you occult, this is the example that I used: