Skip to content

Commit

Permalink
Mention SelectionArea in SelectableText docs (#143784)
Browse files Browse the repository at this point in the history
Most users should be using SelectionArea over SelectableText, so this makes that more clear/discoverable in the docs.
  • Loading branch information
justinmc authored Feb 28, 2024
1 parent 3095c11 commit e6a6a47
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/flutter/lib/src/material/selectable_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ class _SelectableTextSelectionGestureDetectorBuilder extends TextSelectionGestur

/// A run of selectable text with a single style.
///
/// Consider using [SelectionArea] or [SelectableRegion] instead, which enable
/// selection on a widget subtree, including but not limited to [Text] widgets.
///
/// The [SelectableText] widget displays a string of text with a single style.
/// The string might break across multiple lines or might all be displayed on
/// the same line depending on the layout constraints.
Expand Down Expand Up @@ -214,6 +217,8 @@ class _SelectableTextSelectionGestureDetectorBuilder extends TextSelectionGestur
///
/// * [Text], which is the non selectable version of this widget.
/// * [TextField], which is the editable version of this widget.
/// * [SelectionArea], which enables the selection of multiple [Text] widgets
/// and of other widgets.
class SelectableText extends StatefulWidget {
/// Creates a selectable text widget.
///
Expand Down
1 change: 1 addition & 0 deletions packages/flutter/lib/src/material/selection_area.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import 'theme.dart';
/// See also:
///
/// * [SelectableRegion], which provides an overview of the selection system.
/// * [SelectableText], which enables selection on a single run of text.
class SelectionArea extends StatefulWidget {
/// Creates a [SelectionArea].
///
Expand Down
1 change: 1 addition & 0 deletions packages/flutter/lib/src/widgets/selectable_region.dart
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ const double _kSelectableVerticalComparingThreshold = 3.0;
///
/// * [SelectionArea], which creates a [SelectableRegion] with
/// platform-adaptive selection controls.
/// * [SelectableText], which enables selection on a single run of text.
/// * [SelectionHandler], which contains APIs to handle selection events from the
/// [SelectableRegion].
/// * [Selectable], which provides API to participate in the selection system.
Expand Down

0 comments on commit e6a6a47

Please sign in to comment.