styleTree static method
StyledElement
styleTree(
- StyledElement tree,
- Element htmlData,
- Map<
String, Style> style, - OnCssParseError? onCssParseError,
styleTree takes the lexed StyleElement tree and applies external, inline, and custom CSS/Flutter styles, and then cascades the styles down the tree.
Implementation
static StyledElement styleTree(StyledElement tree, dom.Element htmlData,
Map<String, Style> style, OnCssParseError? onCssParseError) {
Map<String, Map<String, List<css.Expression>>> declarations =
_getExternalCssDeclarations(
htmlData.getElementsByTagName("style"), onCssParseError);
StyledElement? externalCssStyledTree;
if (declarations.isNotEmpty) {
externalCssStyledTree = _applyExternalCss(declarations, tree);
}
tree = _applyInlineStyles(externalCssStyledTree ?? tree, onCssParseError);
tree = _applyCustomStyles(style, tree);
tree = _cascadeStyles(style, tree);
return tree;
}