nc-photos/app/lib/entity/collection/adapter/read_only_adapter.dart

46 lines
1.4 KiB
Dart
Raw Normal View History

import 'package:flutter/foundation.dart';
import 'package:nc_photos/entity/collection.dart';
import 'package:nc_photos/entity/collection/adapter.dart';
import 'package:nc_photos/entity/collection_item.dart';
import 'package:nc_photos/entity/collection_item/util.dart';
import 'package:nc_photos/entity/file_descriptor.dart';
2023-04-17 18:15:29 +02:00
import 'package:nc_photos/or_null.dart';
import 'package:np_common/type.dart';
/// A read-only collection that does not support modifying its items
mixin CollectionReadOnlyAdapter implements CollectionAdapter {
@override
Future<int> addFiles(
List<FileDescriptor> files, {
ErrorWithValueHandler<FileDescriptor>? onError,
required ValueChanged<Collection> onCollectionUpdated,
}) {
throw UnsupportedError("Operation not supported");
}
@override
Future<Collection> edit({
String? name,
List<CollectionItem>? items,
CollectionItemSort? itemSort,
2023-04-17 18:15:29 +02:00
OrNull<FileDescriptor>? cover,
}) {
throw UnsupportedError("Operation not supported");
}
@override
Future<int> removeItems(
List<CollectionItem> items, {
ErrorWithValueIndexedHandler<CollectionItem>? onError,
required ValueChanged<Collection> onCollectionUpdated,
}) {
throw UnsupportedError("Operation not supported");
}
@override
2023-04-17 18:15:29 +02:00
bool isItemRemovable(CollectionItem item) => false;
@override
bool isManualCover() => false;
}