【发布时间】:2021-10-28 23:31:22
【问题描述】:
在我的 Flutter Web 应用程序中存在一个错误,在运行时更改应用程序本地化后很少出现,这种动态行为使用 provider 和 flutter_localizations 包实现,如官方文档所述here 并更改 MaterialApp 的 locale 和 darkTheme > fontFamily 属性。
这是使用flutter build web --profile --dart-define=Dart2jsOptimization=O0的堆栈跟踪
Uncaught TypeError: Cannot read property 'getPositionForOffset$1' of null
at RenderParagraph.hitTestChildren$2$position (main.dart.js:96010)
at RenderParagraph.hitTest$2$position (main.dart.js:90914)
at RenderShiftedBox_hitTestChildren_closure.call$2 (main.dart.js:98256)
at BoxHitTestResult.addWithPaintOffset$3$hitTest$offset$position (main.dart.js:90784)
at _RenderAppBarTitleBox.hitTestChildren$2$position (main.dart.js:98249)
at _RenderAppBarTitleBox.hitTest$2$position (main.dart.js:90914)
at RenderSemanticsAnnotations.hitTestChildren$2$position (main.dart.js:96532)
at RenderSemanticsAnnotations.hitTest$2$position (main.dart.js:90914)
at RenderBoxContainerDefaultsMixin_defaultHitTestChildren_closure.call$2 (main.dart.js:91033)
at BoxHitTestResult.addWithPaintOffset$3$hitTest$offset$position (main.dart.js:90784)
或
Uncaught TypeError: Cannot read property 'getPositionForOffset$1' of null
at RenderParagraph.hitTestChildren$2$position (main.dart.js:96020)
at RenderParagraph.hitTest$2$position (main.dart.js:90924)
at RenderShiftedBox_hitTestChildren_closure.call$2 (main.dart.js:98266)
at BoxHitTestResult.addWithPaintOffset$3$hitTest$offset$position (main.dart.js:90794)
at RenderPositionedBox.hitTestChildren$2$position (main.dart.js:98259)
at RenderPositionedBox.hitTest$2$position (main.dart.js:90924)
at RenderConstrainedBox.hitTestChildren$2$position (main.dart.js:96542)
at RenderConstrainedBox.hitTest$2$position (main.dart.js:90924)
at RenderExcludeSemantics.hitTestChildren$2$position (main.dart.js:96542)
at RenderExcludeSemantics.hitTest$2$position
任何帮助将不胜感激
【问题讨论】:
标签: flutter flutter-web