Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Populate grid rows with actual thumbnails

ashilknaf6942e99d14
diff --git a/mobile/lib/models/gallery/gallery_sections.dart b/mobile/lib/models/gallery/gallery_sections.dart
index f0601fc969..d93a643375 100644
--- a/mobile/lib/models/gallery/gallery_sections.dart
+++ b/mobile/lib/models/gallery/gallery_sections.dart
@@ -1,16 +1,22 @@
import "dart:core";
import "package:flutter/material.dart";
+import "package:photos/core/configuration.dart";
import "package:photos/models/file/file.dart";
import "package:photos/models/gallery/fixed_extent_grid_row.dart";
import "package:photos/models/gallery/fixed_extent_section_layout.dart";
+import "package:photos/models/selected_files.dart";
import "package:photos/service_locator.dart";
+import "package:photos/ui/viewer/gallery/component/gallery_file_widget.dart";
import "package:photos/ui/viewer/gallery/component/group/type.dart";
import "package:uuid/uuid.dart";
class GallerySections {
final List<EnteFile> allFiles;
final GroupType groupType;
+ final SelectedFiles? selectedFiles;
+ final bool limitSelectionToOne;
+ final String tagPrefix;
//TODO: Add support for sort order
final bool sortOrderAsc;
@@ -22,8 +28,11 @@ class GallerySections {
required this.groupType,
required this.widthAvailable,
required this.context,
+ required this.selectedFiles,
+ required this.tagPrefix,
this.sortOrderAsc = true,
this.headerExtent = 85,
+ this.limitSelectionToOne = false,
}) {
init();
}
@@ -32,6 +41,7 @@ class GallerySections {
final Map<String, List<EnteFile>> _groupIDToFilesMap = {};
final Map<String, GroupHeaderData> _groupIdToheaderDataMap = {};
late final int crossAxisCount;
+ final currentUserID = Configuration.instance.getUserID();
List<String> get groupIDs => _groupIDs;
Map<String, List<EnteFile>> get groupIDToFilesMap => _groupIDToFilesMap;
@@ -109,15 +119,16 @@ class GallerySections {
);
} else {
final gridRowChildren = <Widget>[];
- for (int i in Iterable<int>.generate(crossAxisCount)) {
+ for (int _ in Iterable<int>.generate(crossAxisCount)) {
if (currentGroupIndex < filesInGroup.length) {
gridRowChildren.add(
- SizedBox(
- width: tileHeight,
- height: tileHeight,
- child: Text(
- i.toString(),
- ),
+ GalleryFileWidget(
+ file: filesInGroup[currentGroupIndex],
+ selectedFiles: selectedFiles,
+ limitSelectionToOne: limitSelectionToOne,
+ tag: tagPrefix,
+ photoGridSize: crossAxisCount,
+ currentUserID: currentUserID,
),
);
currentGroupIndex++;
diff --git a/mobile/lib/ui/viewer/gallery/component/gallery_file_widget.dart b/mobile/lib/ui/viewer/gallery/component/gallery_file_widget.dart
index 1462dbf8ae..aa32f897fa 100644
--- a/mobile/lib/ui/viewer/gallery/component/gallery_file_widget.dart
+++ b/mobile/lib/ui/viewer/gallery/component/gallery_file_widget.dart
@@ -9,7 +9,6 @@ import "package:photos/services/app_lifecycle_service.dart";
import "package:photos/theme/ente_theme.dart";
import "package:photos/ui/viewer/file/detail_page.dart";
import "package:photos/ui/viewer/file/thumbnail_widget.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/state/gallery_files_inherited_widget.dart";
import "package:photos/utils/file_util.dart";
@@ -22,7 +21,6 @@ class GalleryFileWidget extends StatelessWidget {
final String tag;
final int photoGridSize;
final int? currentUserID;
- final GalleryLoader asyncLoader;
const GalleryFileWidget({
required this.file,
required this.selectedFiles,
@@ -30,7 +28,6 @@ class GalleryFileWidget extends StatelessWidget {
required this.tag,
required this.photoGridSize,
required this.currentUserID,
- required this.asyncLoader,
super.key,
});
diff --git a/mobile/lib/ui/viewer/gallery/component/grid/gallery_grid_view_widget.dart b/mobile/lib/ui/viewer/gallery/component/grid/gallery_grid_view_widget.dart
index 33632ae494..d0b7776be4 100644
--- a/mobile/lib/ui/viewer/gallery/component/grid/gallery_grid_view_widget.dart
+++ b/mobile/lib/ui/viewer/gallery/component/grid/gallery_grid_view_widget.dart
@@ -38,7 +38,6 @@ class GalleryGridViewWidget extends StatelessWidget {
tag: tag,
photoGridSize: photoGridSize,
currentUserID: currentUserID,
- asyncLoader: asyncLoader,
);
},
itemCount: filesInGroup.length,
diff --git a/mobile/lib/ui/viewer/gallery/gallery.dart b/mobile/lib/ui/viewer/gallery/gallery.dart
index b99634c1ce..2a5e1dbd01 100644
--- a/mobile/lib/ui/viewer/gallery/gallery.dart
+++ b/mobile/lib/ui/viewer/gallery/gallery.dart
@@ -413,6 +413,8 @@ class GalleryState extends State<Gallery> {
groupType: widget.groupType,
widthAvailable: MediaQuery.sizeOf(context).width,
context: context,
+ selectedFiles: widget.selectedFiles,
+ tagPrefix: widget.tagPrefix,
).getSectionLayouts(),
),
],