shared_collection_page.dart 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import 'package:flutter/material.dart';
  2. import 'package:photos/db/files_db.dart';
  3. import 'package:photos/models/selected_files.dart';
  4. import 'package:photos/models/collection.dart';
  5. import 'package:photos/ui/gallery.dart';
  6. import 'package:photos/ui/gallery_app_bar_widget.dart';
  7. class SharedCollectionPage extends StatefulWidget {
  8. final Collection collection;
  9. const SharedCollectionPage(this.collection, {Key key}) : super(key: key);
  10. @override
  11. _SharedCollectionPageState createState() => _SharedCollectionPageState();
  12. }
  13. class _SharedCollectionPageState extends State<SharedCollectionPage> {
  14. final _selectedFiles = SelectedFiles();
  15. @override
  16. Widget build(Object context) {
  17. var gallery = Gallery(
  18. asyncLoader: (lastFile, limit) => FilesDB.instance
  19. .getAllInCollectionBeforeCreationTime(
  20. widget.collection.id,
  21. lastFile == null
  22. ? DateTime.now().microsecondsSinceEpoch
  23. : lastFile.creationTime,
  24. limit),
  25. // onRefresh: () => FolderSharingService.instance.syncDiff(widget.folder),
  26. tagPrefix: "shared_collection",
  27. selectedFiles: _selectedFiles,
  28. );
  29. return Scaffold(
  30. appBar: GalleryAppBarWidget(
  31. GalleryAppBarType.shared_collection,
  32. widget.collection.name,
  33. _selectedFiles,
  34. ),
  35. body: gallery,
  36. );
  37. }
  38. }