createEvent function

Map<String, dynamic> createEvent(
  1. BuildContext context,
  2. PointerDownEvent event,
  3. double scroll,
  4. String path,
  5. Map<String, String>? properties,
)

Implementation

Map<String, dynamic> createEvent(
  BuildContext context,
  PointerDownEvent event,
  double scroll,
  String path,
  Map<String, String>? properties,
) {
  final sizes = getUtilScreenSize(context);
  final double screenWidth = sizes[0];
  final double screenHeight = sizes[1];
  final List<double> pos = positionFromEvent(event.position, context);

  return {
    "x": pos[0],
    "y": pos[1],
    "scroll": scroll,
    "path": path,
    "screenWidth": screenWidth,
    "screenHeight": screenHeight,
    "os": getOS(),
    "createdAt": DateTime.now().toIso8601String(),
    if (properties != null) 'props': properties,
  };
}