buildInlineStyle static method
Implementation
static CSSStyle? buildInlineStyle(Element element) {
List<CSSProperty> cssProperties = [];
String cssText = '';
element.inlineStyle.forEach((key, value) {
String kebabName = kebabize(key);
String propertyValue = value.toString();
String _cssText = '$kebabName: $propertyValue';
CSSProperty cssProperty = CSSProperty(
name: kebabName,
value: value,
range: SourceRange(
startLine: 0,
startColumn: cssText.length,
endLine: 0,
endColumn: cssText.length + _cssText.length + 1,
),
);
cssText += '$_cssText; ';
cssProperties.add(cssProperty);
});
return CSSStyle(
// For inline style, provide a string StyleSheetId per CDP expectations.
styleSheetId: 'inline:${element.ownerView.forDevtoolsNodeId(element)}',
cssProperties: cssProperties,
shorthandEntries: <ShorthandEntry>[],
cssText: cssText,
range: SourceRange(startLine: 0, startColumn: 0, endLine: 0, endColumn: cssText.length));
}