This is an issue when using shrinkWrapped Html widgets inside rows. On 1.0.0-pre.1 the element would have the size of its contents and get rendered properly.
For instance, this:
Row(
children: [
Html(data: 'Hello', shrinkWrap: true),
Text(' world'),
]
)
Throws The following assertion was thrown during performLayout():
BoxConstraints forces an infinite width.
Maybe this should not return double.infinity width for shrinkWrapped elements? It does solve the issue in my use cases, but I'm not sure it won't break other use cases.
class StyledText extends StatelessWidget {
final InlineSpan textSpan;
final Style style;
const StyledText({
this.textSpan,
this.style,
});
@override
Widget build(BuildContext context) {
return SizedBox(
width:
style.display == Display.BLOCK || style.display == Display.LIST_ITEM
? double.infinity
: null,
child: Text.rich(
textSpan,
style: style.generateTextStyle(),
textAlign: style.textAlign,
textDirection: style.direction,
),
);
}
}
This has completely broken shrinkWrap. Any chance we can get this fixed?
@red42 it helped me:
style: {
"html": Style(
display: Display.INLINE,
),
"body": Style(
display: Display.INLINE,
),
"...": Style(
display: Display.INLINE,
),
}
@red42 it helped me:
style: { "html": Style( display: Display.INLINE, ), "body": Style( display: Display.INLINE, ), "...": Style( display: Display.INLINE, ), }
This worked for me .. but the issue should be solved ASAP
Most helpful comment
@red42 it helped me: