canSelectAll method
- @Deprecated('Use `contextMenuBuilder` instead. ' 'This feature was deprecated after v3.3.0-0.5.pre.')
- @override
- TextSelectionDelegate delegate
override
Whether the current selection of the text field managed by the given
delegate
can be extended to include the entire content of the text
field.
Subclasses can use this to decide if they should expose the select all functionality to the user.
Implementation
@Deprecated(
'Use `contextMenuBuilder` instead. '
'This feature was deprecated after v3.3.0-0.5.pre.',
)
@override
bool canSelectAll(TextSelectionDelegate delegate) {
// Allow SelectAll when selection is not collapsed, unless everything has
// already been selected. Same behavior as Android.
final TextEditingValue value = delegate.textEditingValue;
return delegate.selectAllEnabled &&
value.text.isNotEmpty &&
!(value.selection.start == 0 && value.selection.end == value.text.length);
}