Populate grid rows with actual thumbnails
This commit is contained in:
@@ -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++;
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@ class GalleryGridViewWidget extends StatelessWidget {
|
||||
tag: tag,
|
||||
photoGridSize: photoGridSize,
|
||||
currentUserID: currentUserID,
|
||||
asyncLoader: asyncLoader,
|
||||
);
|
||||
},
|
||||
itemCount: filesInGroup.length,
|
||||
|
||||
@@ -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(),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user