Fix: open collection with correct appBarType
This commit is contained in:
parent
cd35daa727
commit
87d76acc1f
|
@ -70,6 +70,10 @@ class Collection {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isOwner(int userID) {
|
||||||
|
return (owner?.id ?? 0) == userID;
|
||||||
|
}
|
||||||
|
|
||||||
void updateSharees(List<User> newSharees) {
|
void updateSharees(List<User> newSharees) {
|
||||||
sharees?.clear();
|
sharees?.clear();
|
||||||
sharees?.addAll(newSharees);
|
sharees?.addAll(newSharees);
|
||||||
|
|
|
@ -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,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
@ -225,7 +225,10 @@ class _FileInfoWidgetState extends State<FileInfoWidget> {
|
||||||
horizontalTitleGap: 0,
|
horizontalTitleGap: 0,
|
||||||
leading: const Icon(Icons.folder_outlined),
|
leading: const Icon(Icons.folder_outlined),
|
||||||
title: fileIsBackedup
|
title: fileIsBackedup
|
||||||
? CollectionsListOfFileWidget(allCollectionIDsOfFile)
|
? CollectionsListOfFileWidget(
|
||||||
|
allCollectionIDsOfFile,
|
||||||
|
_currentUserID,
|
||||||
|
)
|
||||||
: DeviceFoldersListOfFileWidget(allDeviceFoldersOfFile),
|
: DeviceFoldersListOfFileWidget(allDeviceFoldersOfFile),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in a new issue