flutter_html_css_background 0.2.1 copy "flutter_html_css_background: ^0.2.1" to clipboard
flutter_html_css_background: ^0.2.1 copied to clipboard

A flutter_html extension that renders the colour of a CSS background shorthand, which flutter_html 3.0.0 drops whole: background: #fff becomes background-color.

0.2.1 #

  • Adopts flutter_html_css_core 0.1.0 for the shared quote- and paren-aware splitter and for !important stripping, instead of a local copy of each. splitInlineCssDeclarations, splitCssLayers and tokenizeCssValue now delegate to core's splitTopLevel, and rewriteInlineStyleBackground strips !important with core's stripImportant. No public API changed: every function and constant this package exported before still exists with the same signature and the same behaviour, pinned by the existing test suite.
  • rewriteInlineStyleBackground keeps its own rewrite loop rather than core's rewriteDeclarations, because that helper rewrites only a declaration's value and always keeps the author's property text before the colon, while this package renames the property itself, background to background-color.

0.2.0 #

  • Renamed from flutter_html_css_background_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.0 #

  • Initial release. flutter_html 3.0.0 parses background-color and has no case at all for the background shorthand: declarationsToStyle is one switch over the property name, and background falls through. <div style="background: #fff"> has no background, <div style="background-color: #fff"> is white. Silent. csslib hands the value over as the very same term, so the parser could have read it and doesn't look. doc/background.md has the table, and every row is pinned by a test.
  • The fix is a rewrite of the inline style attribute at the preStyling step, the same shape as flutter_html_css_color: background: <anything> <colour> becomes background-color: <colour>, in place, with the colour token verbatim and !important kept. In place is what makes the last declaration win: a background-color written after the shorthand survives, and a background written after a background-color overrides it. background: none (or a shorthand with only an image) becomes background-color: transparent, which resets an earlier inline colour.
  • Everything that isn't the colour is dropped: url(), gradients, position, size, repeat, attachment, origin, clip. I checked before deciding that: flutter_html 3.0.0 has no case for background-image or any of the other six longhands and no Style field for them, and background-image: url(a.png) renders nothing with or without this package. Nothing that could have rendered is lost.
  • The tokenizer splits the attribute on ; outside brackets and quotes, so a url(data:image/png;base64,...) or a url('a;b.png') stays whole. Layers split on top-level commas, tokens on top-level whitespace, and the colour may sit only in the last layer, as CSS says. Anything the grammar can't place (var(), two colours, a colour in a non-final layer) is left as written and flutter_html drops it.
  • Two order rules, both measured against the released siblings. List this one after flutter_html_css_stylesheet 0.1.0, which writes a <style> rule into the inline style at the same step (.card { background: red } is red after it, nothing before it). List it before flutter_html_css_color 0.1.0, which corrects the token in background-color and has no case for background (hsl(0 100% 50%) is red with this one first, black with the colour package first). Border 0.1.0, Bootstrap 0.1.2 bg-* and Vuetify 0.1.1 bg-* don't care about the order; both utility packages write the longhand, never the shorthand.
0
likes
160
points
40
downloads

Documentation

API reference

Publisher

verified publisherchaosworld.cc

Weekly Downloads

A flutter_html extension that renders the colour of a CSS background shorthand, which flutter_html 3.0.0 drops whole: background: #fff becomes background-color.

Repository (GitLab)
View/report issues
Contributing

Topics

#flutter-html #css #html #extension #background

License

MPL-2.0 (license)

Dependencies

flutter, flutter_html, flutter_html_css_core, html

More

Packages that depend on flutter_html_css_background