flutter_html_bootstrap 0.3.0 copy "flutter_html_bootstrap: ^0.3.0" to clipboard
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_html 3.0.0 renders, the companion extension registry, the display-value and font-size-unit exceptions, and isRenderableDeclaration) now comes from flutter_html_css_core, the package shared with flutter_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), for letter-spacing, word-spacing and text-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-written style="" merged alongside the resolved CSS, ever produce one of them.
  • The inline-declaration splitter this package uses internally (parseInlineCssDeclarations, suppressUnrenderableCss) is now built on flutter_html_css_core's splitDeclarations, which only cuts a ; that sits outside quotes and parentheses and strips a trailing !important, instead of a plain split(';'). 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: ignore override in analysis_options.yaml. It existed for flutter_html_class_to_css while that package was a git dependency; pubspec.yaml has 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_extension on 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 Html widget: flutter_html_css_object_fit (CssObjectFitHtmlExtension) for the 30 object-fit-* classes, and flutter_html_css_transform (CssTransformHtmlExtension) for translate-middle, translate-middle-x and translate-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 — kCssObjectFitProperties and kCssTransformProperties — so object-position and transform-origin are listed although no Bootstrap 5.3 utility emits either.
  • transform covers only translate-middle*. position-absolute translate-middle is still named in the report, for its position: nothing in this family renders positioned layout, so the rest of the positioning family is unchanged.
  • isSupportedClass and unsupportedClasses are unchanged. Both answer for bare flutter_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_html 3.0.0 cannot render, is now named once per parsed document. Same channel as UnsupportedBootstrapClassesException: handed to FlutterError.reportError, never thrown. Gate it with reportUnrenderableTags: false.
  • Why it matters: flutter_html renders an element only if something claims it at the preparing step. Nothing claims <v-card>, <table>, <video>, <iframe> or <svg>, so prepareFromExtension hands back an EmptyContentElement and the element and its whole subtree render nothing, silently. Inlining p-3 onto it was always pointless and there was no way to find that out.
  • reportUnrenderableTags is deliberately not folded into reportUnsupportedClasses. 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 TagExtension it asked for. It re-runs prepareFromExtension's own check against the registered extensions instead of trusting a static list.
  • This needs flutter_html_class_to_css 0.1.1, where kFlutterHtmlRenderableTags and 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, then flutter_html_vuetify 0.1.1. UnrenderableTagsException and kFlutterHtmlRenderableTags are 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 .pubignore is a verbatim copy of .gitignore plus doc/, because .pubignore replaces .gitignore rather 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_effects for opacity, box-shadow and visibility, so opacity-*, link-opacity-*, shadow* and visible/invisible come back.
    • flutter_html_css_size_constraints for max-width, min-width, max-height and min-height, so mw-100, mh-100, min-vw-100 and min-vh-100 come back.
    • flutter_html_css_interaction for cursor, pointer-events and user-select, so pe-none, pe-auto and user-select-* come back.
    • flutter_html_css_text_overflow for text-overflow, white-space and -webkit-line-clamp, so text-wrap, text-nowrap and part of text-truncate come back.
  • A companion only takes effect when it is added from pub.flutter-io.cn and registered on the same Html widget as BootstrapUtilitiesHtmlExtension. 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. kKnownCssCompanions matches a registered extension's runtimeType.toString() against the names above, so renaming one of those classes upstream silently stops the match. That coupling is documented on both sides.
  • text-truncate is the one class no single companion covers. It resolves to overflow: hidden, text-overflow: ellipsis and white-space: nowrap, and the text-overflow companion renders only the last two. overflow stays suppressed, so the class is still named in the report for that one declaration.
  • The README says why CssBorderRadiusHtmlExtension has to be listed after this extension, and why its wrapIfHasAnyClass has to stay at the default true. Listed first it cannot read the element's border and margin, and a border rounded-3 element gets a square border around a rounded clip.
  • CssFlexHtmlExtension from flutter_html_css_flex is recognised too, and it is the one companion that needed more than a table entry. display is suppressed by value, not by property: flutter_html parses display and reads every keyword outside its five as Display.inline, so widening the property set could never reach display: flex. A companion entry now carries a displayValues set beside its properties set, and isRenderableDeclaration and suppressUnrenderableCss take an extraSupportedDisplayValues alongside extraSupportedProperties. So does BootstrapUtilitiesResolver, if you drive it yourself.
  • What that buys: with the flex extension registered, d-flex, d-inline-flex, d-grid, d-inline-grid, every flex-*, justify-content-*, align-items-*, align-content-*, align-self-*, order-*, gap-*, row-gap-* and column-gap-* class renders instead of being suppressed and reported. d-table, d-table-row and d-table-cell do not, because nothing renders those values, so they are still suppressed and still named.
  • Nothing changes without the extension registered. display: flex is suppressed exactly as in 0.1.1, and for the same reason.
  • The report got more precise in the same pass. It matches display on the suppressed value rather than on the property, so a document that only used d-table is not sent after the flex package, and irrecoverableDisplayValues is the new "nothing can render this" subset of unsupportedDisplayValues. gap and the rest of the flex family moved out of irrecoverableProperties and into the companion suggestion.
  • The dartdoc on CssCompanionExtension used 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 what display costs instead.
  • Behaviour change: fs-1 to fs-6 are now suppressed and reported instead of emitted, and isSupportedClass('fs-3') answers false. They emit a font-size in rem, ExpressionMapping.expressionToFontSize has its rem branch 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 for font-size now, the same way it already read it for display.
  • 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.
  • unsupportedClasses therefore moved from 647 to 653. The six new entries are exactly fs-1 to fs-6; nothing else in the corpus changed verdict. The invariants pin is updated, and so is the count in doc/unsupported-classes.md.
  • CssFontSizeHtmlExtension from flutter_html_css_font_size is recognised, and registering it un-suppresses the declaration again: the rem reaches style="" for that extension to resolve at the preProcessing step, 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 display one, done a second time rather than generalised. A companion entry carries a fontSizeUnits set beside its displayValues set, and isRenderableDeclaration, suppressUnrenderableCss and BootstrapUtilitiesResolver take an extraSupportedFontSizeUnits alongside the other two. Listing font-size in a companion's properties alone still changes nothing, by design: font-size is already in kFlutterHtmlSupportedProperties, so the property set was never what suppressed it. There is a test for that trap.
  • kFlutterHtmlUnrenderableFontSizeUnits is stated as what does not render, the opposite way round from kFlutterHtmlSupportedDisplayValues, and the asymmetry is measured rather than stylistic. An unknown display keyword becomes Display.inline, so only an allowlist is safe there. An unknown length unit reaches expressionToFontSize's LengthTerm branch, which reads the number and ignores the unit, so font-size: 12pt renders at 12. The three tokens that render nothing are rem, smaller and larger, and cssFontSizeUnit is what turns a value into one of them.
  • The report names the package from the property, not from the value, which is where font-size and display differ. One companion renders all three unrenderable tokens, so font-size stays in kCompanionPropertyIndex and out of irrecoverableProperties. An invariant pins that equality: a fourth token with no companion has to move the report to a value index, as display already has one.

0.1.1 #

  • pe-auto now resolves to pointer-events: auto. SpacingGapHandler runs first and its regex describes only the shape of a spacing class, so it parsed pe-auto as padding-inline-end with size auto. auto and the negative spacers are margin-only in Bootstrap, so the handler consumed the class and wrote nothing, and InteractionsHandler never saw it. The handler now declines margin-only tokens on p* classes, which also means pt-auto and pt-n3 are no longer matched at all; they are not Bootstrap classes.
  • text-truncate is implemented: overflow: hidden, text-overflow: ellipsis, white-space: nowrap. It previously fell through TextHandler's text-colour branch, which ends in return true for any unrecognised text-* token, and was swallowed.
  • Neither changes what reaches the screen today: pointer-events, overflow, text-overflow and white-space are all outside the 51 properties flutter_html parses, so both classes stay in unsupportedClasses and 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.md said 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_radius is a hosted ^0.1.0 instead 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_html extension that inlines Bootstrap 5.3 utility classes (spacing, colors, borders, display, sizing, typography, and more) as CSS understood by flutter_html.
  • Declarations flutter_html cannot render are suppressed rather than merged into style="". Most were inert, but display was actively harmful: flutter_html's value parser falls back to Display.inline for anything outside block/inline/inline-block/list-item/none, so d-flex turned block <div>s inline. display is 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 to FlutterError.onError (Sentry, for example) without interrupting rendering. Gated by reportUnsupportedClasses, default true.
  • A registered companion extension widens the renderable property set. Today CssBorderRadiusHtmlExtension re-enables the rounded-* 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, on BootstrapUtilitiesResolver, suppressUnrenderableDeclarations, extraSupportedProperties and resolveRaw().