checkForScroll method
Implementation
Future<void> checkForScroll() async {
if (scrollCapture != null) {
final _Swipe swipe = scrollCapture!;
scrollCapture = null;
if (swipe.getUpdatePosition != null && swipe.velocity != null) {
final Offset? start = swipe.getStartPosition;
final Offset? end = swipe.getUpdatePosition;
final Velocity? velocity = swipe.velocity;
final String direction = swipe.direction;
tlLogger.v(
'Scrollable start timestamp: ${swipe.getStartTimestampString()}');
tlLogger.v(
'Scrollable, start: ${start?.dx},${start?.dy}, end: ${end?.dx},${end?.dy}, velocity: $velocity, direction: $direction');
logWidgetTree().then((result) async {
// TODO: missing context?
// var touchedTarget = findTouchedWidget(context, details.position);
await PluginTealeaf.onTlGestureEvent(
gesture: 'swipe',
id: '../Scrollable',
target: 'Scrollable',
data: <String, dynamic>{
'pointer1': {
'dx': start?.dx,
'dy': start?.dy,
'ts': swipe.getStartTimestampString()
},
'pointer2': {
'dx': end?.dx,
'dy': end?.dy,
'ts': swipe.getUpdateTimestampString()
},
'velocity': {
'dx': velocity?.pixelsPerSecond.dx,
'dy': velocity?.pixelsPerSecond.dy
},
'direction': direction,
},
layoutParameters: result);
}).catchError((error) {
// Handle errors if the async function throws an error
tlLogger.e('Error: $error');
});
} else {
tlLogger.v('Incomplete scroll before frame');
}
}
}