|
@@ -1,14 +1,19 @@
|
|
|
import 'package:collection/collection.dart' show IterableExtension;
|
|
|
import 'package:flutter/material.dart';
|
|
|
+import "package:logging/logging.dart";
|
|
|
import 'package:photos/core/configuration.dart';
|
|
|
import 'package:photos/core/event_bus.dart';
|
|
|
import 'package:photos/db/files_db.dart';
|
|
|
import 'package:photos/events/files_updated_event.dart';
|
|
|
+import "package:photos/models/collection_items.dart";
|
|
|
import 'package:photos/models/gallery_type.dart';
|
|
|
import 'package:photos/models/magic_metadata.dart';
|
|
|
import 'package:photos/models/selected_files.dart';
|
|
|
import 'package:photos/services/collections_service.dart';
|
|
|
+import "package:photos/ui/collections/collection_item_widget.dart";
|
|
|
+import "package:photos/ui/common/loading_widget.dart";
|
|
|
import 'package:photos/ui/viewer/actions/file_selection_overlay_bar.dart';
|
|
|
+import "package:photos/ui/viewer/gallery/empty_state.dart";
|
|
|
import 'package:photos/ui/viewer/gallery/gallery.dart';
|
|
|
import 'package:photos/ui/viewer/gallery/gallery_app_bar_widget.dart';
|
|
|
|
|
@@ -17,6 +22,7 @@ class ArchivePage extends StatelessWidget {
|
|
|
final GalleryType appBarType;
|
|
|
final GalleryType overlayType;
|
|
|
final _selectedFiles = SelectedFiles();
|
|
|
+ final Logger _logger = Logger("ArchivePage");
|
|
|
|
|
|
ArchivePage({
|
|
|
this.tagPrefix = "archived_page",
|
|
@@ -61,6 +67,47 @@ class ArchivePage extends StatelessWidget {
|
|
|
tagPrefix: tagPrefix,
|
|
|
selectedFiles: _selectedFiles,
|
|
|
initialFiles: null,
|
|
|
+ emptyState: const EmptyState(
|
|
|
+ text: "You don't have any archived items.",
|
|
|
+ ),
|
|
|
+ header: FutureBuilder(
|
|
|
+ future: CollectionsService.instance.getArchivedCollectionWithThumb(),
|
|
|
+ builder: (context, snapshot) {
|
|
|
+ if (snapshot.hasError) {
|
|
|
+ _logger.severe("failed to fetch archived albums", snapshot.error);
|
|
|
+ return const Text("Something went wrong");
|
|
|
+ } else if (snapshot.hasData) {
|
|
|
+ final collectionsWithThumbnail =
|
|
|
+ snapshot.data as List<CollectionWithThumbnail>;
|
|
|
+ return SizedBox(
|
|
|
+ height: 200,
|
|
|
+ child: ListView.builder(
|
|
|
+ shrinkWrap: true,
|
|
|
+ scrollDirection: Axis.horizontal,
|
|
|
+ itemCount: collectionsWithThumbnail.length,
|
|
|
+ padding: const EdgeInsets.fromLTRB(6, 6, 6, 6),
|
|
|
+ itemBuilder: (context, index) {
|
|
|
+ final item = collectionsWithThumbnail[index];
|
|
|
+ return GestureDetector(
|
|
|
+ behavior: HitTestBehavior.opaque,
|
|
|
+ onTap: () async {},
|
|
|
+ child: Padding(
|
|
|
+ padding: const EdgeInsets.all(2.0),
|
|
|
+ child: CollectionItem(
|
|
|
+ item,
|
|
|
+ 120,
|
|
|
+ shouldRender: true,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ return const EnteLoadingWidget();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ ),
|
|
|
);
|
|
|
return Scaffold(
|
|
|
appBar: PreferredSize(
|