mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-02-25 02:48:54 +01:00
Swipe up to open detail pane in viewer
This commit is contained in:
parent
e322197117
commit
42d6851bf5
3 changed files with 45 additions and 15 deletions
|
@ -50,7 +50,7 @@ class _ImageViewerState extends State<ImageViewer>
|
||||||
minScale: 1.0,
|
minScale: 1.0,
|
||||||
maxScale: 3.0,
|
maxScale: 3.0,
|
||||||
transformationController: _transformationController,
|
transformationController: _transformationController,
|
||||||
panEnabled: widget.canZoom,
|
panEnabled: widget.canZoom && _isZoomed,
|
||||||
scaleEnabled: widget.canZoom,
|
scaleEnabled: widget.canZoom,
|
||||||
// allow the image to be zoomed to fill the whole screen
|
// allow the image to be zoomed to fill the whole screen
|
||||||
child: Container(
|
child: Container(
|
||||||
|
|
|
@ -233,13 +233,12 @@ class _ViewerState extends State<Viewer>
|
||||||
onNotification: (notif) => _onPageContentScrolled(notif, index),
|
onNotification: (notif) => _onPageContentScrolled(notif, index),
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
controller: _pageStates[index]!.scrollController,
|
controller: _pageStates[index]!.scrollController,
|
||||||
physics:
|
physics: !_isZoomed ? null : const NeverScrollableScrollPhysics(),
|
||||||
_isDetailPaneActive ? null : const NeverScrollableScrollPhysics(),
|
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
_buildItemView(context, index),
|
_buildItemView(context, index),
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: _isDetailPaneActive,
|
visible: !_isZoomed,
|
||||||
child: AnimatedOpacity(
|
child: AnimatedOpacity(
|
||||||
opacity: _isShowDetailPane ? 1 : 0,
|
opacity: _isShowDetailPane ? 1 : 0,
|
||||||
duration: k.animationDurationNormal,
|
duration: k.animationDurationNormal,
|
||||||
|
@ -260,6 +259,11 @@ class _ViewerState extends State<Viewer>
|
||||||
const BorderRadius.vertical(top: Radius.circular(4)),
|
const BorderRadius.vertical(top: Radius.circular(4)),
|
||||||
),
|
),
|
||||||
margin: EdgeInsets.only(top: _calcDetailPaneOffset(index)),
|
margin: EdgeInsets.only(top: _calcDetailPaneOffset(index)),
|
||||||
|
// this visibility widget avoids loading the detail pane
|
||||||
|
// until it's actually opened, otherwise swiping between
|
||||||
|
// photos will slow down severely
|
||||||
|
child: Visibility(
|
||||||
|
visible: _isShowDetailPane,
|
||||||
child: ViewerDetailPane(
|
child: ViewerDetailPane(
|
||||||
account: widget.account,
|
account: widget.account,
|
||||||
file: widget.streamFiles[index],
|
file: widget.streamFiles[index],
|
||||||
|
@ -269,6 +273,7 @@ class _ViewerState extends State<Viewer>
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -350,6 +355,14 @@ class _ViewerState extends State<Viewer>
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (notification is ScrollUpdateNotification) {
|
||||||
|
if (!_isShowDetailPane) {
|
||||||
|
Future.delayed(Duration.zero, () {
|
||||||
|
setState(() {
|
||||||
|
_isShowDetailPane = true;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ import 'package:nc_photos/theme.dart';
|
||||||
import 'package:nc_photos/use_case/remove_from_album.dart';
|
import 'package:nc_photos/use_case/remove_from_album.dart';
|
||||||
import 'package:nc_photos/use_case/update_album.dart';
|
import 'package:nc_photos/use_case/update_album.dart';
|
||||||
import 'package:nc_photos/use_case/update_property.dart';
|
import 'package:nc_photos/use_case/update_property.dart';
|
||||||
|
import 'package:nc_photos/widget/animated_visibility.dart';
|
||||||
import 'package:nc_photos/widget/gps_map.dart';
|
import 'package:nc_photos/widget/gps_map.dart';
|
||||||
import 'package:nc_photos/widget/handler/add_selection_to_album_handler.dart';
|
import 'package:nc_photos/widget/handler/add_selection_to_album_handler.dart';
|
||||||
import 'package:nc_photos/widget/photo_date_time_edit_dialog.dart';
|
import 'package:nc_photos/widget/photo_date_time_edit_dialog.dart';
|
||||||
|
@ -71,6 +72,15 @@ class _ViewerDetailPaneState extends State<ViewerDetailPane> {
|
||||||
_initMetadata();
|
_initMetadata();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// postpone loading map to improve responsiveness
|
||||||
|
Future.delayed(const Duration(milliseconds: 750)).then((_) {
|
||||||
|
if (mounted) {
|
||||||
|
setState(() {
|
||||||
|
_shouldBlockGpsMap = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -239,7 +249,11 @@ class _ViewerDetailPaneState extends State<ViewerDetailPane> {
|
||||||
subtitle: cameraSubStr.isNotEmpty ? Text(cameraSubStr) : null,
|
subtitle: cameraSubStr.isNotEmpty ? Text(cameraSubStr) : null,
|
||||||
),
|
),
|
||||||
if (features.isSupportMapView && _gps != null)
|
if (features.isSupportMapView && _gps != null)
|
||||||
SizedBox(
|
AnimatedVisibility(
|
||||||
|
opacity: _shouldBlockGpsMap ? 0 : 1,
|
||||||
|
curve: Curves.easeInOut,
|
||||||
|
duration: k.animationDurationNormal,
|
||||||
|
child: SizedBox(
|
||||||
height: 256,
|
height: 256,
|
||||||
child: GpsMap(
|
child: GpsMap(
|
||||||
center: _gps!,
|
center: _gps!,
|
||||||
|
@ -247,6 +261,7 @@ class _ViewerDetailPaneState extends State<ViewerDetailPane> {
|
||||||
onTap: _onMapTap,
|
onTap: _onMapTap,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -489,6 +504,8 @@ class _ViewerDetailPaneState extends State<ViewerDetailPane> {
|
||||||
|
|
||||||
late final bool _canRemoveFromAlbum = _checkCanRemoveFromAlbum();
|
late final bool _canRemoveFromAlbum = _checkCanRemoveFromAlbum();
|
||||||
|
|
||||||
|
var _shouldBlockGpsMap = true;
|
||||||
|
|
||||||
static final _log =
|
static final _log =
|
||||||
Logger("widget.viewer_detail_pane._ViewerDetailPaneState");
|
Logger("widget.viewer_detail_pane._ViewerDetailPaneState");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue