[mob][photos] Move Swipe to select helper to cover whole gallery for selection across days without lifting finger
This commit is contained in:
@@ -14,7 +14,6 @@ import "package:photos/ui/viewer/gallery/component/group/group_header_widget.dar
|
||||
import "package:photos/ui/viewer/gallery/component/group/type.dart";
|
||||
import 'package:photos/ui/viewer/gallery/gallery.dart';
|
||||
import "package:photos/ui/viewer/gallery/state/gallery_context_state.dart";
|
||||
import "package:photos/ui/viewer/gallery/swipe_to_select_helper.dart";
|
||||
|
||||
class LazyGroupGallery extends StatefulWidget {
|
||||
final List<EnteFile> files;
|
||||
@@ -234,41 +233,21 @@ class _LazyGroupGalleryState extends State<LazyGroupGallery> {
|
||||
),
|
||||
],
|
||||
),
|
||||
widget.selectedFiles != null
|
||||
? SwipeToSelectHelper(
|
||||
_shouldRender!
|
||||
? GroupGallery(
|
||||
photoGridSize: widget.photoGridSize,
|
||||
files: _filesInGroup,
|
||||
selectedFiles: widget.selectedFiles!,
|
||||
child: _shouldRender!
|
||||
? GroupGallery(
|
||||
photoGridSize: widget.photoGridSize,
|
||||
files: _filesInGroup,
|
||||
tag: widget.tag,
|
||||
asyncLoader: widget.asyncLoader,
|
||||
selectedFiles: widget.selectedFiles,
|
||||
limitSelectionToOne: widget.limitSelectionToOne,
|
||||
)
|
||||
// todo: perf eval should we have separate PlaceHolder for Groups
|
||||
// instead of creating a large cached view
|
||||
: PlaceHolderGridViewWidget(
|
||||
_filesInGroup.length,
|
||||
widget.photoGridSize,
|
||||
),
|
||||
tag: widget.tag,
|
||||
asyncLoader: widget.asyncLoader,
|
||||
selectedFiles: widget.selectedFiles,
|
||||
limitSelectionToOne: widget.limitSelectionToOne,
|
||||
)
|
||||
: _shouldRender!
|
||||
? GroupGallery(
|
||||
photoGridSize: widget.photoGridSize,
|
||||
files: _filesInGroup,
|
||||
tag: widget.tag,
|
||||
asyncLoader: widget.asyncLoader,
|
||||
selectedFiles: widget.selectedFiles,
|
||||
limitSelectionToOne: widget.limitSelectionToOne,
|
||||
)
|
||||
// todo: perf eval should we have separate PlaceHolder for Groups
|
||||
// instead of creating a large cached view
|
||||
: PlaceHolderGridViewWidget(
|
||||
_filesInGroup.length,
|
||||
widget.photoGridSize,
|
||||
),
|
||||
// todo: perf eval should we have separate PlaceHolder for Groups
|
||||
// instead of creating a large cached view
|
||||
: PlaceHolderGridViewWidget(
|
||||
_filesInGroup.length,
|
||||
widget.photoGridSize,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import "package:photos/ui/viewer/gallery/component/multiple_groups_gallery_view.
|
||||
import 'package:photos/ui/viewer/gallery/empty_state.dart';
|
||||
import "package:photos/ui/viewer/gallery/state/gallery_context_state.dart";
|
||||
import "package:photos/ui/viewer/gallery/state/selection_state.dart";
|
||||
import "package:photos/ui/viewer/gallery/swipe_to_select_helper.dart";
|
||||
import "package:photos/utils/debouncer.dart";
|
||||
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
|
||||
|
||||
@@ -258,27 +259,31 @@ class GalleryState extends State<Gallery> {
|
||||
sortOrderAsc: _sortOrderAsc,
|
||||
inSelectionMode: widget.inSelectionMode,
|
||||
type: widget.groupType,
|
||||
child: MultipleGroupsGalleryView(
|
||||
itemScroller: _itemScroller,
|
||||
groupedFiles: currentGroupedFiles,
|
||||
disableScroll: widget.disableScroll,
|
||||
emptyState: widget.emptyState,
|
||||
asyncLoader: widget.asyncLoader,
|
||||
removalEventTypes: widget.removalEventTypes,
|
||||
tagPrefix: widget.tagPrefix,
|
||||
scrollBottomSafeArea: widget.scrollBottomSafeArea,
|
||||
limitSelectionToOne: widget.limitSelectionToOne,
|
||||
enableFileGrouping:
|
||||
widget.enableFileGrouping && widget.groupType.showGroupHeader(),
|
||||
logTag: _logTag,
|
||||
logger: _logger,
|
||||
reloadEvent: widget.reloadEvent,
|
||||
header: widget.header,
|
||||
footer: widget.footer,
|
||||
child: SwipeToSelectHelper(
|
||||
files: currentGroupedFiles.expand((element) => element).toList(),
|
||||
selectedFiles: widget.selectedFiles,
|
||||
showSelectAllByDefault:
|
||||
widget.showSelectAllByDefault && widget.groupType.showGroupHeader(),
|
||||
isScrollablePositionedList: widget.isScrollablePositionedList,
|
||||
child: MultipleGroupsGalleryView(
|
||||
itemScroller: _itemScroller,
|
||||
groupedFiles: currentGroupedFiles,
|
||||
disableScroll: widget.disableScroll,
|
||||
emptyState: widget.emptyState,
|
||||
asyncLoader: widget.asyncLoader,
|
||||
removalEventTypes: widget.removalEventTypes,
|
||||
tagPrefix: widget.tagPrefix,
|
||||
scrollBottomSafeArea: widget.scrollBottomSafeArea,
|
||||
limitSelectionToOne: widget.limitSelectionToOne,
|
||||
enableFileGrouping:
|
||||
widget.enableFileGrouping && widget.groupType.showGroupHeader(),
|
||||
logTag: _logTag,
|
||||
logger: _logger,
|
||||
reloadEvent: widget.reloadEvent,
|
||||
header: widget.header,
|
||||
footer: widget.footer,
|
||||
selectedFiles: widget.selectedFiles,
|
||||
showSelectAllByDefault: widget.showSelectAllByDefault &&
|
||||
widget.groupType.showGroupHeader(),
|
||||
isScrollablePositionedList: widget.isScrollablePositionedList,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import "package:photos/ui/viewer/gallery/component/group/lazy_group_gallery.dart
|
||||
|
||||
class SwipeToSelectHelper extends StatefulWidget {
|
||||
final List<EnteFile> files;
|
||||
final SelectedFiles selectedFiles;
|
||||
final SelectedFiles? selectedFiles;
|
||||
final Widget child;
|
||||
const SwipeToSelectHelper({
|
||||
required this.files,
|
||||
@@ -26,24 +26,26 @@ class _SwipeToSelectHelperState extends State<SwipeToSelectHelper> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LastSelectedFileByDragging(
|
||||
filesInGroup: widget.files,
|
||||
child: Builder(
|
||||
builder: (context) {
|
||||
return SelectionGesturesEventProvider(
|
||||
selectedFiles: widget.selectedFiles,
|
||||
files: widget.files,
|
||||
child: GroupGalleryGlobalKey(
|
||||
globalKey: _groupGalleryGlobalKey,
|
||||
child: SizedBox(
|
||||
key: _groupGalleryGlobalKey,
|
||||
child: widget.child,
|
||||
),
|
||||
return widget.selectedFiles == null
|
||||
? widget.child
|
||||
: LastSelectedFileByDragging(
|
||||
filesInGroup: widget.files,
|
||||
child: Builder(
|
||||
builder: (context) {
|
||||
return SelectionGesturesEventProvider(
|
||||
selectedFiles: widget.selectedFiles!,
|
||||
files: widget.files,
|
||||
child: GroupGalleryGlobalKey(
|
||||
globalKey: _groupGalleryGlobalKey,
|
||||
child: SizedBox(
|
||||
key: _groupGalleryGlobalKey,
|
||||
child: widget.child,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user