parseViewBox function
Parses an AVD @android:viewportWidth and @android:viewportHeight attributes to a Rect.
Implementation
DrawableViewport parseViewBox(List<XmlAttribute> el) {
final String? rawWidth =
getAttribute(el, 'viewportWidth', def: '', namespace: androidNS);
final String? rawHeight =
getAttribute(el, 'viewportHeight', def: '', namespace: androidNS);
if (rawWidth == '' || rawHeight == '') {
return const DrawableViewport(Size.zero, Size.zero);
}
final double width = parseDouble(rawWidth)!;
final double height = parseDouble(rawHeight)!;
return DrawableViewport(
Size(width, height),
Size(width, height),
);
}