Small update to the Text.rich API doc (#18721)
This commit is contained in:
parent
c0294e3a02
commit
ba1a18f45c
@ -159,14 +159,10 @@ class DefaultTextStyle extends InheritedWidget {
|
|||||||
///
|
///
|
||||||
/// The [style] argument is optional. When omitted, the text will use the style
|
/// The [style] argument is optional. When omitted, the text will use the style
|
||||||
/// from the closest enclosing [DefaultTextStyle]. If the given style's
|
/// from the closest enclosing [DefaultTextStyle]. If the given style's
|
||||||
/// [TextStyle.inherit] property is true, the given style will be merged with
|
/// [TextStyle.inherit] property is true (the default), the given style will
|
||||||
/// the closest enclosing [DefaultTextStyle]. This merging behavior is useful,
|
/// be merged with the closest enclosing [DefaultTextStyle]. This merging
|
||||||
/// for example, to make the text bold while using the default font family and
|
/// behavior is useful, for example, to make the text bold while using the
|
||||||
/// size.
|
/// default font family and size.
|
||||||
///
|
|
||||||
/// Using the [new Text.rich] constructor, the [Text] widget can also be
|
|
||||||
/// created with a [TextSpan] to display text that use multiple styles
|
|
||||||
/// (e.g., a paragraph with some bold words).
|
|
||||||
///
|
///
|
||||||
/// ## Sample code
|
/// ## Sample code
|
||||||
///
|
///
|
||||||
@ -179,6 +175,25 @@ class DefaultTextStyle extends InheritedWidget {
|
|||||||
/// )
|
/// )
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
|
/// Using the [Text.rich] constructor, the [Text] widget can
|
||||||
|
/// display a paragraph with differently styled [TextSpan]s. The sample
|
||||||
|
/// that follows displays "Hello beautiful world" with different styles
|
||||||
|
/// for each word.
|
||||||
|
///
|
||||||
|
/// ## Sample code
|
||||||
|
///
|
||||||
|
/// ```dart
|
||||||
|
/// const Text.rich(
|
||||||
|
/// const TextSpan(
|
||||||
|
/// text: 'Hello', // default text style
|
||||||
|
/// children: const <TextSpan>[
|
||||||
|
/// const TextSpan(text: ' beautiful ', style: const TextStyle(fontStyle: FontStyle.italic)),
|
||||||
|
/// const TextSpan(text: 'world', style: const TextStyle(fontWeight: FontWeight.bold)),
|
||||||
|
/// ],
|
||||||
|
/// ),
|
||||||
|
/// ),
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
/// ## Interactivity
|
/// ## Interactivity
|
||||||
///
|
///
|
||||||
/// To make [Text] react to touch events, wrap it in a [GestureDetector] widget
|
/// To make [Text] react to touch events, wrap it in a [GestureDetector] widget
|
||||||
|
Loading…
x
Reference in New Issue
Block a user