commit
caa0af3a07
7 changed files with 34 additions and 65 deletions
3
android/.gitignore
vendored
3
android/.gitignore
vendored
|
@ -5,3 +5,6 @@ gradle-wrapper.jar
|
|||
/gradlew.bat
|
||||
/local.properties
|
||||
GeneratedPluginRegistrant.java
|
||||
|
||||
# Signing config files
|
||||
*.jks
|
|
@ -327,14 +327,6 @@ class _FullScreenMemoryState extends State<FullScreenMemory> {
|
|||
file,
|
||||
autoPlay: false,
|
||||
tagPrefix: "memories",
|
||||
shouldDisableScroll: (value) {
|
||||
if (value == _shouldDisableScroll) {
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
_shouldDisableScroll = value;
|
||||
});
|
||||
},
|
||||
backgroundDecoration: const BoxDecoration(
|
||||
color: Colors.transparent,
|
||||
),
|
||||
|
|
|
@ -73,7 +73,6 @@ class DetailPage extends StatefulWidget {
|
|||
class _DetailPageState extends State<DetailPage> {
|
||||
static const kLoadLimit = 100;
|
||||
final _logger = Logger("DetailPageState");
|
||||
bool _shouldDisableScroll = false;
|
||||
List<EnteFile>? _files;
|
||||
late PageController _pageController;
|
||||
final _selectedIndexNotifier = ValueNotifier(0);
|
||||
|
@ -172,14 +171,6 @@ class _DetailPageState extends State<DetailPage> {
|
|||
file,
|
||||
autoPlay: shouldAutoPlay(),
|
||||
tagPrefix: widget.config.tagPrefix,
|
||||
shouldDisableScroll: (value) {
|
||||
if (_shouldDisableScroll != value) {
|
||||
setState(() {
|
||||
_logger.fine('setState $_shouldDisableScroll to $value');
|
||||
_shouldDisableScroll = value;
|
||||
});
|
||||
}
|
||||
},
|
||||
playbackCallback: (isPlaying) {
|
||||
Future.delayed(Duration.zero, () {
|
||||
_toggleFullScreen(shouldEnable: isPlaying);
|
||||
|
@ -222,9 +213,7 @@ class _DetailPageState extends State<DetailPage> {
|
|||
}
|
||||
_preloadEntries();
|
||||
},
|
||||
physics: _shouldDisableScroll
|
||||
? const NeverScrollableScrollPhysics()
|
||||
: const FastScrollPhysics(speedFactor: 4.0),
|
||||
physics: const FastScrollPhysics(speedFactor: 4.0),
|
||||
controller: _pageController,
|
||||
itemCount: _files!.length,
|
||||
);
|
||||
|
|
|
@ -8,7 +8,6 @@ import "package:photos/ui/viewer/file/zoomable_live_image_new.dart";
|
|||
class FileWidget extends StatelessWidget {
|
||||
final EnteFile file;
|
||||
final String? tagPrefix;
|
||||
final Function(bool)? shouldDisableScroll;
|
||||
final Function(bool)? playbackCallback;
|
||||
final BoxDecoration? backgroundDecoration;
|
||||
final bool? autoPlay;
|
||||
|
@ -16,7 +15,6 @@ class FileWidget extends StatelessWidget {
|
|||
const FileWidget(
|
||||
this.file, {
|
||||
this.autoPlay,
|
||||
this.shouldDisableScroll,
|
||||
this.playbackCallback,
|
||||
this.tagPrefix,
|
||||
this.backgroundDecoration,
|
||||
|
@ -32,7 +30,6 @@ class FileWidget extends StatelessWidget {
|
|||
file.fileType == FileType.image) {
|
||||
return ZoomableLiveImageNew(
|
||||
file,
|
||||
shouldDisableScroll: shouldDisableScroll,
|
||||
tagPrefix: tagPrefix,
|
||||
backgroundDecoration: backgroundDecoration,
|
||||
key: key ?? ValueKey(fileKey),
|
||||
|
|
|
@ -26,7 +26,6 @@ import "package:photos/utils/toast_util.dart";
|
|||
|
||||
class ZoomableImage extends StatefulWidget {
|
||||
final EnteFile photo;
|
||||
final Function(bool)? shouldDisableScroll;
|
||||
final String? tagPrefix;
|
||||
final Decoration? backgroundDecoration;
|
||||
final bool shouldCover;
|
||||
|
@ -34,7 +33,6 @@ class ZoomableImage extends StatefulWidget {
|
|||
const ZoomableImage(
|
||||
this.photo, {
|
||||
Key? key,
|
||||
this.shouldDisableScroll,
|
||||
required this.tagPrefix,
|
||||
this.backgroundDecoration,
|
||||
this.shouldCover = false,
|
||||
|
@ -54,23 +52,14 @@ class _ZoomableImageState extends State<ZoomableImage>
|
|||
bool _loadedLargeThumbnail = false;
|
||||
bool _loadingFinalImage = false;
|
||||
bool _loadedFinalImage = false;
|
||||
ValueChanged<PhotoViewScaleState>? _scaleStateChangedCallback;
|
||||
bool _isZooming = false;
|
||||
PhotoViewController _photoViewController = PhotoViewController();
|
||||
double? _initialScale;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_photo = widget.photo;
|
||||
_logger = Logger("ZoomableImage");
|
||||
_logger.info('initState for ${_photo.generatedID} with tag ${_photo.tag}');
|
||||
_scaleStateChangedCallback = (value) {
|
||||
if (widget.shouldDisableScroll != null) {
|
||||
widget.shouldDisableScroll!(value != PhotoViewScaleState.initial);
|
||||
}
|
||||
_isZooming = value != PhotoViewScaleState.initial;
|
||||
debugPrint("isZooming = $_isZooming, currentState $value");
|
||||
// _logger.info('is reakky zooming $_isZooming with state $value');
|
||||
};
|
||||
super.initState();
|
||||
}
|
||||
|
||||
|
@ -92,7 +81,6 @@ class _ZoomableImageState extends State<ZoomableImage>
|
|||
if (_imageProvider != null) {
|
||||
content = PhotoViewGallery.builder(
|
||||
gaplessPlayback: true,
|
||||
scaleStateChangedCallback: _scaleStateChangedCallback,
|
||||
backgroundDecoration: widget.backgroundDecoration as BoxDecoration?,
|
||||
builder: (context, index) {
|
||||
return PhotoViewGalleryPageOptions(
|
||||
|
@ -112,21 +100,24 @@ class _ZoomableImageState extends State<ZoomableImage>
|
|||
content = const EnteLoadingWidget();
|
||||
}
|
||||
|
||||
final GestureDragUpdateCallback? verticalDragCallback = _isZooming
|
||||
? null
|
||||
: (d) => {
|
||||
if (!_isZooming)
|
||||
{
|
||||
if (d.delta.dy > dragSensitivity)
|
||||
{
|
||||
{Navigator.of(context).pop()},
|
||||
}
|
||||
else if (d.delta.dy < (dragSensitivity * -1))
|
||||
{
|
||||
showDetailsSheet(context, widget.photo),
|
||||
},
|
||||
},
|
||||
};
|
||||
dragFunction(d) => {
|
||||
if (d.delta.dy > dragSensitivity)
|
||||
{
|
||||
{Navigator.of(context).pop()},
|
||||
}
|
||||
else if (d.delta.dy < (dragSensitivity * -1))
|
||||
{
|
||||
showDetailsSheet(context, widget.photo),
|
||||
},
|
||||
};
|
||||
|
||||
verticalDragCallback(d) {
|
||||
if (_initialScale == null ||
|
||||
_photoViewController.scale! <= _initialScale!) {
|
||||
dragFunction(d);
|
||||
}
|
||||
}
|
||||
|
||||
return GestureDetector(
|
||||
onVerticalDragUpdate: verticalDragCallback,
|
||||
child: content,
|
||||
|
@ -267,15 +258,14 @@ class _ZoomableImageState extends State<ZoomableImage>
|
|||
required ImageProvider? previewImageProvider,
|
||||
required ImageProvider finalImageProvider,
|
||||
}) async {
|
||||
final bool shouldFixPosition = previewImageProvider != null &&
|
||||
_isZooming &&
|
||||
_photoViewController.scale != null;
|
||||
final bool shouldFixPosition =
|
||||
previewImageProvider != null && _photoViewController.scale != null;
|
||||
ImageInfo? finalImageInfo;
|
||||
if (shouldFixPosition) {
|
||||
if (kDebugMode) {
|
||||
showToast(
|
||||
context,
|
||||
'Updating photo scale zooming: $_isZooming and scale: ${_photoViewController.scale}',
|
||||
'Updating photo scale zooming and scale: ${_photoViewController.scale}',
|
||||
);
|
||||
}
|
||||
final prevImageInfo = await getImageInfo(previewImageProvider);
|
||||
|
@ -292,6 +282,9 @@ class _ZoomableImageState extends State<ZoomableImage>
|
|||
initialPosition: newPosition,
|
||||
initialScale: scale,
|
||||
);
|
||||
setState(() {
|
||||
_initialScale = scale;
|
||||
});
|
||||
}
|
||||
final bool canUpdateMetadata = _photo.canEditMetaInfo;
|
||||
// forcefully get finalImageInfo is dimensions are not available in metadata
|
||||
|
|
|
@ -16,14 +16,12 @@ import 'package:video_player/video_player.dart';
|
|||
|
||||
class ZoomableLiveImage extends StatefulWidget {
|
||||
final EnteFile enteFile;
|
||||
final Function(bool)? shouldDisableScroll;
|
||||
final String? tagPrefix;
|
||||
final Decoration? backgroundDecoration;
|
||||
|
||||
const ZoomableLiveImage(
|
||||
this.enteFile, {
|
||||
Key? key,
|
||||
this.shouldDisableScroll,
|
||||
required this.tagPrefix,
|
||||
this.backgroundDecoration,
|
||||
}) : super(key: key);
|
||||
|
@ -45,8 +43,9 @@ class _ZoomableLiveImageState extends State<ZoomableLiveImage>
|
|||
@override
|
||||
void initState() {
|
||||
_enteFile = widget.enteFile;
|
||||
_logger.info('initState for ${_enteFile.generatedID} with tag ${_enteFile
|
||||
.tag} and name ${_enteFile.displayName}');
|
||||
_logger.info(
|
||||
'initState for ${_enteFile.generatedID} with tag ${_enteFile.tag} and name ${_enteFile.displayName}',
|
||||
);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
|
@ -76,7 +75,6 @@ class _ZoomableLiveImageState extends State<ZoomableLiveImage>
|
|||
content = ZoomableImage(
|
||||
_enteFile,
|
||||
tagPrefix: widget.tagPrefix,
|
||||
shouldDisableScroll: widget.shouldDisableScroll,
|
||||
backgroundDecoration: widget.backgroundDecoration,
|
||||
);
|
||||
}
|
||||
|
@ -138,7 +136,8 @@ class _ZoomableLiveImageState extends State<ZoomableLiveImage>
|
|||
}
|
||||
|
||||
Future<File?> _getLivePhotoVideo() async {
|
||||
if (_enteFile.isRemoteFile && !(await isFileCached(_enteFile, liveVideo: true))) {
|
||||
if (_enteFile.isRemoteFile &&
|
||||
!(await isFileCached(_enteFile, liveVideo: true))) {
|
||||
showShortToast(context, S.of(context).downloading);
|
||||
}
|
||||
|
||||
|
@ -206,5 +205,4 @@ class _ZoomableLiveImageState extends State<ZoomableLiveImage>
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,14 +16,12 @@ import 'package:photos/utils/toast_util.dart';
|
|||
|
||||
class ZoomableLiveImageNew extends StatefulWidget {
|
||||
final EnteFile enteFile;
|
||||
final Function(bool)? shouldDisableScroll;
|
||||
final String? tagPrefix;
|
||||
final Decoration? backgroundDecoration;
|
||||
|
||||
const ZoomableLiveImageNew(
|
||||
this.enteFile, {
|
||||
Key? key,
|
||||
this.shouldDisableScroll,
|
||||
required this.tagPrefix,
|
||||
this.backgroundDecoration,
|
||||
}) : super(key: key);
|
||||
|
@ -77,7 +75,6 @@ class _ZoomableLiveImageNewState extends State<ZoomableLiveImageNew>
|
|||
content = ZoomableImage(
|
||||
_enteFile,
|
||||
tagPrefix: widget.tagPrefix,
|
||||
shouldDisableScroll: widget.shouldDisableScroll,
|
||||
backgroundDecoration: widget.backgroundDecoration,
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue