// @dart=2.9 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/gallery_type.dart'; import 'package:photos/models/selected_files.dart'; import 'package:photos/services/collections_service.dart'; import 'package:photos/ui/viewer/gallery/empty_hidden_widget.dart'; import 'package:photos/ui/viewer/gallery/gallery.dart'; import 'package:photos/ui/viewer/gallery/gallery_app_bar_widget.dart'; import 'package:photos/ui/viewer/gallery/gallery_overlay_widget.dart'; class HiddenPage extends StatelessWidget { final String tagPrefix; final GalleryType appBarType; final GalleryType overlayType; final _selectedFiles = SelectedFiles(); HiddenPage({ this.tagPrefix = "hidden_page", this.appBarType = GalleryType.hidden, this.overlayType = GalleryType.hidden, Key key, }) : super(key: key); @override Widget build(Object context) { final gallery = Gallery( asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) { return FilesDB.instance.getFilesInCollections( CollectionsService.instance.getHiddenCollections().toList(), creationStartTime, creationEndTime, Configuration.instance.getUserID(), limit: limit, asc: asc, ); }, reloadEvent: Bus.instance.on().where( (event) => event.updatedFiles.firstWhere( (element) => element.uploadedFileID != null, orElse: () => null, ) != null, ), removalEventTypes: const {EventType.unhide}, forceReloadEvents: [ Bus.instance.on().where( (event) => event.updatedFiles.firstWhere( (element) => element.uploadedFileID != null, orElse: () => null, ) != null, ), ], tagPrefix: tagPrefix, selectedFiles: _selectedFiles, initialFiles: null, emptyState: const EmptyHiddenWidget(), ); return Scaffold( appBar: PreferredSize( preferredSize: const Size.fromHeight(50.0), child: GalleryAppBarWidget( appBarType, "Hidden", _selectedFiles, ), ), body: Stack( alignment: Alignment.bottomCenter, children: [ gallery, GalleryOverlayWidget( overlayType, _selectedFiles, ) ], ), ); } }