Unverified Commit 07fdadd1 authored by Gary Qian's avatar Gary Qian Committed by GitHub

Add gradient text docs (#36579)

parent 1cb6b8bb
...@@ -166,7 +166,7 @@ const String _kColorBackgroundWarning = 'Cannot provide both a backgroundColor a ...@@ -166,7 +166,7 @@ const String _kColorBackgroundWarning = 'Cannot provide both a backgroundColor a
/// ``` /// ```
/// {@end-tool} /// {@end-tool}
/// ///
/// ### Borders and stroke /// ### Borders and stroke (Foreground)
/// ///
/// {@tool sample} /// {@tool sample}
/// To create bordered text, a [Paint] with [Paint.style] set to [PaintingStyle.stroke] /// To create bordered text, a [Paint] with [Paint.style] set to [PaintingStyle.stroke]
...@@ -202,6 +202,34 @@ const String _kColorBackgroundWarning = 'Cannot provide both a backgroundColor a ...@@ -202,6 +202,34 @@ const String _kColorBackgroundWarning = 'Cannot provide both a backgroundColor a
/// ``` /// ```
/// {@end-tool} /// {@end-tool}
/// ///
/// ### Gradients (Foreground)
///
/// {@tool sample}
/// The [foreground] property also allows effects such as gradients to be
/// applied to the text. Here we provide a [Paint] with a [ui.Gradient]
/// shader.
///
/// ![Text gradient](https://flutter.github.io/assets-for-api-docs/assets/widgets/text_gradient.png)
///
/// ```dart
/// Text(
/// 'Greetings, planet!',
/// style: TextStyle(
/// fontSize: 40,
/// foreground: Paint()
/// ..shader = ui.Gradient.linear(
/// const Offset(0, 20),
/// const Offset(150, 20),
/// <Color>[
/// Colors.red,
/// Colors.yellow,
/// ],
/// )
/// ),
/// )
/// ```
/// {@end-tool}
///
/// ### Custom Fonts /// ### Custom Fonts
/// ///
/// Custom fonts can be declared in the `pubspec.yaml` file as shown below: /// Custom fonts can be declared in the `pubspec.yaml` file as shown below:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment