parseStyle method
DrawableStyle
parseStyle(
- Rect bounds,
- DrawableStyle? parentStyle, {
- Color? defaultFillColor,
- Color? currentColor,
Parses style attributes or @style attribute.
Remember that @style attribute takes precedence.
Implementation
DrawableStyle parseStyle(
Rect bounds,
DrawableStyle? parentStyle, {
Color? defaultFillColor,
Color? currentColor,
}) {
return DrawableStyle.mergeAndBlend(
parentStyle,
stroke: parseStroke(bounds, parentStyle?.stroke, currentColor),
dashArray: parseDashArray(),
dashOffset: parseDashOffset(),
fill:
parseFill(bounds, parentStyle?.fill, defaultFillColor, currentColor),
pathFillType: parseFillRule(
'fill-rule',
parentStyle != null ? null : 'nonzero',
),
groupOpacity: parseOpacity(),
mask: parseMask(),
clipPath: parseClipPath(),
textStyle: DrawableTextStyle(
fontFamily: getAttribute(attributes, 'font-family'),
fontSize: parseFontSize(getAttribute(attributes, 'font-size'),
parentValue: parentStyle?.textStyle?.fontSize),
fontWeight: parseFontWeight(
getAttribute(attributes, 'font-weight', def: null),
),
fontStyle: parseFontStyle(
getAttribute(attributes, 'font-style', def: null),
),
anchor: parseTextAnchor(
getAttribute(attributes, 'text-anchor', def: 'inherit'),
),
decoration: parseTextDecoration(
getAttribute(attributes, 'text-decoration', def: null),
),
decorationColor: parseColor(
getAttribute(attributes, 'text-decoration-color', def: null),
currentColor: currentColor,
),
decorationStyle: parseTextDecorationStyle(
getAttribute(attributes, 'text-decoration-style', def: null),
),
),
blendMode: _blendModes[getAttribute(attributes, 'mix-blend-mode')!],
);
}