@@ -86,9 +86,10 @@ class Icon extends StatelessWidget {
8686 this .semanticLabel,
8787 this .textDirection,
8888 this .applyTextScaling,
89- }) : assert (fill == null || (0.0 <= fill && fill <= 1.0 )),
90- assert (weight == null || (0.0 < weight)),
91- assert (opticalSize == null || (0.0 < opticalSize));
89+ this .blendMode,
90+ }) : assert (fill == null || (0.0 <= fill && fill <= 1.0 )),
91+ assert (weight == null || (0.0 < weight)),
92+ assert (opticalSize == null || (0.0 < opticalSize));
9293
9394 /// The icon to display. The available icons are described in [Icons] .
9495 ///
@@ -247,6 +248,11 @@ class Icon extends StatelessWidget {
247248 /// [IconThemeData.applyTextScaling] .
248249 final bool ? applyTextScaling;
249250
251+ /// The [BlendMode] to apply to the foreground of the icon.
252+ ///
253+ /// Defaults to [BlendMode.srcOver]
254+ final BlendMode ? blendMode;
255+
250256 @override
251257 Widget build (BuildContext context) {
252258 assert (this .textDirection != null || debugCheckHasDirectionality (context));
@@ -279,10 +285,18 @@ class Icon extends StatelessWidget {
279285 }
280286
281287 final double iconOpacity = iconTheme.opacity ?? 1.0 ;
282- Color iconColor = color ?? iconTheme.color! ;
288+ Color ? iconColor = color ?? iconTheme.color! ;
289+ Paint ? foreground;
283290 if (iconOpacity != 1.0 ) {
284291 iconColor = iconColor.withOpacity (iconColor.opacity * iconOpacity);
285292 }
293+ if (blendMode != null ) {
294+ foreground = Paint ()
295+ ..blendMode = blendMode!
296+ ..color = iconColor;
297+ // Cannot provide both a color and a foreground.
298+ iconColor = null ;
299+ }
286300
287301 final TextStyle fontStyle = TextStyle (
288302 fontVariations: < FontVariation > [
@@ -298,8 +312,9 @@ class Icon extends StatelessWidget {
298312 package: icon.fontPackage,
299313 fontFamilyFallback: icon.fontFamilyFallback,
300314 shadows: iconShadows,
301- height: 1.0 , // Makes sure the font's body is vertically centered within the iconSize x iconSize square.
315+ height: 1.0 , // Makes sure the font's body is vertically centered within the iconSize x iconSize square.
302316 leadingDistribution: TextLeadingDistribution .even,
317+ foreground: foreground,
303318 );
304319
305320 Widget iconWidget = RichText (
0 commit comments