89 lines
2.8 KiB
Dart
89 lines
2.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:photos/core/event_bus.dart';
|
|
import 'package:photos/db/files_db.dart';
|
|
import 'package:photos/events/collection_updated_event.dart';
|
|
import 'package:photos/events/files_updated_event.dart';
|
|
import "package:photos/generated/l10n.dart";
|
|
import 'package:photos/models/collection.dart';
|
|
import 'package:photos/models/file_load_result.dart';
|
|
import 'package:photos/models/gallery_type.dart';
|
|
import 'package:photos/models/selected_files.dart';
|
|
import 'package:photos/services/ignored_files_service.dart';
|
|
import 'package:photos/ui/viewer/actions/file_selection_overlay_bar.dart';
|
|
import 'package:photos/ui/viewer/gallery/gallery.dart';
|
|
import 'package:photos/ui/viewer/gallery/gallery_app_bar_widget.dart';
|
|
|
|
class UnCategorizedPage extends StatelessWidget {
|
|
final String tagPrefix;
|
|
final Collection collection;
|
|
final GalleryType appBarType;
|
|
final GalleryType overlayType;
|
|
final _selectedFiles = SelectedFiles();
|
|
|
|
UnCategorizedPage(
|
|
this.collection, {
|
|
this.tagPrefix = "Uncategorized_page",
|
|
this.appBarType = GalleryType.uncategorized,
|
|
this.overlayType = GalleryType.uncategorized,
|
|
Key? key,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final gallery = Gallery(
|
|
asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) async {
|
|
final FileLoadResult result =
|
|
await FilesDB.instance.getFilesInCollection(
|
|
collection.id,
|
|
creationStartTime,
|
|
creationEndTime,
|
|
limit: limit,
|
|
asc: asc,
|
|
);
|
|
// hide ignored files from home page UI
|
|
final ignoredIDs =
|
|
await IgnoredFilesService.instance.idToIgnoreReasonMap;
|
|
result.files.removeWhere(
|
|
(f) =>
|
|
f.uploadedFileID == null &&
|
|
IgnoredFilesService.instance.shouldSkipUpload(ignoredIDs, f),
|
|
);
|
|
return result;
|
|
},
|
|
reloadEvent: Bus.instance
|
|
.on<CollectionUpdatedEvent>()
|
|
.where((event) => event.collectionID == collection.id),
|
|
removalEventTypes: const {
|
|
EventType.deletedFromRemote,
|
|
EventType.deletedFromEverywhere,
|
|
EventType.hide,
|
|
},
|
|
tagPrefix: tagPrefix,
|
|
selectedFiles: _selectedFiles,
|
|
initialFiles: null,
|
|
albumName: S.of(context).uncategorized,
|
|
);
|
|
return Scaffold(
|
|
appBar: PreferredSize(
|
|
preferredSize: const Size.fromHeight(50.0),
|
|
child: GalleryAppBarWidget(
|
|
appBarType,
|
|
S.of(context).uncategorized,
|
|
_selectedFiles,
|
|
collection: collection,
|
|
),
|
|
),
|
|
body: Stack(
|
|
alignment: Alignment.bottomCenter,
|
|
children: [
|
|
gallery,
|
|
FileSelectionOverlayBar(
|
|
overlayType,
|
|
_selectedFiles,
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|