Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not run project successfully due to void onDoubleTapDown(TapDownDetails details) method argument type #124

Closed
tariqali786 opened this issue Feb 14, 2023 · 13 comments

Comments

@tariqali786
Copy link

tariqali786 commented Feb 14, 2023

/C:/Users/User/AppData/Local/Pub/Cache/hosted/pub.dev/pinput-2.2.23/lib/src/widgets/_pinput_selection_gesture_detector_builder.dart:20:39: Error: The parameter 'details' of the method '_PinputSelectionGestureDetectorBuilder.onDoubleTapDown' has type 'TapDownDetails', which does not match the corresponding type, 'TapDragDownDetails', in the overridden method, 'TextSelectionGestureDetectorBuilder.onDoubleTapDown'.

  • 'TapDownDetails' is from 'package:flutter/src/gestures/tap.dart' ('/C:/Users/User/flutter/packages/flutter/lib/src/gestures/tap.dart').
  • 'TapDragDownDetails' is from 'package:flutter/src/widgets/tap_and_drag_gestures.dart' ('/C:/Users/User/flutter/packages/flutter/lib/src/widgets/tap_and_drag_gestures.dart').
    Change to a supertype of 'TapDragDownDetails', or, for a covariant parameter, a subtype.
    void onDoubleTapDown(TapDownDetails details) {
    ^
    /C:/Users/User/flutter/packages/flutter/lib/src/widgets/text_selection.dart:2431:8: Context: This is the overridden method ('onDoubleTapDown').
    void onDoubleTapDown(TapDragDownDetails details) {
    ^
    /C:/Users/User/AppData/Local/Pub/Cache/hosted/pub.dev/pinput-2.2.23/lib/src/widgets/_pinput_selection_gesture_detector_builder.dart:27:35: Error: The parameter 'details' of the method '_PinputSelectionGestureDetectorBuilder.onSingleTapUp' has type 'TapUpDetails', which does not match the corresponding type, 'TapDragUpDetails', in the overridden method, 'TextSelectionGestureDetectorBuilder.onSingleTapUp'.
  • 'TapUpDetails' is from 'package:flutter/src/gestures/tap.dart' ('/C:/Users/User/flutter/packages/flutter/lib/src/gestures/tap.dart').
  • 'TapDragUpDetails' is from 'package:flutter/src/widgets/tap_and_drag_gestures.dart' ('/C:/Users/User/flutter/packages/flutter/lib/src/widgets/tap_and_drag_gestures.dart').
    Change to a supertype of 'TapDragUpDetails', or, for a covariant parameter, a subtype.
    void onSingleTapUp(TapUpDetails details) {
    ^
    /C:/Users/User/flutter/packages/flutter/lib/src/widgets/text_selection.dart:2144:8: Context: This is the overridden method ('onSingleTapUp').
    void onSingleTapUp(TapDragUpDetails details) {
    ^
    /C:/Users/User/AppData/Local/Pub/Cache/hosted/pub.dev/pinput-2.2.23/lib/src/widgets/_pinput_selection_gesture_detector_builder.dart:28:25: Error: The argument type 'TapUpDetails' can't be assigned to the parameter type 'TapDragUpDetails'.
  • 'TapUpDetails' is from 'package:flutter/src/gestures/tap.dart' ('/C:/Users/User/flutter/packages/flutter/lib/src/gestures/tap.dart').
  • 'TapDragUpDetails' is from 'package:flutter/src/widgets/tap_and_drag_gestures.dart' ('/C:/Users/User/flutter/packages/flutter/lib/src/widgets/tap_and_drag_gestures.dart').
    super.onSingleTapUp(details);
    ^

After changing the method arguments in package class
From
@OverRide
void onDoubleTapDown(TapDownDetails details) {
if (shouldShowSelectionToolbar) {
editableText.showToolbar();
}
}

@OverRide
void onSingleTapUp(TapUpDetails details) {
super.onSingleTapUp(details);
editableText.hideToolbar();
_state._requestKeyboard();
_state.widget.onTap?.call();
}

To

@OverRide
void onDoubleTapDown(TapDragDownDetails details) {
if (shouldShowSelectionToolbar) {
editableText.showToolbar();
}
}

@OverRide
void onSingleTapUp(TapDragUpDetails details) {
super.onSingleTapUp(details);
editableText.hideToolbar();
_state._requestKeyboard();
_state.widget.onTap?.call();
}

after that I successfully run the project . Please solve this in package or guide me what I am missing.

@Tkko
Copy link
Owner

Tkko commented Feb 14, 2023

Hey @tariqali786, could you share the output of the flutter --version

@tariqali786
Copy link
Author

Flutter 3.8.0-9.0.pre.1 • channel master • https://github.com/flutter/flutter.git
Framework • revision b1c4d5686e (5 days ago) • 2023-02-08 16:55:05 -0800
Engine • revision 89c8a1393d
Tools • Dart 3.0.0 (build 3.0.0-215.0.dev) • DevTools 2.21.1

@Tkko
Copy link
Owner

Tkko commented Feb 14, 2023

Is is possible to switch to the stable channel?
It seems like the TapDragDownDetails is newly added in the Flutter's master branch

@teewhydope
Copy link

same issue. i think i need to downgrade

@Tkko
Copy link
Owner

Tkko commented Feb 14, 2023

Switching to Flutter's stable channel will solve the issue, meanwhile I'll align my code to Flutter's master branch and let you know

@raldhafiri
Copy link

I have a simple solution to made it work on both stable and master channel
https://github.com/raldhafiri/Flutter_Pinput.git

solution was by changing "TapDownDetails" and "TapUpDetails" to "dynamic"

@Tkko
Copy link
Owner

Tkko commented Feb 15, 2023

BTW guys why do you use the master channel?

@raldhafiri
Copy link

I am working in big project and we are using this amazing package .. we build and test for both channels

@teewhydope
Copy link

BTW guys why do you use the master channel?

To test out dart 3.0 features

@Tkko
Copy link
Owner

Tkko commented Feb 15, 2023

Pushed the update
Version 2.2.30

@raldhafiri
Copy link

Thanks and much appericated

@teewhydope
Copy link

Thanks for the quick fix

@tariqali786
Copy link
Author

Thank you!

@Tkko Tkko closed this as completed Feb 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants