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

Tap callbacks in PhotoViewGalleryPageOptions #146

Closed
ghost opened this issue May 24, 2019 · 5 comments
Closed

Tap callbacks in PhotoViewGalleryPageOptions #146

ghost opened this issue May 24, 2019 · 5 comments
Labels
enhancement New feature or request

Comments

@ghost
Copy link

ghost commented May 24, 2019

Like PhotoView, PhotoViewGalleryPageOptions should have tap callbacks (onTapUp and onTapDown).

Giving a context, the gallery of my app shows/hides AppBar on user tap, just like WhatsApp.

@renancaraujo
Copy link
Member

Great catch!
That should not be complex tackle.

@renancaraujo renancaraujo added the enhancement New feature or request label May 25, 2019
@renancaraujo
Copy link
Member

A fix for that has been included on master, since photoview 0.4.0 is not yet beta compatible, I wont publish any release for now. However, you can depend directly on our master to get that enhancement.

@ghost
Copy link
Author

ghost commented Jul 11, 2019

@renancaraujo Also, I tried depend directly on master and #150 seems to be fixed, but the callbacks that you added to fix this issue are never called.

You can run the code below and check that "onTapUp" and "onTapDown" are never printed:

import 'package:flutter/material.dart';
import 'package:photo_view/photo_view_gallery.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(body: Foo()),
    );
  }
}

class Foo extends StatelessWidget {
  static const List<String> images = [
    'https://homepages.cae.wisc.edu/~ece533/images/peppers.png',
    'https://homepages.cae.wisc.edu/~ece533/images/baboon.png',
    'https://homepages.cae.wisc.edu/~ece533/images/girl.png',
  ];

  @override
  Widget build(BuildContext context) {
    return PhotoViewGallery.builder(
      itemCount: images.length,
      builder: (_, int index) {
        return PhotoViewGalleryPageOptions(
          imageProvider: NetworkImage(images[index]),
          onTapUp: (_, __, ___) => print('onTapUp'),
          onTapDown: (_, __, ___) => print('onTapDown'),
        );
      },
    );
  }
}

@pitayane
Copy link

@renancaraujo Also, I tried depend directly on master and #150 seems to be fixed, but the callbacks that you added to fix this issue are never called.

Because it's not passed to the PhotoView.
See photo_view_gallery.dart around line 254.

image

I have the exactly same problem here.
Hope it can help u.

@renancaraujo
Copy link
Member

Supposed to be solved on 0.4.2

@ghost ghost closed this as completed Jul 12, 2019
This issue was closed.
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

2 participants