-
Notifications
You must be signed in to change notification settings - Fork 5
Adds custom LongPress gesture recognizer (Resolves #54) #56
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import 'package:flutter/gestures.dart'; | ||
|
||
const Duration _kLongPressTimeout = Duration(milliseconds: 250); | ||
|
||
const double _kTouchSlop = 5.0; | ||
|
||
class CustomLongPressGestureRecognizer extends LongPressGestureRecognizer { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's avoid naming things as "Custom" - that doesn't tell us anything about why we created this, or what it does differently. Also, always include useful Dart Docs for public classes. |
||
CustomLongPressGestureRecognizer({ | ||
Duration? duration, | ||
super.postAcceptSlopTolerance, | ||
super.supportedDevices, | ||
super.debugOwner, | ||
AllowedButtonsFilter? allowedButtonsFilter, | ||
}) : super( | ||
duration: duration ?? _kLongPressTimeout, | ||
allowedButtonsFilter: allowedButtonsFilter, | ||
); | ||
|
||
@override | ||
// TODO: implement preAcceptSlopTolerance | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this "TODO" still valid? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No. Will be removed. |
||
double? get preAcceptSlopTolerance => _kTouchSlop; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's stick constants below the class. No need to litter the top of this file with random values.
Please don't use leading "k"s, those "k"s don't tell us anything useful.
Please document each global property.