Add example to Directionality docs (#157230)

This commit is contained in:
Loïc Sharma
2024-10-22 15:20:02 -07:00
committed by GitHub
parent bfdb366b50
commit b2026572db

View File

@@ -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.