Migrated from flutter/flutter#81749
This issue was originally filed against the official flutter_markdown package.
The package has since been discontinued and ownership transferred to flutter_markdown_plus.
Internal: b/291644799
else if (tag == 'li') {
if (_listIndents.isNotEmpty) {
if (element.children.length == 0) {
element.children.add(md.Text(''));
}
Widget bullet;
dynamic el = element.children[0];
if (el is md.Element && el.attributes['type'] == 'checkbox') {
bool val = el.attributes['checked'] != 'false';
bullet = _buildCheckbox(val);
} else {
bullet = _buildBullet(_listIndents.last);
}
// See flutter/flutter_markdown#147 and flutter/flutter_markdown#169
child = Row(
textBaseline: TextBaseline.alphabetic,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(
width: styleSheet.listIndent,
child: bullet
),
Expanded(child: child)
],
);
}
}
This creates a SizedBox with the listIndent for the width of the box, however if the font causes one of the numbers to be slightly larger than the allotted size, the period overflows to the next line.
If the numbered list ends up causing double digits, this can also cause an issue.
Finally, if the font is scaled on the system, this will end up looking very bad too.
Using a FittedBox around the bullet widget would fix this so that at least the numbers and periods stay on one line and always fit in the given size, though it could look weird to have a much smaller number compared to the rest, when that happens. But I think it would still be better than the current behavior.
This is without the FittedBox

This is with the FittedBox

Internal: b/291644799
This creates a SizedBox with the
listIndentfor the width of the box, however if the font causes one of the numbers to be slightly larger than the allotted size, the period overflows to the next line.If the numbered list ends up causing double digits, this can also cause an issue.
Finally, if the font is scaled on the system, this will end up looking very bad too.
Using a FittedBox around the
bulletwidget would fix this so that at least the numbers and periods stay on one line and always fit in the given size, though it could look weird to have a much smaller number compared to the rest, when that happens. But I think it would still be better than the current behavior.This is without the FittedBox

This is with the FittedBox
