|
@@ -1,9 +1,8 @@
|
|
-// @dart=2.9
|
|
|
|
-
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:logging/logging.dart';
|
|
import 'package:logging/logging.dart';
|
|
import 'package:photos/models/collection.dart';
|
|
import 'package:photos/models/collection.dart';
|
|
import 'package:photos/models/collection_items.dart';
|
|
import 'package:photos/models/collection_items.dart';
|
|
|
|
+import 'package:photos/models/gallery_type.dart';
|
|
import 'package:photos/services/collections_service.dart';
|
|
import 'package:photos/services/collections_service.dart';
|
|
import 'package:photos/ui/common/loading_widget.dart';
|
|
import 'package:photos/ui/common/loading_widget.dart';
|
|
import 'package:photos/ui/viewer/file/file_info_collection_widget.dart';
|
|
import 'package:photos/ui/viewer/file/file_info_collection_widget.dart';
|
|
@@ -12,17 +11,20 @@ import 'package:photos/utils/navigation_util.dart';
|
|
|
|
|
|
class CollectionsListOfFileWidget extends StatelessWidget {
|
|
class CollectionsListOfFileWidget extends StatelessWidget {
|
|
final Future<Set<int>> allCollectionIDsOfFile;
|
|
final Future<Set<int>> allCollectionIDsOfFile;
|
|
|
|
+ final int currentUserID;
|
|
|
|
|
|
- const CollectionsListOfFileWidget(this.allCollectionIDsOfFile, {Key key})
|
|
|
|
|
|
+ const CollectionsListOfFileWidget(
|
|
|
|
+ this.allCollectionIDsOfFile, this.currentUserID,
|
|
|
|
+ {Key? key})
|
|
: super(key: key);
|
|
: super(key: key);
|
|
|
|
|
|
@override
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
Widget build(BuildContext context) {
|
|
- return FutureBuilder(
|
|
|
|
|
|
+ return FutureBuilder<Set<int>>(
|
|
future: allCollectionIDsOfFile,
|
|
future: allCollectionIDsOfFile,
|
|
builder: (context, snapshot) {
|
|
builder: (context, snapshot) {
|
|
if (snapshot.hasData) {
|
|
if (snapshot.hasData) {
|
|
- final Set<int> collectionIDs = snapshot.data;
|
|
|
|
|
|
+ final Set<int> collectionIDs = snapshot.data!;
|
|
final collections = <Collection>[];
|
|
final collections = <Collection>[];
|
|
for (var collectionID in collectionIDs) {
|
|
for (var collectionID in collectionIDs) {
|
|
final c =
|
|
final c =
|
|
@@ -44,6 +46,9 @@ class CollectionsListOfFileWidget extends StatelessWidget {
|
|
context,
|
|
context,
|
|
CollectionPage(
|
|
CollectionPage(
|
|
CollectionWithThumbnail(collections[index], null),
|
|
CollectionWithThumbnail(collections[index], null),
|
|
|
|
+ appBarType: collections[index].isOwner(currentUserID)
|
|
|
|
+ ? GalleryType.ownedCollection
|
|
|
|
+ : GalleryType.sharedCollection,
|
|
),
|
|
),
|
|
);
|
|
);
|
|
},
|
|
},
|