错误:在我的项目中导入颜色选择器包时,方法“AlwaysWinPanGestureRecognizer…”的参数“事件”
欢迎
我在项目中导入flutter_colorpicker 包
时遇到问题:
import 'package:flutter_colorpicker/flutter_colorpicker.dart';
我收到此错误:
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_colorpicker-0.5.0/lib/src/hsv_picker.dart:730:43: Error: The parameter 'event' of the method 'AlwaysWinPanGestureRecognizer.addAllowedPointer' has type 'PointerDownEvent', which does not match the corresponding type, 'PointerEvent', in the overridden method, 'DragGestureRecognizer.addAllowedPointer'.
- 'PointerDownEvent' is from 'package:flutter/src/gestures/events.dart' ('/C:/src/flutter/packages/flutter/lib/src/gestures/events.dart').
- 'PointerEvent' is from 'package:flutter/src/gestures/events.dart' ('/C:/src/flutter/packages/flutter/lib/src/gestures/events.dart').
Change to a supertype of 'PointerEvent', or, for a covariant parameter, a subtype.
void addAllowedPointer(PointerDownEvent event) {
^
/C:/src/flutter/packages/flutter/lib/src/gestures/monodrag.dart:256:8: Context: This is the overridden method ('addAllowedPointer').
void addAllowedPointer(PointerEvent event) {
^
这是颤振医生的结果:
Doctor summary (to see all details, run flutter doctor -v):
[?] Flutter (Channel stable, 2.2.1, on Microsoft Windows [Version 10.0.17763.1577], locale en-US)
[?] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[?] Chrome - develop for the web
[?] Android Studio (version 3.6)
[?] IntelliJ IDEA Community Edition (version 2021.1)
[?] VS Code (version 1.56.2)
[?] Connected device (3 available)
• No issues found!
这是项目的依赖项:
dependencies:
flutter:
sdk: flutter
shared_preferences: ^2.0.6
flutter_colorpicker: ^0.5.0
有没有人有办法解决吗?感谢每一位
回答
只需将 flutter_colorpicker 版本更改为 0.4.0
THE END
二维码