From d06e4325d87e9d82a7221a73dcb9bcb03c087c81 Mon Sep 17 00:00:00 2001 From: liyuqian Date: Sun, 6 Jan 2019 07:20:36 +0800 Subject: [PATCH] Explain that BoxDecoration doesn't do clip. (#26089) Fixes https://github.com/flutter/flutter/issues/22370 --- packages/flutter/lib/src/painting/box_decoration.dart | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/flutter/lib/src/painting/box_decoration.dart b/packages/flutter/lib/src/painting/box_decoration.dart index b1c06e3f9b..3137c33c21 100644 --- a/packages/flutter/lib/src/painting/box_decoration.dart +++ b/packages/flutter/lib/src/painting/box_decoration.dart @@ -54,6 +54,13 @@ import 'image_provider.dart'; /// ``` /// {@end-tool} /// +/// {@template flutter.painting.boxDecoration.clip} +/// The [shape] or the [borderRadius] won't clip the children of the +/// decorated [Container]. If the clip is required, insert a clip widget +/// (e.g., [ClipRect], [ClipRRect], [ClipPath]) as the child of the [Container]. +/// Be aware that clipping may be costly in terms of performance. +/// {@endtemplate} +/// /// See also: /// /// * [DecoratedBox] and [Container], widgets that can be configured with @@ -130,6 +137,8 @@ class BoxDecoration extends Decoration { /// /// Applies only to boxes with rectangular shapes; ignored if [shape] is not /// [BoxShape.rectangle]. + /// + /// {@macro flutter.painting.boxDecoration.clip} final BorderRadiusGeometry borderRadius; /// A list of shadows cast by this box behind the box. @@ -163,6 +172,8 @@ class BoxDecoration extends Decoration { /// different [ShapeBorder]s; in particular, [CircleBorder] instead of /// [BoxShape.circle] and [RoundedRectangleBorder] instead of /// [BoxShape.rectangle]. + /// + /// {@macro flutter.painting.boxDecoration.clip} final BoxShape shape; @override