@@ -19,6 +19,8 @@ TextSelection localSelection(Node node, TextSelection selection, fromParent) {
19
19
extentOffset: math.min (selection.end - offset, node.length - 1 ));
20
20
}
21
21
22
+ /// The text position that a give selection handle manipulates. Dragging the
23
+ /// [start] handle always moves the [start] /[baseOffset] of the selection.
22
24
enum _TextSelectionHandlePosition { START , END }
23
25
24
26
/// internal use, used to get drag direction information
@@ -56,7 +58,14 @@ class DragTextSelection extends TextSelection {
56
58
}
57
59
}
58
60
61
+ /// An object that manages a pair of text selection handles.
62
+ ///
63
+ /// The selection handles are displayed in the [Overlay] that most closely
64
+ /// encloses the given [BuildContext] .
59
65
class EditorTextSelectionOverlay {
66
+ /// Creates an object that manages overlay entries for selection handles.
67
+ ///
68
+ /// The [context] must not be null and must have an [Overlay] as an ancestor.
60
69
EditorTextSelectionOverlay (
61
70
this .value,
62
71
this .handlesVisible,
@@ -80,16 +89,70 @@ class EditorTextSelectionOverlay {
80
89
81
90
TextEditingValue value;
82
91
bool handlesVisible = false ;
92
+
93
+ /// The context in which the selection handles should appear.
94
+ ///
95
+ /// This context must have an [Overlay] as an ancestor because this object
96
+ /// will display the text selection handles in that [Overlay] .
83
97
final BuildContext context;
98
+
99
+ /// Debugging information for explaining why the [Overlay] is required.
84
100
final Widget debugRequiredFor;
101
+
102
+ /// The object supplied to the [CompositedTransformTarget] that wraps the text
103
+ /// field.
85
104
final LayerLink toolbarLayerLink;
105
+
106
+ /// The objects supplied to the [CompositedTransformTarget] that wraps the
107
+ /// location of start selection handle.
86
108
final LayerLink startHandleLayerLink;
109
+
110
+ /// The objects supplied to the [CompositedTransformTarget] that wraps the
111
+ /// location of end selection handle.
87
112
final LayerLink endHandleLayerLink;
113
+
114
+ /// The editable line in which the selected text is being displayed.
88
115
final RenderEditor ? renderObject;
116
+
117
+ /// Builds text selection handles and toolbar.
89
118
final TextSelectionControls selectionCtrls;
119
+
120
+ /// The delegate for manipulating the current selection in the owning
121
+ /// text field.
90
122
final TextSelectionDelegate selectionDelegate;
123
+
124
+ /// Determines the way that drag start behavior is handled.
125
+ ///
126
+ /// If set to [DragStartBehavior.start] , handle drag behavior will
127
+ /// begin upon the detection of a drag gesture. If set to
128
+ /// [DragStartBehavior.down] it will begin when a down event is first
129
+ /// detected.
130
+ ///
131
+ /// In general, setting this to [DragStartBehavior.start] will make drag
132
+ /// animation smoother and setting it to [DragStartBehavior.down] will make
133
+ /// drag behavior feel slightly more reactive.
134
+ ///
135
+ /// By default, the drag start behavior is [DragStartBehavior.start] .
136
+ ///
137
+ /// See also:
138
+ ///
139
+ /// * [DragGestureRecognizer.dragStartBehavior] ,
140
+ /// which gives an example for the different behaviors.
91
141
final DragStartBehavior dragStartBehavior;
142
+
143
+ /// {@template flutter.widgets.textSelection.onSelectionHandleTapped}
144
+ /// A callback that's invoked when a selection handle is tapped.
145
+ ///
146
+ /// Both regular taps and long presses invoke this callback, but a drag
147
+ /// gesture won't.
148
+ /// {@endtemplate}
92
149
final VoidCallback ? onSelectionHandleTapped;
150
+
151
+ /// Maintains the status of the clipboard for determining if its contents can
152
+ /// be pasted or not.
153
+ ///
154
+ /// Useful because the actual value of the clipboard can only be checked
155
+ /// asynchronously (see [Clipboard.getData] ).
93
156
final ClipboardStatusNotifier clipboardStatus;
94
157
late AnimationController _toolbarController;
95
158
List <OverlayEntry >? _handles;
0 commit comments