flutter_html_css_background 0.2.0
flutter_html_css_background: ^0.2.0 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.0 #
- Renamed from
flutter_html_css_background_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.0 #
- Initial release.
flutter_html3.0.0 parsesbackground-colorand has no case at all for thebackgroundshorthand:declarationsToStyleis oneswitchover the property name, andbackgroundfalls through.<div style="background: #fff">has no background,<div style="background-color: #fff">is white. Silent.csslibhands the value over as the very same term, so the parser could have read it and doesn't look.doc/background.mdhas the table, and every row is pinned by a test. - The fix is a rewrite of the inline
styleattribute at thepreStylingstep, the same shape asflutter_html_css_color:background: <anything> <colour>becomesbackground-color: <colour>, in place, with the colour token verbatim and!importantkept. In place is what makes the last declaration win: abackground-colorwritten after the shorthand survives, and abackgroundwritten after abackground-coloroverrides it.background: none(or a shorthand with only an image) becomesbackground-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_html3.0.0 has no case forbackground-imageor any of the other six longhands and noStylefield for them, andbackground-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 aurl(data:image/png;base64,...)or aurl('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 andflutter_htmldrops it. - Two order rules, both measured against the released siblings. List this one after
flutter_html_css_stylesheet0.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 beforeflutter_html_css_color0.1.0, which corrects the token inbackground-colorand has no case forbackground(hsl(0 100% 50%)is red with this one first, black with the colour package first). Border 0.1.0, Bootstrap 0.1.2bg-*and Vuetify 0.1.1bg-*don't care about the order; both utility packages write the longhand, never the shorthand.