Skip to content

lightbox: Implement drag-to-dismiss #40

Open
@chrisbobbe

Description

@chrisbobbe

The lightbox has an "x" button in its app bar to close it, but it can't be closed with a drag gesture.

I think my ideal version of this would be: you drag or fling the image in any direction, then:

  • if you did it far or fast enough, the image would smoothly take its Hero flight back to the thumbnail in the message list, and the route is popped from the nav.
  • if you didn't drag/fling far/fast enough, the image would move smoothly back into its starting position.

Maybe something like this is possible with the Draggable widget? (Probably it should only respond to drags this way if it's zoomed out all the way. If it's zoomed in, we want the InteractiveViewer to handle panning the image.)

Otherwise, maybe we can make the route dismissable with a drag-down gesture and no Hero animation. For this approach, we can look at the drag-gesture-based CupertinoRouteTransitionMixin, which deals with horizontal drag gestures, and maybe make something like that but for a downward drag gesture.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a-lightboxThe lightbox / image-viewer screen

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions