scrollSignalData static method

Map<String, Object?> scrollSignalData(
  1. PostActionState post,
  2. ({String category, bool? changed}) merged,
  3. double? movedPx
)

The reply data for a scroll: post with the merged signal, dropping unknownReason once movement decided changed.

Implementation

static Map<String, Object?> scrollSignalData(
    PostActionState post, ({bool? changed, String category}) merged, double? movedPx) {
  final data = post.toData();
  if (merged.changed != null) {
    data
      ..['changed'] = merged.changed
      ..remove('unknownReason');
  }
  return {
    ...data,
    'changeCategory': merged.category,
    if (movedPx != null) 'scrolledPx': movedPx.round(),
  };
}