-
Notifications
You must be signed in to change notification settings - Fork 552
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
Popup photo view #167
Comments
Since there is a lot of people feeling the need for this feature (myself included on one of my apps), I think it is valid to relive the discussion. Problem: TBH I don't think a dismissable PhotoView is in the "scope" of this widget, BUT this doesn't mean we won't do anything about that.
|
There's a similar package which able to do the popup thing extended_image, it is great if this package able to achieve that. |
I think this can be solved if we somehow remove the background. showDialog(
context: context,
builder: (context) {
return PhotoView(
imageProvider: ...,
backgroundDecoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
);
},
); Clicking outside the black circle dismisses the photoview. So if just remove the background... |
@devxpy You can wrap photoview on a container or sizedbox with the same size as the image. |
@renancaraujo Thanks for replying! I tried that but it doesn't quite work. Here are few observations -
So this: SizedBox(
width: 3000 / 10,
height: 2002 / 10,
child: PhotoView(
imageProvider: imageProvider,
),
); produces:
This: Dialog(
child: SizedBox(
width: 3000 / 10,
height: 2002 / 10,
child: PhotoView(
imageProvider: imageProvider,
),
),
); Produces: But it won't allow any interaction with a zoomed image beyond the constraints of the sized box.
|
Update: Edited the source code for the plugin, to remove the Container, and it totally fixes this! $ git diff
diff --git a/lib/src/core/photo_view_core.dart b/lib/src/core/photo_view_core.dart
index 6d1f462..7868640 100644
--- a/lib/src/core/photo_view_core.dart
+++ b/lib/src/core/photo_view_core.dart
@@ -279,18 +279,12 @@ class PhotoViewCoreState extends State<PhotoViewCore>
child: _buildHero(),
);
return PhotoViewGestureDetector(
- child: Container(
- child: Center(
- child: Transform(
- child: customChildLayout,
- transform: matrix,
- alignment: basePosition,
- ),
+ child: Center(
+ child: Transform(
+ child: customChildLayout,
+ transform: matrix,
+ alignment: basePosition,
),
- decoration: widget.backgroundDecoration ??
- const BoxDecoration(
- color: const Color.fromRGBO(0, 0, 0, 1.0),
- ),
),
onDoubleTap: nextScaleState,
onScaleStart: onScaleStart, @renancaraujo, Can I submit a PR? Can make a switch called |
@renancaraujo yes we need a solution for exit photo_view and back to the previous screen. |
@devxpy Great! It's same feature which we need to implement... |
@devxpy Absolutely, feel free to open the PR |
@devxpy please let us know whenever your PR submitted and this upgraded to latest packages code, thanks. |
@renancaraujo thanks for adding ! |
@renancaraujo does it possible have the same behavior as you shown using |
That demo should be available in the example app, did you try to run it? If following the example app doesn't work, would you ping on discord? Thanks. |
@renancaraujo first of all, thanks for quick reply. I suppose you're talking about this example, right? It's using Yeah I can ping you on discord. thx |
Hello again! @betorcs I've solved it! This is the code:
|
@giovanigm thank you for you reply and sorry to answer only now, I was on vacation. I just tried your sample, it works almost the same using The behavior I'd need it's to close it on tap in background |
Is your feature request related to a problem? Please describe.
It is quite troublesome to implement a popup photo view with zoom, drag and also drag to dismiss (change in transparency), since this library already provided the foundation of zoomable image, it is great that the library able to extend to a popup version.
Describe the solution you'd like
A popup photo view which able to zoom, drag and also drag to dismiss (change in transparency) similar to Facebook.
The text was updated successfully, but these errors were encountered: