flutter_html_bootstrap 0.3.0
flutter_html_bootstrap: ^0.3.0 copied to clipboard
A flutter_html extension that adds support for Bootstrap CSS utility classes.
0.3.0 #
- The CSS support model (the 51 properties
flutter_html3.0.0 renders, the companion extension registry, the display-value and font-size-unit exceptions, andisRenderableDeclaration) now comes fromflutter_html_css_core, the package shared withflutter_html_vuetify, instead of a local copy. Every name this package exported before (kFlutterHtmlSupportedProperties,kFlutterHtmlSupportedDisplayValues,kFlutterHtmlUnrenderableFontSizeUnits,cssFontSizeUnit,CssCompanionExtension,kKnownCssCompanions,kCompanionPropertyIndex,kCompanionDisplayValueIndex,detectRegisteredCompanions,propertiesProvidedBy,displayValuesProvidedBy,fontSizeUnitsProvidedBy,isRenderableDeclaration) still resolves to the same value; no application code needs to change. flutter_html_css_core's companion registry recognises a tenth companion,CssTextMetricsHtmlExtension(flutter_html_css_text_metrics), forletter-spacing,word-spacingandtext-decoration-thickness. This is currently a registry-only widening for this package: no Bootstrap 5.3 utility class resolves to any of the three properties, so no class's rendering changes. The companion is recognised and reported the same way as the other nine should a future handler, or hand-writtenstyle=""merged alongside the resolved CSS, ever produce one of them.- The inline-declaration splitter this package uses internally
(
parseInlineCssDeclarations,suppressUnrenderableCss) is now built onflutter_html_css_core'ssplitDeclarations, which only cuts a;that sits outside quotes and parentheses and strips a trailing!important, instead of a plainsplit(';'). This package's own resolved CSS never hit either case, so nothing observable changes for a normal use of this package; it matters only for CSS merged in by hand alongside it. - Removed the
invalid_dependency: ignoreoverride inanalysis_options.yaml. It existed forflutter_html_class_to_csswhile that package was a git dependency;pubspec.yamlhas constrained it as a normal hosted dependency (^0.2.0) for a while, so the override was stale and nothing else needed it.
0.2.0 #
- Renamed from
flutter_html_bootstrap_css_utilities_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.1.3 #
- Two more companion extensions are recognised, so the classes they cover stop
being suppressed and stop being reported once the companion is registered on
the same
Htmlwidget:flutter_html_css_object_fit(CssObjectFitHtmlExtension) for the 30object-fit-*classes, andflutter_html_css_transform(CssTransformHtmlExtension) fortranslate-middle,translate-middle-xandtranslate-middle-y. Nine companions in total. - Both are data additions to
kKnownCssCompanions, with no new dependency: detection is by class name, as before. Each property set is copied verbatim from the companion's own public constant —kCssObjectFitPropertiesandkCssTransformProperties— soobject-positionandtransform-originare listed although no Bootstrap 5.3 utility emits either. transformcovers onlytranslate-middle*.position-absolute translate-middleis still named in the report, for itsposition: nothing in this family renders positioned layout, so the rest of the positioning family is unchanged.isSupportedClassandunsupportedClassesare unchanged. Both answer for bareflutter_html, and 653 classes still render nothing without a companion.
0.1.2 #
- New diagnostic for a different failure than the class one: an element whose
Bootstrap classes this package resolved, sitting on a tag
flutter_html3.0.0 cannot render, is now named once per parsed document. Same channel asUnsupportedBootstrapClassesException: handed toFlutterError.reportError, never thrown. Gate it withreportUnrenderableTags: false. - Why it matters:
flutter_htmlrenders an element only if something claims it at thepreparingstep. Nothing claims<v-card>,<table>,<video>,<iframe>or<svg>, soprepareFromExtensionhands back anEmptyContentElementand the element and its whole subtree render nothing, silently. Inliningp-3onto it was always pointless and there was no way to find that out. reportUnrenderableTagsis deliberately not folded intoreportUnsupportedClasses. The class report fires on ordinary Bootstrap markup, so people turn it off; the tag report fires only when something disappeared. One flag would let the loud one silence the quiet one.- The report goes quiet once you register the
TagExtensionit asked for. It re-runsprepareFromExtension's own check against the registered extensions instead of trusting a static list. - This needs
flutter_html_class_to_css0.1.1, wherekFlutterHtmlRenderableTagsand the reporter live so the two utility packages do not each carry a copy of the 70-tag set. Release order is converter 0.1.1, then this, thenflutter_html_vuetify0.1.1.UnrenderableTagsExceptionandkFlutterHtmlRenderableTagsare re-exported here so you do not need a direct dependency on the converter to read a report. - Docs pass to the family style. The category and companion tables moved to
doc/unsupported-classes.md, linked by absolute URL so it works from pub.flutter-io.cn. New.pubignoreis a verbatim copy of.gitignoreplusdoc/, because.pubignorereplaces.gitignorerather than extending it. - Four more companion extensions are recognised, so the CSS they render is no
longer suppressed when they are registered:
flutter_html_css_effectsforopacity,box-shadowandvisibility, soopacity-*,link-opacity-*,shadow*andvisible/invisiblecome back.flutter_html_css_size_constraintsformax-width,min-width,max-heightandmin-height, somw-100,mh-100,min-vw-100andmin-vh-100come back.flutter_html_css_interactionforcursor,pointer-eventsanduser-select, sope-none,pe-autoanduser-select-*come back.flutter_html_css_text_overflowfortext-overflow,white-spaceand-webkit-line-clamp, sotext-wrap,text-nowrapand part oftext-truncatecome back.
- A companion only takes effect when it is added from pub.flutter-io.cn and
registered on the same
Htmlwidget asBootstrapUtilitiesHtmlExtension. Nothing here depends on those packages, and nothing changes for an app that does not register them: the same declarations are suppressed and reported as in 0.1.1. - Detection is by class name.
kKnownCssCompanionsmatches a registered extension'sruntimeType.toString()against the names above, so renaming one of those classes upstream silently stops the match. That coupling is documented on both sides. text-truncateis the one class no single companion covers. It resolves tooverflow: hidden,text-overflow: ellipsisandwhite-space: nowrap, and the text-overflow companion renders only the last two.overflowstays suppressed, so the class is still named in the report for that one declaration.- The README says why
CssBorderRadiusHtmlExtensionhas to be listed after this extension, and why itswrapIfHasAnyClasshas to stay at the defaulttrue. Listed first it cannot read the element'sborderandmargin, and aborder rounded-3element gets a square border around a rounded clip. CssFlexHtmlExtensionfromflutter_html_css_flexis recognised too, and it is the one companion that needed more than a table entry.displayis suppressed by value, not by property:flutter_htmlparsesdisplayand reads every keyword outside its five asDisplay.inline, so widening the property set could never reachdisplay: flex. A companion entry now carries adisplayValuesset beside itspropertiesset, andisRenderableDeclarationandsuppressUnrenderableCsstake anextraSupportedDisplayValuesalongsideextraSupportedProperties. So doesBootstrapUtilitiesResolver, if you drive it yourself.- What that buys: with the flex extension registered,
d-flex,d-inline-flex,d-grid,d-inline-grid, everyflex-*,justify-content-*,align-items-*,align-content-*,align-self-*,order-*,gap-*,row-gap-*andcolumn-gap-*class renders instead of being suppressed and reported.d-table,d-table-rowandd-table-celldo not, because nothing renders those values, so they are still suppressed and still named. - Nothing changes without the extension registered.
display: flexis suppressed exactly as in 0.1.1, and for the same reason. - The report got more precise in the same pass. It matches
displayon the suppressed value rather than on the property, so a document that only usedd-tableis not sent after the flex package, andirrecoverableDisplayValuesis the new "nothing can render this" subset ofunsupportedDisplayValues.gapand the rest of the flex family moved out ofirrecoverablePropertiesand into the companion suggestion. - The dartdoc on
CssCompanionExtensionused to say a flex extension would be a one-entry data change. It was wrong for exactly the extension it named, which is how this was found; it now says whatdisplaycosts instead. - Behaviour change:
fs-1tofs-6are now suppressed and reported instead of emitted, andisSupportedClass('fs-3')answers false. They emit afont-sizeinrem,ExpressionMapping.expressionToFontSizehas itsrembranch commented out, and the declaration was dropped at parse time with no error and no warning. The supported/unsupported model was property-level and unit-blind, so it called those six supported while they rendered no size at all. It reads the value forfont-sizenow, the same way it already read it fordisplay. - The "78 properties this package can compute" figure was a hand count and measures 79; an invariant now pins it next to the 51 and the class count.
unsupportedClassestherefore moved from 647 to 653. The six new entries are exactlyfs-1tofs-6; nothing else in the corpus changed verdict. The invariants pin is updated, and so is the count indoc/unsupported-classes.md.CssFontSizeHtmlExtensionfromflutter_html_css_font_sizeis recognised, and registering it un-suppresses the declaration again: theremreachesstyle=""for that extension to resolve at thepreProcessingstep, and the classes stop being reported. The two orders are equivalent, because that extension reads the inline style after this one has written it.- The mechanism is the
displayone, done a second time rather than generalised. A companion entry carries afontSizeUnitsset beside itsdisplayValuesset, andisRenderableDeclaration,suppressUnrenderableCssandBootstrapUtilitiesResolvertake anextraSupportedFontSizeUnitsalongside the other two. Listingfont-sizein a companion'spropertiesalone still changes nothing, by design:font-sizeis already inkFlutterHtmlSupportedProperties, so the property set was never what suppressed it. There is a test for that trap. kFlutterHtmlUnrenderableFontSizeUnitsis stated as what does not render, the opposite way round fromkFlutterHtmlSupportedDisplayValues, and the asymmetry is measured rather than stylistic. An unknowndisplaykeyword becomesDisplay.inline, so only an allowlist is safe there. An unknown length unit reachesexpressionToFontSize'sLengthTermbranch, which reads the number and ignores the unit, sofont-size: 12ptrenders at 12. The three tokens that render nothing arerem,smallerandlarger, andcssFontSizeUnitis what turns a value into one of them.- The report names the package from the property, not from the value, which is
where
font-sizeanddisplaydiffer. One companion renders all three unrenderable tokens, sofont-sizestays inkCompanionPropertyIndexand out ofirrecoverableProperties. An invariant pins that equality: a fourth token with no companion has to move the report to a value index, asdisplayalready has one.
0.1.1 #
pe-autonow resolves topointer-events: auto.SpacingGapHandlerruns first and its regex describes only the shape of a spacing class, so it parsedpe-autoas padding-inline-end with sizeauto.autoand the negative spacers are margin-only in Bootstrap, so the handler consumed the class and wrote nothing, andInteractionsHandlernever saw it. The handler now declines margin-only tokens onp*classes, which also meanspt-autoandpt-n3are no longer matched at all; they are not Bootstrap classes.text-truncateis implemented:overflow: hidden,text-overflow: ellipsis,white-space: nowrap. It previously fell throughTextHandler's text-colour branch, which ends inreturn truefor any unrecognisedtext-*token, and was swallowed.- Neither changes what reaches the screen today:
pointer-events,overflow,text-overflowandwhite-spaceare all outside the 51 propertiesflutter_htmlparses, so both classes stay inunsupportedClassesand are still named in the per-document report. What changes is that they are named at all instead of disappearing silently, and that a future companion extension can render them. CONTRIBUTING.mdsaid the converter was a git dependency. It has been a published pub.flutter-io.cn dependency since 0.1.0 shipped.- The dev-only dependency on
flutter_html_css_border_radiusis a hosted^0.1.0instead of a git ref. It was a git source before that package's first release; the release has shipped, and this drops a clone from every CI run.
0.1.0 #
- Initial release: a
flutter_htmlextension that inlines Bootstrap 5.3 utility classes (spacing, colors, borders, display, sizing, typography, and more) as CSS understood byflutter_html. - Declarations
flutter_htmlcannot render are suppressed rather than merged intostyle="". Most were inert, butdisplaywas actively harmful:flutter_html's value parser falls back toDisplay.inlinefor anything outsideblock/inline/inline-block/list-item/none, sod-flexturned block<div>s inline.displayis emitted only for values it understands. - Unsupported classes are reported once per parsed document via
FlutterError.reportError. They are never thrown, so they reach the debug console and crash reporters hooked toFlutterError.onError(Sentry, for example) without interrupting rendering. Gated byreportUnsupportedClasses, defaulttrue. - A registered companion extension widens the renderable property set. Today
CssBorderRadiusHtmlExtensionre-enables therounded-*family. Detection is duck-typed by class name, so no dependency on any companion package. - Public API for introspecting coverage:
isSupportedClass(),unsupportedClasses,UnsupportedBootstrapClassesException,CssCompanionExtension/kKnownCssCompanions, and, onBootstrapUtilitiesResolver,suppressUnrenderableDeclarations,extraSupportedPropertiesandresolveRaw().