diff --git a/packages/flutter/lib/src/widgets/basic.dart b/packages/flutter/lib/src/widgets/basic.dart index 5b37a78bcd..7b2e53e11b 100644 --- a/packages/flutter/lib/src/widgets/basic.dart +++ b/packages/flutter/lib/src/widgets/basic.dart @@ -150,6 +150,22 @@ abstract class _UbiquitousInheritedWidget extends InheritedWidget { /// /// For example, [Padding] depends on the [Directionality] to resolve /// [EdgeInsetsDirectional] objects into absolute [EdgeInsets] objects. +/// +/// {@tool snippet} +/// +/// This example uses a right-to-left [TextDirection] and draws a blue box with +/// a right margin of 8 pixels. +/// +/// ```dart +/// Directionality( +/// textDirection: TextDirection.rtl, +/// child: Container( +/// margin: const EdgeInsetsDirectional.only(start: 8), +/// color: Colors.blue, +/// ), +/// ) +/// ``` +/// {@end-tool} class Directionality extends _UbiquitousInheritedWidget { /// Creates a widget that determines the directionality of text and /// text-direction-sensitive render objects.