If you are not implementing the abstract class TextSelectionDelegate or class EditableTextState, this will not affect you.
We would like to introduce four required getter methods to the abstract class TextSelectionDelegate. The four getter methods are cutEnabled, copyEnabled, pasteEnabled, selectAllEnabled.
The proposed idea is that any class implementing this abstract class using the ‘with’ keyword will also need to implement these four getter methods.
Currently, the selection context menu shows cut, copy, paste, and selectAll options based on the state of the text. This is not sufficient when we introduce a read-only text field. We would like to have explicit control over which options are disabled or enabled.
https://github.com/flutter/flutter/issues/14014
https://github.com/flutter/flutter/issues/5422
If you have a State class that implements TextSelectionDelegate, you can fix it by implementing the four getter methods
class CustomWidgetState extends State<CustomWidget> implements TextSelectionDelegate {
// …..
// ……
// Add the following four getter methods.
@override
bool get cutEnabled {
// Customized logic if you want to conditionally turn off cut.
return true
}
@override
bool get copyEnabled {
// Customized logic if you want to conditionally turn off copy.
return true
}
@override
bool get pasteEnabled {
// Customized logic if you want to conditionally turn off paste.
return true
}
@override
bool get selectAllEnabled {
// Customized logic if you want to conditionally turn off selectAll.
return true
}
}
Please reach out if this change would be a problem for you. You can reply to https://github.com/flutter/flutter/issues/14014.
Cheers,
Chun-Heng