flutter_html_css_all library

One dependency and one import for the flutter_html extension packages of this family, plus the registration order they have to be listed in.

This library re-exports twenty-one packages; BundledCssExtensions registers nineteen instances. The two it leaves out have no default that suits every document, and BundledCssExtensions says which and why.

It declares no extension class of its own and wraps none of theirs. That is a hard constraint rather than a style choice: flutter_html_bootstrap and flutter_html_vuetify recognise a companion extension by runtimeType.toString(), so a wrapper class would carry the wrong name and switch their suppression back on. The instances BundledCssExtensions registers are the sibling classes themselves.

import 'package:flutter_html/flutter_html.dart';
import 'package:flutter_html_css_all/flutter_html_css_all.dart';

Html(
  data: '<div style="max-width: 320px; overflow: hidden;">Card</div>',
  extensions: const BundledCssExtensions(),
);

BundledCssExtensions is a List<HtmlExtension> with const constructors only. kBundledCssExtensions is a const instance of the defaults, and bundledCssExtensions is the function form.

The order is the reason the package exists. Each sibling states its own ordering rules, and several of them are silent failures: the document renders, one property does not apply, and nothing is logged. The order is recorded property by property in doc/order.md.

Classes

BundledCssExtensions
The extensions this package registers, in the one registration order that satisfies every ordering rule the sibling packages state.
ClassListCssResolver
Implement this to translate ordered class lists into inline CSS.
ClassToInlineCssExtension
Generic HtmlExtension that runs only at the preStyling step and merges resolver output into style="".
CssBackgroundHtmlExtension
Renders the colour of a CSS background shorthand, which flutter_html 3.0.0 drops whole.
CssBorder
The four resolved sides of a box.
CssBorderHtmlExtension
Adds runtime support for the CSS border longhand properties flutter_html drops.
CssBorderRadiusHtmlExtension
Adds runtime support for native CSS border-radius via a wrapper + clipping.
CssBorderSide
One resolved side of a box.
CssColorHtmlExtension
Corrects the CSS colours that flutter_html 3.0.0 mis-reads or drops.
CssDeclaration
One declaration of an inline style="" attribute, in source order.
CssEdgeLength
One side of a padding or margin, as this extension will write it.
CssEffects
The subset of CSS painting properties this package can render, as read from one element's final inline style="".
CssEffectsHtmlExtension
Adds runtime support for the CSS painting properties flutter_html drops: opacity, box-shadow and visibility.
CssFlexBasis
A parsed flex-basis.
CssFlexContainer
Everything this extension reads off a flex or grid container.
CssFlexHtmlExtension
Lays out CSS flexbox containers, single-axis grid containers, and gap.
CssFlexItem
Everything this extension reads off a flex item.
CssFlexLayout
Lays a list of flex or grid items out the way container asks for.
CssFontSize
One parsed CSS font-size value.
CssFontSizeHtmlExtension
Renders a relative CSS font-size that flutter_html 3.0.0 drops or compounds.
CssGridTrack
One track of a grid-template-columns list.
CssInteraction
The interaction behaviour resolved from one element's inline style="".
CssInteractionHtmlExtension
Adds runtime support for the CSS pointer-events, user-select and cursor properties, of which flutter_html 3.0.0 parses none.
CssLineHeight
One corrected CSS line height.
CssLineHeightHtmlExtension
Renders the CSS line-height that flutter_html 3.0.0 renders too tall.
CssMatrixFunction
matrix(a, b, c, d, e, f), the raw 2D affine form.
CssObjectFitDeclarations
The object-fit and object-position declarations of one inline style.
CssObjectFitHtmlExtension
Renders the CSS object-fit and object-position properties on <img> elements.
CssOverflowAxes
The computed overflow-x and overflow-y of one element, as read from its final inline style="".
CssOverflowClipper
Clips one axis of a box and leaves the other free.
CssOverflowHtmlExtension
Adds runtime support for the CSS overflow, overflow-x and overflow-y properties, which flutter_html 3.0.0 does not parse at all.
CssPercentEdges
The sides of one element's padding or margin that this extension writes.
CssPercentSizeHtmlExtension
Renders a percentage width, height, padding or margin, which flutter_html 3.0.0 renders as zero pixels.
CssPercentSizes
The percentage width, height, padding and margin found on one element's inline style.
CssRotateFunction
rotate(), held in radians.
CssScaleFunction
scale(), scaleX() and scaleY().
CssSizeConstraints
The max-width / min-width / max-height / min-height declarations found on one element, still in their authored units.
CssSizeConstraintsHtmlExtension
Adds runtime support for the CSS max-width, min-width, max-height and min-height properties, which flutter_html 3.0.0 does not parse at all.
CssSizeLength
One CSS length written on a max-*/min-* property, kept in the unit the author wrote it in.
CssSkewFunction
skew(), skewX() and skewY(), held in radians.
CssSpacing
A parsed letter-spacing or word-spacing value.
CssSpecificity
The specificity of one selector, as the three counts CSS defines.
CssStyleRule
One style rule out of a stylesheet, for one selector.
CssStylesheetHtmlExtension
Makes the declarations in a <style> block reach flutter_html and its extension family.
CssTextMetricsHtmlExtension
Adds runtime support for the CSS text metrics that flutter_html's Style already carries: letter-spacing, word-spacing, text-decoration-thickness, and the tail of a font-family list.
CssTextOverflowHtmlExtension
Adds runtime support for the CSS text-overflow family: text-overflow, white-space and -webkit-line-clamp.
CssTextTransformHtmlExtension
Renders text-transform, which flutter_html 3.0.0 parses and then never applies.
CssTransform
One element's transform and transform-origin, read from its final inline style="".
CssTransformBox
Applies a parsed CSS transform to child at paint time.
CssTransformFunction
One function from a transform list, with its percentages still unresolved.
CssTransformHtmlExtension
Adds runtime support for the CSS transform and transform-origin properties, which flutter_html drops.
CssTransformLength
One <length-percentage> from a transform declaration.
CssTransformOrigin
The point a transform turns and scales around: CSS transform-origin.
CssTranslateFunction
translate(), translateX() and translateY().
CssUnitsHtmlExtension
Renders the CSS absolute and viewport length units that flutter_html 3.0.0 reads as pixels or as zero.
ImgAltElement
The prepared form of an <img> that renders as its alt text.
ImgAltHtmlExtension
Renders the alt text of an <img> whose src the built-in image renderer declines.
Insert
One insertion point inside a BundledCssExtensions.
RenderCssTransform
The render object behind CssTransformBox.
StylesheetDeclaration
One property: value pair out of a stylesheet or an inline style.
UnrenderableTagReporter
Collects unrenderable tag names and emits one FlutterError report per parsed document.
UnsupportedCssRule
One rule that renders nothing, handed to onUnsupportedRule.

Enums

CssAlign
CSS align-items and align-self.
CssAlignContent
CSS align-content.
CssBorderStyle
The border-style keywords CSS defines.
CssEdgeUnit
The unit of one CssEdgeLength.
CssFlexBasisKind
How a flex item sizes itself along the main axis before growing.
CssFlexDirection
CSS flex-direction.
CssFlexDisplay
The formatting context an element asks for.
CssFlexWrap
CSS flex-wrap.
CssFontSizeUnit
The units a CSS font-size can state that flutter_html 3.0.0 can hold.
CssJustifyContent
CSS justify-content.
CssObjectFit
The CSS object-fit keywords, and the BoxFit each one maps to.
CssOverflow
The overflow keywords this package understands.
CssSizeUnit
Every CSS unit CssSizeLength understands.
CssSpacingUnit
The length units this package resolves.
CssVisibility
The visibility keywords this package understands.
UnsupportedCssReason
Why a rule in a stylesheet renders nothing.

Constants

kAssumedDecorationThicknessDivisor → const double
How many times a text font's own decoration line fits into its font size.
kBundledCssExtensionNames → const List<String>
The class name of each default entry of BundledCssExtensions, in order.
kBundledCssExtensions → const BundledCssExtensions
A const instance of the defaults, usable wherever a List<HtmlExtension> is.
kCssAbsoluteUnitsInPx → const Map<String, double>
How many CSS pixels one unit of each absolute length unit is.
kCssBackgroundKeywords → const Set<String>
The keywords the non-colour components of a background shorthand can be: none for the image, the position, size, repeat, attachment and box keywords. Each is a valid component and is dropped from the rewritten declaration.
kCssBorderProperties → const Set<String>
The CSS properties CssBorderHtmlExtension adds.
kCssColorFunctions → const Set<String>
The CSS colour functions. A token name(...) with one of these names is a colour token to isCssColorToken.
kCssColorProperties → const Set<String>
The CSS properties rewriteInlineStyleColors rewrites a colour inside.
kCssCursorKeywords → const Map<String, SystemMouseCursor>
CSS cursor keywords mapped to their nearest Flutter SystemMouseCursor.
kCssDisplayRepairValues → const Set<String>
The display values this extension repairs without laying them out.
kCssEffectsProperties → const Set<String>
The CSS properties CssEffectsHtmlExtension renders.
kCssFlexDisplayValues → const Set<String>
The display values this extension renders.
kCssFlexFallbackFontSize → const double
The default font size flutter_html starts a document at.
kCssFlexProperties → const Set<String>
The CSS properties this extension renders.
kCssFontSizeProperties → const Set<String>
The CSS property CssFontSizeHtmlExtension makes renderable.
kCssImageFunctions → const Set<String>
The CSS image functions a <bg-image> component can be.
kCssInteractionProperties → const Set<String>
The CSS properties CssInteractionHtmlExtension renders.
kCssLengthProperties → const Set<String>
The CSS properties rewriteInlineStyleUnits rewrites a length inside.
kCssLineHeightProperties → const Set<String>
The CSS property CssLineHeight corrects.
kCssNamedColorNames → const Set<String>
Every CSS <named-color>, lower case. 148 names.
kCssNamedColors → const Map<String, Color>
Every CSS <named-color>, lower case, with its sRGB value.
kCssObjectFitProperties → const Set<String>
The CSS properties this package reads.
kCssOverflowProperties → const Set<String>
The CSS properties CssOverflowHtmlExtension renders.
kCssPercentEdgeProperties → const Set<String>
The 22 padding and margin properties this package repairs, lower-cased.
kCssPercentSizeProperties → const Set<String>
The two size properties this package repairs, lower-cased.
kCssSizeConstraintProperties → const Set<String>
The four CSS properties this package renders, lower-cased.
kCssTextMetricsProperties → const Set<String>
The CSS properties CssTextMetricsHtmlExtension makes renderable.
kCssTextOverflowProperties → const Set<String>
The CSS properties CssTextOverflowHtmlExtension renders.
kCssTransformProperties → const Set<String>
The CSS properties CssTransformHtmlExtension renders.
kCssViewportUnits → const Map<String, String>
The viewport units the rewrite resolves, and the axis each one reads.
kCssWideKeywords → const Set<String>
The CSS-wide keywords. A background whose whole value is one of these is rewritten to background-color: <keyword>, verbatim.
kFlutterHtmlBorderShorthands → const Set<String>
The five border properties flutter_html 3.0.0 parses by itself.
kFlutterHtmlLineHeightFactor → const double
The number flutter_html 3.0.0 multiplies every CSS line height by.
kFlutterHtmlRenderableTags → const Set<String>
Every element name flutter_html 3.0.0 renders on its own.
kFlutterHtmlRootFontSize → const double
flutter_html's root font size in logical pixels.
kNeverMatchingPseudoClasses → const Set<String>
The pseudo-classes the selector matcher evaluates to false for every element.
kSupportedPseudoClasses → const Set<String>
The pseudo-classes the selector matcher in package:html evaluates.
kSupportedPseudoClassFunctions → const Set<String>
The functional pseudo-classes the selector matcher evaluates.
kUnclippedAxisExtent → const double
How far past the element's box CssOverflowClipper lets a free axis run, in logical pixels.

Functions

applyRulesToInlineStyle(String? inlineStyle, Iterable<CssStyleRule> rules) → String
Merges the winning declarations of rules into inlineStyle.
backgroundColorOfShorthand(String value) → String?
The background-color a background shorthand states.
bundledCssExtensions({List<HtmlExtension> before = const <HtmlExtension>[], List<HtmlExtension> after = const <HtmlExtension>[], List<Insert> inserts = const <Insert>[], CssStylesheetHtmlExtension? stylesheetExtension, List<HtmlExtension> utilityClassExtensions = const <HtmlExtension>[], HtmlExtension? utilityClassExtension, bool resolvePercentages = true, double? rootFontSize, Size? viewportSize, Map<String, MouseCursor> extraCursors = const <String, MouseCursor>{}, bool imgAlt = true, Map<String, String>? imageNetworkHeaders, Set<String>? imageNetworkDomains, Set<String> imageNetworkSchemas = const <String>{'http', 'https'}, Set<String>? imageFileExtensions, AssetBundle? imageAssetBundle, String? imageAssetPackage, Set<String>? imageMimeTypes, String? imageDataEncoding, bool handleNetworkImages = true, bool handleAssetImages = true, bool handleDataImages = true}) → BundledCssExtensions
The function form of BundledCssExtensions, for the argument-heavy call.
cascadeTextTransform(StyledElement element, TextTransform value) → void
Writes value into element and every descendant that states no transform of its own.
convertCssLengthToPx(double value, String unit, {Size? viewport}) → double?
Converts one CSS length to pixels.
cssDisplayRepairOf(String css) → Display?
The Display to write for the display in css, or null.
cssFlexDisplayOf(String css) → CssFlexDisplay?
The display value of css, if it names a formatting context this extension lays out.
formatCssColorAsRgba(Color color) → String
Writes color as the legacy rgba(r, g, b, a) form.
formatCssPx(double value) → String
Formats a pixel length the way this package writes it back.
isCssBackgroundComponent(String token) → bool
Whether token is a valid non-colour component of a background shorthand: a keyword in kCssBackgroundKeywords, a function in kCssImageFunctions, a length, a percentage, a number, a size pair joined by a slash such as 50%/auto, or the / that separates the position from the size.
isCssColorToken(String token) → bool
Whether token is one CSS colour.
isFlutterHtmlRenderableTag(String tagName) → bool
Whether flutter_html 3.0.0 renders tagName without an extension.
joinDeclarationList(Iterable<StylesheetDeclaration> declarations) → String
Joins declarations back into an inline style="" value.
matchingRules(Iterable<CssStyleRule> rules, StyledElement element) → List<CssStyleRule>
The rules of rules that element matches, in source order.
parseCssColorValue(String value, {Color? currentColor}) → Color?
Parses one CSS colour value into a Color.
parseCssFlexContainer(String css, {double emValue = 14, double remValue = 14}) → CssFlexContainer?
Reads the container properties out of an inline style.
parseCssFlexItem(String css, {double emValue = 14, double remValue = 14}) → CssFlexItem
Reads the item properties out of an inline style.
parseCssFontFamilyList(String? rawValue) → List<String>
Splits a font-family value into its font family names, in order.
parseCssGridTemplateColumns(String value, double emValue, double remValue) → List<CssGridTrack>
Parses a grid-template-columns value into tracks.
parseCssObjectPosition(String value) → Alignment?
Reads one object-position value into a Flutter Alignment.
parseCssRules(String source, {int firstOrder = 0, OnUnsupportedCssRule? onUnsupportedRule}) → List<CssStyleRule>
Reads a stylesheet and returns one CssStyleRule per selector.
parseCssSpacing(String? rawValue) → CssSpacing?
Parses a letter-spacing or word-spacing value.
parseCssTextDecorationThickness(String? rawValue, {double? emBase, double? remBase}) → double?
Parses a text-decoration-thickness value into Flutter's multiplier.
parseCssTextTransform(String? rawValue) → TextTransform?
Parses a text-transform value into flutter_html's TextTransform.
parseCssTransform(String styleAttr, {double? emPx, double? remPx}) → CssTransform
Reads both properties this package renders out of an inline style="".
parseDeclarationList(String style) → List<StylesheetDeclaration>
Splits an inline style="" value into declarations.
parseInlineCssDeclarations(String? styleAttribute) → Map<String, String>
Splits an inline style="" attribute into declarations.
parseInlineStyle(String style) → List<CssDeclaration>
Splits an inline style="" attribute into declarations, in source order.
readAltAttribute(Node node) → String?
Reads the alt attribute of node, or null if there is nothing to render.
resolveCssBorder(List<CssDeclaration> declarations, {String currentColor = '#000000'}) → CssBorder
Resolves the CSS border cascade of one inline style.
resolvedFontSizeOf(StyledElement element, {double rootFontSize = kFlutterHtmlRootFontSize}) → double
The font size element should render at, in logical pixels.
rewriteCssValueUnits(String value, {Size? viewport}) → String
Rewrites every absolute and viewport dimension token in one declaration value to pixels.
rewriteInlineBorder(String style) → String
Rewrites one inline style="" so that the border it describes survives flutter_html's parser.
rewriteInlineStyleBackground(String inlineStyle) → String?
Rewrites every background shorthand in inlineStyle into the background-color longhand flutter_html reads.
rewriteInlineStyleColors(String inlineStyle, {Color? currentColor}) → String?
Rewrites every colour this package understands in inlineStyle into the legacy rgba() form.
rewriteInlineStyleUnits(String inlineStyle, {Size? viewport}) → String?
Rewrites every absolute and viewport length in inlineStyle to pixels.
ruleMatchesElement(CssStyleRule rule, StyledElement element) → bool
Whether element matches rule's selector.
specificityOfSelector(String selector) → CssSpecificity
The specificity of one selector, given as source text.
splitCssDeclarations(String inlineStyle) → List<String>
Splits an inline style into its declarations at every ; that is outside a quoted string and outside brackets.
splitCssLayers(String value) → List<String>
Splits a background value into its layers, at every top-level comma.
splitInlineCssDeclarations(String inlineStyle) → List<String>
Splits an inline style="" attribute into its declarations.
statedTextTransform(StyledElement element) → TextTransform?
The transform element states for itself, or null when it states none.
stripImportant(String? rawValue) → String?
Removes a trailing !important from a declaration value.
tokenizeCssValue(String layer) → List<String>
Splits one layer of a background value into its tokens, at every run of top-level whitespace.

Typedefs

CssFlexChild = ({CssFlexItem item, Widget widget})
One flex or grid item: the widget to lay out, and the properties read off the element it came from.
OnUnsupportedCssRule = void Function(UnsupportedCssRule rule)
Called once per rule that renders nothing. See UnsupportedCssRule.

Exceptions / Errors

UnrenderableTagsException
Names the tags in one parsed document that flutter_html 3.0.0 renders as nothing, although a utility-class extension resolved their classes.