Browse Source

Add param to cover the screen

vishnukvmd 2 năm trước cách đây
mục cha
commit
8508035be0

+ 5 - 1
lib/ui/viewer/file/zoomable_image.dart

@@ -25,6 +25,7 @@ class ZoomableImage extends StatefulWidget {
   final Function(bool)? shouldDisableScroll;
   final Function(bool)? shouldDisableScroll;
   final String? tagPrefix;
   final String? tagPrefix;
   final Decoration? backgroundDecoration;
   final Decoration? backgroundDecoration;
+  final bool shouldCover;
 
 
   const ZoomableImage(
   const ZoomableImage(
     this.photo, {
     this.photo, {
@@ -32,6 +33,7 @@ class ZoomableImage extends StatefulWidget {
     this.shouldDisableScroll,
     this.shouldDisableScroll,
     required this.tagPrefix,
     required this.tagPrefix,
     this.backgroundDecoration,
     this.backgroundDecoration,
+    this.shouldCover = false,
   }) : super(key: key);
   }) : super(key: key);
 
 
   @override
   @override
@@ -93,7 +95,9 @@ class _ZoomableImageState extends State<ZoomableImage>
           imageProvider: _imageProvider,
           imageProvider: _imageProvider,
           controller: _photoViewController,
           controller: _photoViewController,
           scaleStateChangedCallback: _scaleStateChangedCallback,
           scaleStateChangedCallback: _scaleStateChangedCallback,
-          minScale: PhotoViewComputedScale.contained,
+          minScale: widget.shouldCover
+              ? PhotoViewComputedScale.covered
+              : PhotoViewComputedScale.contained,
           gaplessPlayback: true,
           gaplessPlayback: true,
           heroAttributes: PhotoViewHeroAttributes(
           heroAttributes: PhotoViewHeroAttributes(
             tag: widget.tagPrefix! + _photo.tag,
             tag: widget.tagPrefix! + _photo.tag,