84 lines
2.5 KiB
Dart
84 lines
2.5 KiB
Dart
import 'package:flutter/material.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/galleryType.dart';
|
|
import 'package:photos/models/magic_metadata.dart';
|
|
import 'package:photos/models/selected_files.dart';
|
|
import 'package:photos/ui/gallery.dart';
|
|
import 'package:photos/ui/gallery_app_bar_widget.dart';
|
|
import 'package:photos/ui/gallery_overlay_widget.dart';
|
|
|
|
class ArchivePage extends StatelessWidget {
|
|
final String tagPrefix;
|
|
final GalleryType appBarType;
|
|
final GalleryType overlayType;
|
|
final _selectedFiles = SelectedFiles();
|
|
|
|
ArchivePage({
|
|
this.tagPrefix = "archived_page",
|
|
this.appBarType = GalleryType.archive,
|
|
this.overlayType = GalleryType.archive,
|
|
Key key,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(Object context) {
|
|
final gallery = Gallery(
|
|
asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) {
|
|
return FilesDB.instance.getAllUploadedFiles(
|
|
creationStartTime,
|
|
creationEndTime,
|
|
Configuration.instance.getUserID(),
|
|
visibility: kVisibilityArchive,
|
|
limit: limit,
|
|
asc: asc,
|
|
);
|
|
},
|
|
reloadEvent: Bus.instance.on<FilesUpdatedEvent>().where(
|
|
(event) =>
|
|
event.updatedFiles.firstWhere(
|
|
(element) => element.uploadedFileID != null,
|
|
orElse: () => null,
|
|
) !=
|
|
null,
|
|
),
|
|
removalEventTypes: const {EventType.unarchived},
|
|
forceReloadEvents: [
|
|
Bus.instance.on<FilesUpdatedEvent>().where(
|
|
(event) =>
|
|
event.updatedFiles.firstWhere(
|
|
(element) => element.uploadedFileID != null,
|
|
orElse: () => null,
|
|
) !=
|
|
null,
|
|
),
|
|
],
|
|
tagPrefix: tagPrefix,
|
|
selectedFiles: _selectedFiles,
|
|
initialFiles: null,
|
|
footer: SizedBox(height: 32),
|
|
);
|
|
return Scaffold(
|
|
appBar: PreferredSize(
|
|
preferredSize: Size.fromHeight(50.0),
|
|
child: GalleryAppBarWidget(
|
|
appBarType,
|
|
"Hidden",
|
|
_selectedFiles,
|
|
),
|
|
),
|
|
body: Stack(
|
|
alignment: Alignment.bottomCenter,
|
|
children: [
|
|
gallery,
|
|
GalleryOverlayWidget(
|
|
overlayType,
|
|
_selectedFiles,
|
|
)
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|