问题:
有复制时
flutter-输入框空白长按不弹出选项
解决:
截屏2020-12-29 15.00.16.png参考:
截屏2022-03-09 10.14.20.png
void _handleSelectionChange(
TextSelection nextSelection,
SelectionChangedCause cause,
) {
// Changes made by the keyboard can sometimes be "out of band" for listening
// components, so always send those events, even if we didn't think it
// changed. Also, focusing an empty field is sent as a selection change even
// if the selection offset didn't change.
final bool focusingEmpty = nextSelection.baseOffset == 0 && nextSelection.extentOffset == 0 && !hasFocus;
//原生代码
// if (nextSelection == selection && cause != SelectionChangedCause.keyboard && !focusingEmpty) {
// return;
// }
//修改后代码
if (nextSelection == selection && nextSelection.end - nextSelection.start > 0) {
return;
}
if (onSelectionChanged != null) {
onSelectionChanged!(nextSelection, this, cause);
}
}
网友评论