Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/src/extended_editable_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ class ExtendedEditableText extends StatefulWidget {
this.enableIMEPersonalizedLearning = true,
this.showToolbarInWeb = false,
this.scribbleEnabled = true,
this.customPasteAction = false,
}) : assert(controller != null),
assert(focusNode != null),
assert(obscuringCharacter != null && obscuringCharacter.length == 1),
Expand Down Expand Up @@ -1035,6 +1036,9 @@ class ExtendedEditableText extends StatefulWidget {
/// {@macro flutter.services.TextInputConfiguration.enableIMEPersonalizedLearning}
final bool enableIMEPersonalizedLearning;

///Set to True if you want to monitor keyboard paste operations externally and handle them yourself
final bool customPasteAction;

// Infer the keyboard type of an `EditableText` if it's not specified.
static TextInputType _inferKeyboardType({
required Iterable<String>? autofillHints,
Expand Down Expand Up @@ -1410,7 +1414,7 @@ class ExtendedEditableTextState extends State<ExtendedEditableText>
/// Paste text from [Clipboard].
@override
Future<void> pasteText(SelectionChangedCause cause) async {
if (widget.readOnly) {
if (widget.readOnly || widget.customPasteAction) {
return;
}
final TextSelection selection = textEditingValue.selection;
Expand Down
5 changes: 5 additions & 0 deletions lib/src/extended_text_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ class ExtendedTextField extends StatefulWidget {
this.scribbleEnabled = true,
this.enableIMEPersonalizedLearning = true,
this.shouldShowSelectionHandles,
this.customPasteAction = false,
this.textSelectionGestureDetectorBuilder,
}) : assert(textAlign != null),
assert(readOnly != null),
Expand Down Expand Up @@ -704,6 +705,9 @@ class ExtendedTextField extends StatefulWidget {
/// {@macro flutter.services.TextInputConfiguration.enableIMEPersonalizedLearning}
final bool enableIMEPersonalizedLearning;

///Set to True if you want to monitor keyboard paste operations externally and handle them yourself
final bool customPasteAction;

@override
ExtendedTextFieldState createState() => ExtendedTextFieldState();

Expand Down Expand Up @@ -1357,6 +1361,7 @@ class ExtendedTextFieldState extends State<ExtendedTextField>
scribbleEnabled: widget.scribbleEnabled,
enableIMEPersonalizedLearning: widget.enableIMEPersonalizedLearning,
showToolbarInWeb: _selectionGestureDetectorBuilder.showToolbarInWeb,
customPasteAction: widget.customPasteAction,
),
),
);
Expand Down