flutter-输入框空白长按不弹出选项

问题:

有复制时
flutter-输入框空白长按不弹出选项

解决:

flutter-输入框空白长按不弹出选项

参考:

flutter-输入框空白长按不弹出选项

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);
    }
  }

© 版权声明
THE END
如果内容对您有所帮助,就支持一下吧!
点赞0 分享
评论 共1条

请登录后发表评论