Commit bec1b9a1 authored by Hey24sheep's avatar Hey24sheep Committed by Shi-Hao Hong

Optimize gesture recognizer instantiation (#35979)

parent 13382f41
...@@ -268,13 +268,14 @@ class LongPressGestureRecognizer extends PrimaryPointerGestureRecognizer { ...@@ -268,13 +268,14 @@ class LongPressGestureRecognizer extends PrimaryPointerGestureRecognizer {
void _checkLongPressStart() { void _checkLongPressStart() {
assert(_initialButtons == kPrimaryButton); assert(_initialButtons == kPrimaryButton);
final LongPressStartDetails details = LongPressStartDetails( if (onLongPressStart != null) {
globalPosition: _longPressOrigin.global, final LongPressStartDetails details = LongPressStartDetails(
localPosition: _longPressOrigin.local, globalPosition: _longPressOrigin.global,
); localPosition: _longPressOrigin.local,
if (onLongPressStart != null) );
invokeCallback<void>('onLongPressStart', invokeCallback<void>('onLongPressStart',
() => onLongPressStart(details)); () => onLongPressStart(details));
}
if (onLongPress != null) if (onLongPress != null)
invokeCallback<void>('onLongPress', onLongPress); invokeCallback<void>('onLongPress', onLongPress);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment