diff --git a/packages/flutter/lib/src/painting/text_style.dart b/packages/flutter/lib/src/painting/text_style.dart index fb9fa670f2..e9f6395f46 100644 --- a/packages/flutter/lib/src/painting/text_style.dart +++ b/packages/flutter/lib/src/painting/text_style.dart @@ -166,6 +166,42 @@ const String _kColorBackgroundWarning = 'Cannot provide both a backgroundColor a /// ``` /// {@end-tool} /// +/// ### Borders and stroke +/// +/// {@tool sample} +/// To create bordered text, a [Paint] with [Paint.style] set to [PaintingStyle.stroke] +/// should be provided as a [foreground] paint. The following example uses a [Stack] +/// to produce a stroke and fill effect. +/// +/// ![Text border](https://flutter.github.io/assets-for-api-docs/assets/widgets/text_border.png) +/// +/// ```dart +/// Stack( +/// children: [ +/// // Stroked text as border. +/// Text( +/// 'Greetings, planet!', +/// style: TextStyle( +/// fontSize: 40, +/// foreground: Paint() +/// ..style = PaintingStyle.stroke +/// ..strokeWidth = 6 +/// ..color = Colors.blue[700], +/// ), +/// ), +/// // Solid text as fill. +/// Text( +/// 'Greetings, planet!', +/// style: TextStyle( +/// fontSize: 40, +/// color: Colors.grey[300], +/// ), +/// ), +/// ], +/// ) +/// ``` +/// {@end-tool} +/// /// ### Custom Fonts /// /// Custom fonts can be declared in the `pubspec.yaml` file as shown below: