-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Closed
Copy link
Labels
a: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsfound in release: 3.27Found to occur in 3.27Found to occur in 3.27found in release: 3.28Found to occur in 3.28Found to occur in 3.28frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-text-inputOwned by Text Input teamOwned by Text Input team
Description
I open this issue because the original one #117329 was closed without a proper solution.
The method onPaste from ContextMenuBuilder is not getting called when certain paste events are being triggered, specifically when pasting text using the toolbar of the keyboard or when accessing the clipboard itself from the keyboard.
Steps to reproduce
Run the code example and try to catch the paste event from the keyboard toolbar.
Expected results
onPaste should get called whenever a paste event occurs no matter the origin.
Actual results
onPaste gets called when you paste content through the floating toolbar (the one that shows when long pressing a TextField), but it doesn't execute when you paste content through the keyboard's toolbar
Code sample
Code sample
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: TextField(
contextMenuBuilder: (context, editableTextState) {
return AdaptiveTextSelectionToolbar.editable(
anchors: editableTextState.contextMenuAnchors,
clipboardStatus: ClipboardStatus.pasteable,
onLiveTextInput: null,
onLookUp: null,
onSearchWeb: null,
onShare: null,
onCopy: null,
onCut: null,
onPaste: () {
print('ON PASTE');
},
onSelectAll: null,
);
},
),
),
);
}
}Screenshots or Video
Screenshots / Video demonstration
AYYZxbD6gG.mp4
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.27.1, on Microsoft Windows [Versi¢n 10.0.26120.2705], locale es-MX)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.5.0)
[√] Android Studio (version 2024.2)
[√] VS Code (version 1.89.1)
[√] Connected device (4 available)
[√] Network resourcesMetadata
Metadata
Assignees
Labels
a: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsfound in release: 3.27Found to occur in 3.27Found to occur in 3.27found in release: 3.28Found to occur in 3.28Found to occur in 3.28frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-text-inputOwned by Text Input teamOwned by Text Input team