Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
ba1a18f4
Unverified
Commit
ba1a18f4
authored
Jul 18, 2018
by
Hans Muller
Committed by
GitHub
Jul 18, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small update to the Text.rich API doc (#18721)
parent
c0294e3a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
8 deletions
+23
-8
text.dart
packages/flutter/lib/src/widgets/text.dart
+23
-8
No files found.
packages/flutter/lib/src/widgets/text.dart
View file @
ba1a18f4
...
...
@@ -159,14 +159,10 @@ class DefaultTextStyle extends InheritedWidget {
///
/// The [style] argument is optional. When omitted, the text will use the style
/// from the closest enclosing [DefaultTextStyle]. If the given style's
/// [TextStyle.inherit] property is true, the given style will be merged with
/// the closest enclosing [DefaultTextStyle]. This merging behavior is useful,
/// for example, to make the text bold while using the 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).
/// [TextStyle.inherit] property is true (the default), the given style will
/// be merged with the closest enclosing [DefaultTextStyle]. This merging
/// behavior is useful, for example, to make the text bold while using the
/// default font family and size.
///
/// ## 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
///
/// To make [Text] react to touch events, wrap it in a [GestureDetector] widget
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment