text_editing_intents.dart 10.4 KB
Newer Older
1 2 3 4 5 6
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'actions.dart';

7 8 9
/// An [Intent] to delete a character in the backwards direction.
///
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
10
class DeleteTextIntent extends Intent {
11 12 13 14 15 16 17
  /// Creates an instance of DeleteTextIntent.
  const DeleteTextIntent();
}

/// An [Intent] to delete a word in the backwards direction.
///
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
18
class DeleteByWordTextIntent extends Intent {
19 20 21 22 23 24 25
  /// Creates an instance of DeleteByWordTextIntent.
  const DeleteByWordTextIntent();
}

/// An [Intent] to delete a line in the backwards direction.
///
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
26
class DeleteByLineTextIntent extends Intent {
27 28 29 30 31 32 33
  /// Creates an instance of DeleteByLineTextIntent.
  const DeleteByLineTextIntent();
}

/// An [Intent] to delete in the forward direction.
///
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
34
class DeleteForwardTextIntent extends Intent {
35 36 37 38 39 40 41
  /// Creates an instance of DeleteForwardTextIntent.
  const DeleteForwardTextIntent();
}

/// An [Intent] to delete a word in the forward direction.
///
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
42
class DeleteForwardByWordTextIntent extends Intent {
43 44 45 46 47 48 49
  /// Creates an instance of DeleteByWordTextIntent.
  const DeleteForwardByWordTextIntent();
}

/// An [Intent] to delete a line in the forward direction.
///
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
50
class DeleteForwardByLineTextIntent extends Intent {
51 52 53 54
  /// Creates an instance of DeleteByLineTextIntent.
  const DeleteForwardByLineTextIntent();
}

55 56 57 58 59 60 61 62 63
/// An [Intent] to send the event straight to the engine, but only if a
/// TextEditingTarget is focused.
///
/// {@template flutter.widgets.TextEditingIntents.seeAlso}
/// See also:
///
///   * [DefaultTextEditingActions], which responds to this [Intent].
///   * [DefaultTextEditingShortcuts], which triggers this [Intent].
/// {@endtemplate}
64
class DoNothingAndStopPropagationTextIntent extends Intent {
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
  /// Creates an instance of DoNothingAndStopPropagationTextIntent.
  const DoNothingAndStopPropagationTextIntent();
}

/// An [Intent] to expand the selection left to the start/end of the current
/// line.
///
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
class ExpandSelectionLeftByLineTextIntent extends Intent {
  /// Creates an instance of ExpandSelectionLeftByLineTextIntent.
  const ExpandSelectionLeftByLineTextIntent();
}

/// An [Intent] to expand the selection right to the start/end of the current
/// field.
///
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
82
class ExpandSelectionRightByLineTextIntent extends Intent {
83 84 85 86 87 88 89
  /// Creates an instance of ExpandSelectionRightByLineTextIntent.
  const ExpandSelectionRightByLineTextIntent();
}

/// An [Intent] to expand the selection to the end of the field.
///
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
90
class ExpandSelectionToEndTextIntent extends Intent {
91 92 93 94 95 96 97
  /// Creates an instance of ExpandSelectionToEndTextIntent.
  const ExpandSelectionToEndTextIntent();
}

/// An [Intent] to expand the selection to the start of the field.
///
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
98
class ExpandSelectionToStartTextIntent extends Intent {
99 100 101 102 103 104 105
  /// Creates an instance of ExpandSelectionToStartTextIntent.
  const ExpandSelectionToStartTextIntent();
}

/// An [Intent] to extend the selection down by one line.
///
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
106
class ExtendSelectionDownTextIntent extends Intent {
107 108 109 110 111 112 113 114
  /// Creates an instance of ExtendSelectionDownTextIntent.
  const ExtendSelectionDownTextIntent();
}

/// An [Intent] to extend the selection left to the start/end of the current
/// line.
///
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
115
class ExtendSelectionLeftByLineTextIntent extends Intent {
116 117 118 119
  /// Creates an instance of ExtendSelectionLeftByLineTextIntent.
  const ExtendSelectionLeftByLineTextIntent();
}

120 121 122 123 124
/// An [Intent] to extend the selection left past the nearest word, collapsing
/// the selection if the order of [TextSelection.extentOffset] and
/// [TextSelection.baseOffset] would reverse.
///
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
125
class ExtendSelectionLeftByWordAndStopAtReversalTextIntent extends Intent {
126 127 128 129
  /// Creates an instance of ExtendSelectionLeftByWordAndStopAtReversalTextIntent.
  const ExtendSelectionLeftByWordAndStopAtReversalTextIntent();
}

130 131 132
/// An [Intent] to extend the selection left past the nearest word.
///
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
133
class ExtendSelectionLeftByWordTextIntent extends Intent {
134 135 136 137 138 139 140 141
  /// Creates an instance of ExtendSelectionLeftByWordTextIntent.
  const ExtendSelectionLeftByWordTextIntent();
}

/// An [Intent] to extend the selection left by one character.
/// platform for the shift + arrow-left key event.
///
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
142
class ExtendSelectionLeftTextIntent extends Intent {
143 144 145 146 147 148 149 150
  /// Creates an instance of ExtendSelectionLeftTextIntent.
  const ExtendSelectionLeftTextIntent();
}

/// An [Intent] to extend the selection right to the start/end of the current
/// line.
///
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
151
class ExtendSelectionRightByLineTextIntent extends Intent {
152 153 154 155
  /// Creates an instance of ExtendSelectionRightByLineTextIntent.
  const ExtendSelectionRightByLineTextIntent();
}

156 157 158 159 160
/// An [Intent] to extend the selection right past the nearest word, collapsing
/// the selection if the order of [TextSelection.extentOffset] and
/// [TextSelection.baseOffset] would reverse.
///
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
161
class ExtendSelectionRightByWordAndStopAtReversalTextIntent extends Intent {
162 163 164 165
  /// Creates an instance of ExtendSelectionRightByWordAndStopAtReversalTextIntent.
  const ExtendSelectionRightByWordAndStopAtReversalTextIntent();
}

166 167 168
/// An [Intent] to extend the selection right past the nearest word.
///
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
169
class ExtendSelectionRightByWordTextIntent extends Intent {
170 171 172 173 174 175 176
  /// Creates an instance of ExtendSelectionRightByWordTextIntent.
  const ExtendSelectionRightByWordTextIntent();
}

/// An [Intent] to extend the selection right by one character.
///
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
177
class ExtendSelectionRightTextIntent extends Intent {
178 179 180 181 182 183 184
  /// Creates an instance of ExtendSelectionRightTextIntent.
  const ExtendSelectionRightTextIntent();
}

/// An [Intent] to extend the selection up by one line.
///
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
185
class ExtendSelectionUpTextIntent extends Intent {
186 187 188 189 190 191 192
  /// Creates an instance of ExtendSelectionUpTextIntent.
  const ExtendSelectionUpTextIntent();
}

/// An [Intent] to move the selection down by one line.
///
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
193
class MoveSelectionDownTextIntent extends Intent {
194 195 196 197 198 199 200
  /// Creates an instance of MoveSelectionDownTextIntent.
  const MoveSelectionDownTextIntent();
}

/// An [Intent] to move the selection left by one line.
///
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
201
class MoveSelectionLeftByLineTextIntent extends Intent {
202 203 204 205 206 207 208
  /// Creates an instance of MoveSelectionLeftByLineTextIntent.
  const MoveSelectionLeftByLineTextIntent();
}

/// An [Intent] to move the selection left past the nearest word.
///
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
209
class MoveSelectionLeftByWordTextIntent extends Intent {
210 211 212 213 214 215 216
  /// Creates an instance of MoveSelectionLeftByWordTextIntent.
  const MoveSelectionLeftByWordTextIntent();
}

/// An [Intent] to move the selection left by one character.
///
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
217
class MoveSelectionLeftTextIntent extends Intent {
218 219 220 221 222 223 224
  /// Creates an instance of MoveSelectionLeftTextIntent.
  const MoveSelectionLeftTextIntent();
}

/// An [Intent] to move the selection to the start of the field.
///
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
225
class MoveSelectionToStartTextIntent extends Intent {
226 227 228 229 230 231 232
  /// Creates an instance of MoveSelectionToStartTextIntent.
  const MoveSelectionToStartTextIntent();
}

/// An [Intent] to move the selection right by one line.
///
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
233
class MoveSelectionRightByLineTextIntent extends Intent {
234 235 236 237 238 239 240
  /// Creates an instance of MoveSelectionRightByLineTextIntent.
  const MoveSelectionRightByLineTextIntent();
}

/// An [Intent] to move the selection right past the nearest word.
///
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
241
class MoveSelectionRightByWordTextIntent extends Intent {
242 243 244 245 246 247 248
  /// Creates an instance of MoveSelectionRightByWordTextIntent.
  const MoveSelectionRightByWordTextIntent();
}

/// An [Intent] to move the selection right by one character.
///
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
249
class MoveSelectionRightTextIntent extends Intent {
250 251 252 253 254 255 256
  /// Creates an instance of MoveSelectionRightTextIntent.
  const MoveSelectionRightTextIntent();
}

/// An [Intent] to move the selection to the end of the field.
///
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
257
class MoveSelectionToEndTextIntent extends Intent {
258 259 260 261 262 263 264
  /// Creates an instance of MoveSelectionToEndTextIntent.
  const MoveSelectionToEndTextIntent();
}

/// An [Intent] to move the selection up by one character.
///
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
265
class MoveSelectionUpTextIntent extends Intent {
266 267 268
  /// Creates an instance of MoveSelectionUpTextIntent.
  const MoveSelectionUpTextIntent();
}
269 270 271 272

/// An [Intent] to select everything in the field.
///
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
273
class SelectAllTextIntent extends Intent {
274 275 276
  /// Creates an instance of SelectAllTextIntent.
  const SelectAllTextIntent();
}
277 278 279 280

/// An [Intent] to copy selection in the field.
///
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
281
class CopySelectionTextIntent extends Intent {
282 283 284 285 286 287 288
  /// Creates an instance of CopyTextIntent.
  const CopySelectionTextIntent();
}

/// An [Intent] to cut selection in the field.
///
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
289
class CutSelectionTextIntent extends Intent {
290 291 292 293 294 295 296
  /// Creates an instance of CutTextIntent.
  const CutSelectionTextIntent();
}

/// An [Intent] to paste text from [Clipboard] to the field.
///
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
297
class PasteTextIntent extends Intent {
298 299 300
  /// Creates an instance of PasteTextIntent.
  const PasteTextIntent();
}