Add examples and troubleshooting comment for ClipRRect (#101907)

This commit is contained in:
Bruno Leroux
2022-04-18 19:24:08 +02:00
committed by GitHub
parent d8c9ce9ab4
commit 37b3feea70
5 changed files with 214 additions and 0 deletions

View File

@@ -705,6 +705,27 @@ class ClipRect extends SingleChildRenderObjectWidget {
///
/// {@youtube 560 315 https://www.youtube.com/watch?v=eI43jkQkrvs}
///
/// {@tool dartpad}
/// This example shows various [ClipRRect]s applied to containers.
///
/// ** See code in examples/api/lib/widgets/basic/clip_rrect.0.dart **
/// {@end-tool}
///
/// ## Troubleshooting
///
/// ### Why doesn't my [ClipRRect] child have rounded corners?
///
/// When a [ClipRRect] is bigger than the child it contains, its rounded corners
/// could be drawn in unexpected positions. Make sure that [ClipRRect] and its child
/// have the same bounds (by shrinking the [ClipRRect] with a [FittedBox] or by
/// growing the child).
///
/// {@tool dartpad}
/// This example shows a [ClipRRect] that adds round corners to an image.
///
/// ** See code in examples/api/lib/widgets/basic/clip_rrect.1.dart **
/// {@end-tool}
///
/// See also:
///
/// * [CustomClipper], for information about creating custom clips.