From 5b76b350b674fa6bd4b632fe8850557af38d083b Mon Sep 17 00:00:00 2001 From: Filip Hracek Date: Mon, 14 Sep 2020 17:57:08 -0700 Subject: [PATCH] Improve docs of ImageFiltered and BackdropFilter (#65503) --- packages/flutter/lib/src/widgets/basic.dart | 6 ++++++ packages/flutter/lib/src/widgets/image_filter.dart | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/packages/flutter/lib/src/widgets/basic.dart b/packages/flutter/lib/src/widgets/basic.dart index 9e12304c0a..6b1a2d4c8e 100644 --- a/packages/flutter/lib/src/widgets/basic.dart +++ b/packages/flutter/lib/src/widgets/basic.dart @@ -384,8 +384,14 @@ class ShaderMask extends SingleChildRenderObjectWidget { /// This effect is relatively expensive, especially if the filter is non-local, /// such as a blur. /// +/// If all you want to do is apply an [ImageFilter] to a single widget +/// (as opposed to applying the filter to everything _beneath_ a widget), use +/// [ImageFiltered] instead. For that scenario, [ImageFiltered] is both +/// easier to use and less expensive than [BackdropFilter]. +/// /// See also: /// +/// * [ImageFiltered], which applies an [ImageFilter] to its child. /// * [DecoratedBox], which draws a background under (or over) a widget. /// * [Opacity], which changes the opacity of the widget itself. class BackdropFilter extends SingleChildRenderObjectWidget { diff --git a/packages/flutter/lib/src/widgets/image_filter.dart b/packages/flutter/lib/src/widgets/image_filter.dart index db7d83efa6..3079b7753d 100644 --- a/packages/flutter/lib/src/widgets/image_filter.dart +++ b/packages/flutter/lib/src/widgets/image_filter.dart @@ -12,6 +12,12 @@ import 'package:flutter/rendering.dart'; import 'framework.dart'; /// Applies an [ImageFilter] to its child. +/// +/// See also: +/// +/// * [BackdropFilter], which applies an [ImageFilter] to everything +/// beneath its child. +/// * [ColorFiltered], which applies a [ColorFilter] to its child. @immutable class ImageFiltered extends SingleChildRenderObjectWidget { /// Creates a widget that applies an [ImageFilter] to its child.