flutter_html_css_flex 0.3.0
flutter_html_css_flex: ^0.3.0 copied to clipboard
A flutter_html extension that lays out CSS flexbox containers, single-axis grid containers and gap.
0.3.0 #
- Renamed from
flutter_html_css_flex_extensionon pub.flutter-io.cn. The old package stays published and is marked discontinued with this one as its replacement. Class names are unchanged.
0.2.0 #
- Repairs the rest of the
displaykeywordsflutter_html3.0.0 gets wrong.expressionToDisplay(css_parser.dart:905-921) knows five keywords and returnsDisplay.inlinefor everything else, anddeclarationsToStyle(:302) assigns it without a check. Sotable,table-cell,inline-table,contents,flow-root,rubyand eleven more demoted a block element to inline, which is worse than dropping the declaration. Measured before the fix, on a<div>carrying each value, with the textxxin front of it, in an 800 pxHtml: every one of the nineteen keywords rendered the page 17 px tall, with the div's text joined toxxand noCssBoxWidgetof its own, against 34 px and an 800x17 box fordisplay: block. table,table-row,table-row-group,table-header-group,table-footer-group,table-caption,flow,flow-rootandrun-innow render block-level: 34 px, an 800x17 box, same asdisplay: block.table-cellandinline-tablebecome a shrink-to-fit box in the line, 42x17 where the text is 42 px wide, so two cells sit side by side. No table layout: no column widths, no shared row height, no borders between cells.table-columnandtable-column-groupnow render nothing. A column box does not render its content (CSS 2.1 17.5.1), and that is the one mapping here that removes content rather than restoring a box. Nothing warns about it.contentsand the fiverubykeywords keep their ownDisplay. They are inline-level, soDisplay.inlinewas already the right level and the pixels do not move: same height, same box count, measured both ways. OnlyStyle.displaystops lying, for whatever else reads it.- Reads the two-value
displaysyntax.flutter_htmlpasses only the first term to its parser, soblock rubywas already block whileinline flow-rootwas inline.inline flow-rootandinline tablenow get the inline-block box they ask for, andblock list-itemandinline list-itemreachDisplay.listItemandDisplay.inlineListIteminstead ofDisplay.inline. Aflexorgridinner keyword sets the box level only; use the one-word form for the layout. - New
kCssDisplayRepairValuesandcssDisplayRepairOf.kCssFlexDisplayValuesis unchanged: it is still exactly the four values this extension lays out, and the two sets do not overlap. A sibling package that suppressesdisplay: tablecan keep suppressing it, because a<div>is block-level anyway without the declaration. - Known cost of mapping
tabletoDisplay.tablerather thanDisplay.block:flutter_htmltrims white space around aDisplay.blockchild only (whitespace.dart:53), so a space either side of the box survives. A space on each side measured as"xx yy"and"AAA ", wheredisplay: blockgives"xxyy"and"AAA".
0.1.0 #
- Initial release. Adds a
flutter_htmlextension that lays outdisplay: flexanddisplay: inline-flexcontainers withflex-direction,flex-wrap,justify-content,align-items,align-content,align-self,flex,flex-grow,flex-basis,order,gap,row-gapandcolumn-gap, all read from an element's inline style. - Repairs
Style.displayfor these containers.flutter_html3.0.0 maps everydisplayvalue it does not know toDisplay.inline, sodisplay: flexturns a block element inline before this extension runs. - Lays out
display: gridanddisplay: inline-gridas well, withgrid-template-columnslimited to<length>,<flex>andautotracks andrepeat(). A template outside that set is treated as absent and the grid becomes a single column. flex-shrinkparses and is then ignored. Flutter's flex layout never shrinks an item.