initializeAttributes method
Implementation
@override
void initializeAttributes(Map<String, ElementAttributeProperty> attributes) {
super.initializeAttributes(attributes);
attributes.addAll({
'viewBox': ElementAttributeProperty(
getter: () =>
'${_viewBox?.left ?? 0} ${_viewBox?.top ?? 0} ${_viewBox?.width ?? 0} ${_viewBox?.height ?? 0}',
setter: (val) {
final nextViewBox = parseViewBox(val);
_viewBox = nextViewBox;
if (nextViewBox != (renderBoxModel as RenderSVGRoot?)?.viewBox) {
(renderBoxModel as RenderSVGRoot?)?.viewBox = nextViewBox;
}
}),
'preserveAspectRatio': ElementAttributeProperty(setter: (val) {
final nextRatio = SVGPreserveAspectRatio.parse(val);
if (nextRatio == null) {
// TODO: should log error like chrome
return;
}
if (nextRatio != _ratio) {
_ratio = nextRatio;
}
})
});
}