checkDeleteElement method

void checkDeleteElement(
  1. StoryElement storyElement,
  2. Size screen
)

delete StoryElement from assets when it's out of the screen

Implementation

void checkDeleteElement(StoryElement storyElement, Size screen) {
  if (storyElement.type == ItemType.video) return;
  if (storyElement.position.dy * screen.height > screen.height - 90) {
    assets.removeAsset(storyElement);
    onElementDeleted?.call(storyElement);
  }
}