Flutter应用在更新到3.10版本后,使用Gesture Detectors出现了构建问题。

huangapple go评论63阅读模式
英文:

Flutter App Build Issue after updating to 3.10 with Gesture Detectors

问题

After updating from 3.7 to 3.10,我遇到了与手势检测器相关的构建问题。以下是代码部分,它抱怨以下内容:

TextSelectionGestureDetector buildGestureDetector({
    Key? key,
    HitTestBehavior? behavior,
    required Widget child,
  }) =>
      TextSelectionGestureDetector(
        key: key,
        onTapDown: onTapDown,
        onForcePressStart:
            delegate.forcePressEnabled ? onForcePressStart : null,
        onForcePressEnd: delegate.forcePressEnabled ? onForcePressEnd : null,
        onSingleTapUp: onSingleTapUp,
        onSingleTapCancel: onSingleTapCancel,
        onSingleLongTapStart: onSingleLongTapStart,
        onSingleLongTapMoveUpdate: onSingleLongTapMoveUpdate,
        onSingleLongTapEnd: onSingleLongTapEnd,
        onDoubleTapDown: onDoubleTapDown,
        onDragSelectionStart: onDragSelectionStart,
        onDragSelectionUpdate: onDragSelectionUpdate,
        onDragSelectionEnd: onDragSelectionEnd,
        behavior: behavior,
        child: child,
      );

我还在另一个包中遇到了accentColor的问题,但通过编辑它(尽管它是一个pub包而不是我的代码)我解决了这个问题。在Breaking Changes中没有提到这一点。

有人之前遇到过这个问题吗?是否有解决方案?

我已经尝试了以下方法:

  • flutter clean
  • flutter pub upgrade
  • flutter pub upgrade --major-versions
  • flutter create
英文:

After updating from 3.7 to 3.10 I am receiving build issues that appear to be related to Gesture Detectors.

Trace output(https://i.stack.imgur.com/j0Uwi.png)

This is an added package of course and when I look at the code is it complains about this

`

TextSelectionGestureDetector buildGestureDetector({
    Key? key,
    HitTestBehavior? behavior,
    required Widget child,
  }) =>
      TextSelectionGestureDetector(
        key: key,
        onTapDown: onTapDown,
        onForcePressStart:
            delegate.forcePressEnabled ? onForcePressStart : null,
        onForcePressEnd: delegate.forcePressEnabled ? onForcePressEnd : null,
        onSingleTapUp: onSingleTapUp,
        onSingleTapCancel: onSingleTapCancel,
        onSingleLongTapStart: onSingleLongTapStart,
        onSingleLongTapMoveUpdate: onSingleLongTapMoveUpdate,
        onSingleLongTapEnd: onSingleLongTapEnd,
        onDoubleTapDown: onDoubleTapDown,
        onDragSelectionStart: onDragSelectionStart,
        onDragSelectionUpdate: onDragSelectionUpdate,
        onDragSelectionEnd: onDragSelectionEnd,
        behavior: behavior,
        child: child,
      );`

I also had an issue with accentColor in another package but I was able to resolve that by editing it (even though it was a pub package and not my code). There is no mention of this in breaking changes though.

Has anyone seen this before and is there a solution?

Cheers,

I have tried the following

  • flutter clean
  • flutter pub upgrade
  • flutter pub upgrade --major-versions
  • flutter create

答案1

得分: 1

问题导致错误的原因似乎与包flutter_math_fork 0.5.0有关。请检查您的pubspec.yaml文件,查看是否有任何依赖于flutter_math_fork 0.5.0的包。您可以参考依赖于flutter_math_fork的包的列表这里

在我的情况下,flutter_html包是问题的根源。一旦我从我的pubspec.yaml文件中移除它,应用程序就成功运行了。目前尚不清楚解决此问题的责任是由flutter_html的维护人员还是由Flutter团队负责。

英文:

It appears that the problem causing the error was related to the package flutter_math_fork 0.5.0. Check your pubspec.yaml file for any packages that may be dependent on flutter_math_fork 0.5.0. You can refer to the list of packages that depend on flutter_math_fork here.

In my case, the flutter_html package was the culprit. Once I removed it from my pubspec.yaml file, the app ran successfully. It's unclear at this time whether the responsibility for fixing this issue lies with the flutter_html maintainer or with the Flutter team itself.

huangapple
  • 本文由 发表于 2023年5月11日 10:10:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/76223687.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定