Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Help] How can i use single tap to dismiss photo_view dialog #182

Closed
karthuszY opened this issue Sep 26, 2019 · 11 comments
Closed

[Help] How can i use single tap to dismiss photo_view dialog #182

karthuszY opened this issue Sep 26, 2019 · 11 comments
Labels
enhancement New feature or request

Comments

@karthuszY
Copy link

I use photo view like this, i don't find a correct way to dismiss this photo view
showDialog(
context: context,
builder: (_) {
return PhotoView(
imageProvider: NetworkImage(
_imageURL,
headers: _httpHeaders),
);
});

@karthuszY
Copy link
Author

@davewang @AlexVegner @memo4mj @SocratesDz
anybody can give some advise?

@renancaraujo
Copy link
Member

Have you tried to wrap it in a GestureDetector with an ontapcallback?

@karthuszY
Copy link
Author

@renancaraujo I have tried but it's no use

@renancaraujo
Copy link
Member

The constructor has an onTapUp and onTapDown` opotions. Those can help you perhaps?

@karthuszY
Copy link
Author

@renancaraujo I had tried this too.It is ambiguity when two fingers to zoom image may cause dismiss

@renancaraujo renancaraujo added the enhancement New feature or request label Oct 15, 2019
@wapchief
Copy link

mark

@renancaraujo
Copy link
Member

Related to #172 and #167

@wapchief
Copy link

Manually add a close button, can be solved

@omishah
Copy link

omishah commented Nov 15, 2019

You can use with Hero() and single touch on photoview will dismiss view automatically.

@renancaraujo
Copy link
Member

Added an example for that on the example app.

ontap

@ssbaval
Copy link

ssbaval commented Nov 22, 2019

One touch example to close the PhotoView that needs to have PINCH/RESIZE support doesnt work if wrapped in a dialog and using PhotoView.customChild - when trying to pinch to resize a small custom ICON (i.e an IconData) - the dialog closes

i.e :


    showDialog(    
        context: context,
        builder: (context) {
          return OneTapWrapper(
            container: container,
          );
        });


class OneTapWrapper extends StatelessWidget {
  const OneTapWrapper({
    this.container,
  });

  final Widget container;

  @override
  Widget build(BuildContext context) {
    return Container(
      constraints: BoxConstraints.expand(
        height: MediaQuery.of(context).size.height,
      ),
      child: GestureDetector(
          onTapDown: (_) {
            Navigator.pop(context);
          },
          child: PhotoView.customChild(
            customSize: Size(1000, 1000),
            child: container,
            tightMode: true,
            enableRotation: true,
            backgroundDecoration: BoxDecoration(color: Colors.black54),
          )),
    );
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants