2026-06-23 22:20:57 +05:30
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
2026-06-26 02:25:06 +05:30
|
|
|
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
|
2026-06-23 23:50:59 +05:30
|
|
|
import 'package:immich_mobile/domain/models/user.model.dart';
|
|
|
|
|
|
|
|
|
|
class ActionScope {
|
|
|
|
|
final BuildContext context;
|
|
|
|
|
final WidgetRef ref;
|
|
|
|
|
final UserDto authUser;
|
|
|
|
|
|
|
|
|
|
const ActionScope({required this.context, required this.ref, required this.authUser});
|
|
|
|
|
}
|
2026-06-23 22:20:57 +05:30
|
|
|
|
|
|
|
|
abstract class BaseAction {
|
2026-06-23 23:50:59 +05:30
|
|
|
const BaseAction();
|
2026-06-23 22:20:57 +05:30
|
|
|
|
2026-06-23 23:50:59 +05:30
|
|
|
IconData get icon;
|
2026-06-23 22:20:57 +05:30
|
|
|
|
2026-06-23 23:50:59 +05:30
|
|
|
String label(ActionScope scope);
|
2026-06-23 22:20:57 +05:30
|
|
|
|
2026-06-23 23:50:59 +05:30
|
|
|
bool isVisible(ActionScope scope) => true;
|
2026-06-23 22:20:57 +05:30
|
|
|
|
2026-06-23 23:50:59 +05:30
|
|
|
Future<void> onAction(ActionScope scope);
|
2026-06-23 22:20:57 +05:30
|
|
|
}
|
2026-06-26 02:25:06 +05:30
|
|
|
|
|
|
|
|
abstract class AssetAction<T extends BaseAsset> extends BaseAction {
|
|
|
|
|
final Iterable<BaseAsset> assets;
|
|
|
|
|
|
|
|
|
|
const AssetAction({required this.assets});
|
|
|
|
|
|
|
|
|
|
Iterable<T> filter(ActionScope scope) => assets.whereType<T>();
|
|
|
|
|
}
|