archive_page.dart 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import 'dart:io';
  2. import 'package:flutter/cupertino.dart';
  3. import 'package:flutter/material.dart';
  4. import 'package:photos/core/configuration.dart';
  5. import 'package:photos/core/event_bus.dart';
  6. import 'package:photos/db/files_db.dart';
  7. import 'package:photos/events/files_updated_event.dart';
  8. import 'package:photos/models/magic_metadata.dart';
  9. import 'package:photos/models/selected_files.dart';
  10. import 'gallery.dart';
  11. import 'gallery_app_bar_widget.dart';
  12. class ArchivePage extends StatelessWidget {
  13. final String tagPrefix;
  14. final GalleryAppBarType appBarType;
  15. final _selectedFiles = SelectedFiles();
  16. ArchivePage(
  17. {this.tagPrefix = "archived_page",
  18. this.appBarType = GalleryAppBarType.archive,
  19. Key key})
  20. : super(key: key);
  21. @override
  22. Widget build(Object context) {
  23. final gallery = Gallery(
  24. asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) {
  25. return FilesDB.instance.getAllUploadedFiles(creationStartTime,
  26. creationEndTime, Configuration.instance.getUserID(),
  27. visibility: kVisibilityArchive, limit: limit, asc: asc);
  28. },
  29. reloadEvent: Bus.instance.on<FilesUpdatedEvent>().where((event) =>
  30. event.updatedFiles.firstWhere(
  31. (element) => element.uploadedFileID != null,
  32. orElse: () => null) !=
  33. null),
  34. forceReloadEvent: Bus.instance.on<FilesUpdatedEvent>().where((event) =>
  35. event.updatedFiles.firstWhere(
  36. (element) => element.uploadedFileID != null,
  37. orElse: () => null) !=
  38. null),
  39. tagPrefix: tagPrefix,
  40. selectedFiles: _selectedFiles,
  41. initialFiles: null,
  42. );
  43. return Scaffold(
  44. body: Stack(children: [
  45. Padding(
  46. padding: EdgeInsets.only(top: Platform.isAndroid ? 80 : 100),
  47. child: gallery,
  48. ),
  49. SizedBox(
  50. height: Platform.isAndroid ? 80 : 100,
  51. child: GalleryAppBarWidget(
  52. appBarType,
  53. "archived memories",
  54. _selectedFiles,
  55. ),
  56. )
  57. ]),
  58. );
  59. }
  60. }