Skip to content

Commit e6a6a47

Browse files
authored
Mention SelectionArea in SelectableText docs (flutter#143784)
Most users should be using SelectionArea over SelectableText, so this makes that more clear/discoverable in the docs.
1 parent 3095c11 commit e6a6a47

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

packages/flutter/lib/src/material/selectable_text.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ class _SelectableTextSelectionGestureDetectorBuilder extends TextSelectionGestur
151151

152152
/// A run of selectable text with a single style.
153153
///
154+
/// Consider using [SelectionArea] or [SelectableRegion] instead, which enable
155+
/// selection on a widget subtree, including but not limited to [Text] widgets.
156+
///
154157
/// The [SelectableText] widget displays a string of text with a single style.
155158
/// The string might break across multiple lines or might all be displayed on
156159
/// the same line depending on the layout constraints.
@@ -214,6 +217,8 @@ class _SelectableTextSelectionGestureDetectorBuilder extends TextSelectionGestur
214217
///
215218
/// * [Text], which is the non selectable version of this widget.
216219
/// * [TextField], which is the editable version of this widget.
220+
/// * [SelectionArea], which enables the selection of multiple [Text] widgets
221+
/// and of other widgets.
217222
class SelectableText extends StatefulWidget {
218223
/// Creates a selectable text widget.
219224
///

packages/flutter/lib/src/material/selection_area.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import 'theme.dart';
3535
/// See also:
3636
///
3737
/// * [SelectableRegion], which provides an overview of the selection system.
38+
/// * [SelectableText], which enables selection on a single run of text.
3839
class SelectionArea extends StatefulWidget {
3940
/// Creates a [SelectionArea].
4041
///

packages/flutter/lib/src/widgets/selectable_region.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ const double _kSelectableVerticalComparingThreshold = 3.0;
195195
///
196196
/// * [SelectionArea], which creates a [SelectableRegion] with
197197
/// platform-adaptive selection controls.
198+
/// * [SelectableText], which enables selection on a single run of text.
198199
/// * [SelectionHandler], which contains APIs to handle selection events from the
199200
/// [SelectableRegion].
200201
/// * [Selectable], which provides API to participate in the selection system.

0 commit comments

Comments
 (0)