@@ -1969,6 +1969,39 @@ class SvgAttributes {
19691969 /// The y translation.
19701970 final double ? y;
19711971
1972+ /// A copy of these attributes after absorbing a saveLayer.
1973+ ///
1974+ /// Specifically, this will null out `blendMode` and any opacity related
1975+ /// attributes, since those have been applied in a saveLayer call.
1976+ ///
1977+ /// The [raw] map preserves old values.
1978+ SvgAttributes forSaveLayer () {
1979+ return SvgAttributes ._(
1980+ raw: raw,
1981+ id: id,
1982+ href: href,
1983+ transform: transform,
1984+ color: color,
1985+ stroke: stroke? .forSaveLayer (),
1986+ fill: fill? .forSaveLayer (),
1987+ fillRule: fillRule,
1988+ clipRule: clipRule,
1989+ clipPathId: clipPathId,
1990+ blendMode: blendMode,
1991+ fontFamily: fontFamily,
1992+ fontWeight: fontWeight,
1993+ fontSize: fontSize,
1994+ textDecoration: textDecoration,
1995+ textDecorationStyle: textDecorationStyle,
1996+ textDecorationColor: textDecorationColor,
1997+ x: x,
1998+ textAnchorMultiplier: textAnchorMultiplier,
1999+ y: y,
2000+ width: width,
2001+ height: height,
2002+ );
2003+ }
2004+
19722005 /// Creates a new set of attributes as if this inherited from `parent` .
19732006 ///
19742007 /// If `includePosition` is true, the `x` /`y` coordinates are also inherited. This
@@ -2066,6 +2099,25 @@ class SvgStrokeAttributes {
20662099 /// The opacity to apply to a default color, if [color] is null.
20672100 final double ? opacity;
20682101
2102+ /// A copy of these attributes after absorbing a saveLayer.
2103+ ///
2104+ /// Specifically, this will null out any opacity related
2105+ /// attributes, since those have been applied in a saveLayer call.
2106+ SvgStrokeAttributes forSaveLayer () {
2107+ return SvgStrokeAttributes ._(
2108+ _definitions,
2109+ color: color,
2110+ shaderId: shaderId,
2111+ join: join,
2112+ cap: cap,
2113+ miterLimit: miterLimit,
2114+ width: width,
2115+ dashArray: dashArray,
2116+ dashOffset: dashOffset,
2117+ hasPattern: hasPattern,
2118+ );
2119+ }
2120+
20692121 /// Inherits attributes in this from parent.
20702122 SvgStrokeAttributes applyParent (SvgStrokeAttributes ? parent) {
20712123 return SvgStrokeAttributes ._(
@@ -2156,6 +2208,19 @@ class SvgFillAttributes {
21562208 /// If there is a pattern a default fill will be returned.
21572209 final bool ? hasPattern;
21582210
2211+ /// A copy of these attributes after absorbing a saveLayer.
2212+ ///
2213+ /// Specifically, this will null out any opacity related
2214+ /// attributes, since those have been applied in a saveLayer call.
2215+ SvgFillAttributes forSaveLayer () {
2216+ return SvgFillAttributes ._(
2217+ _definitions,
2218+ color: color,
2219+ shaderId: shaderId,
2220+ hasPattern: hasPattern,
2221+ );
2222+ }
2223+
21592224 /// Inherits attributes in this from parent.
21602225 SvgFillAttributes applyParent (SvgFillAttributes ? parent) {
21612226 return SvgFillAttributes ._(
0 commit comments