-
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
Top & Bottom Parts of the image is "lost" when zooming in #11
Comments
You are right. I think we should include an example when photo view isn't used as a full-screen widget. |
I can provide you a link to a repo with an example if you'd like. |
I will see what we can do to avoid that. Further PR is coming. |
Could you upload the code of this example perhaps? |
@renancaraujo sure, the code is very simple. main.dartimport 'package:flutter/material.dart';
import 'package:photo_view/photo_view.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Bug Demo',
theme: ThemeData(
primarySwatch: Colors.teal,
),
home: Scaffold(
appBar: AppBar(
title: Text(''),
),
body: Container(
child: PhotoView(
minScale: PhotoViewScaleBoundary.contained,
maxScale: 3.0,
backgroundColor: Color.fromRGBO(255, 255, 255, 1.0),
loadingChild: Center(child: CircularProgressIndicator()),
imageProvider: AssetImage('assets/100x500.png'),
)
),
),
);
}
} pubspec.yaml
assets/100x500.png |
In order to be used inside a sized box, Instead of adding this dependency to the main Sample code: body: Container(
child: PhotoViewInline(
minScale: PhotoViewScaleBoundary.contained,
maxScale: 3.0,
backgroundColor: Color.fromRGBO(255, 255, 255, 1.0),
loadingChild: Center(child: CircularProgressIndicator()),
imageProvider: AssetImage('assets/100x500.png'),
)
), This feature will be available at the 0.0.5 release |
I discovered that when the height of the PhotoView isn't set to full-screen, then after zooming in, the top & bottom parts of the image aren't visible to the user.
I think it's because in _PhotoViewImageWrapperState, Fx _clampPosition(Offset), we're using the screen's width & height instead of the UI Component's width & height.
final screenHeight = MediaQuery.of(context).size.height
needs to befinal screenHeight = context.size.height
(and likewise for width).Hopefully that all makes sense.
Great job on this, btw. Works great.
The text was updated successfully, but these errors were encountered: