immich/mobile/lib/presentation/actions/asset_debug.action.dart
shenlong 9fcbb6eefc
refactor: mobile edit asset actions (#30264)
Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
2026-08-01 08:06:42 +05:30

29 lines
1.1 KiB
Dart

import 'dart:async';
import 'package:auto_route/auto_route.dart';
import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/generated/translations.g.dart';
import 'package:immich_mobile/presentation/actions/action.dart';
import 'package:immich_mobile/providers/infrastructure/setting.provider.dart';
import 'package:immich_mobile/routing/router.dart';
class AssetDebugAction extends AssetActionBuilder {
const AssetDebugAction({required super.source});
@override
ActionItem? create(BuildContext context, WidgetRef ref) {
final asset = ref.watch(assetsActionProvider(source)).assets.singleOrNull;
final troubleshootEnabled = ref.watch(settingsProvider.notifier).get(.advancedTroubleshooting);
if (!troubleshootEnabled || asset == null) {
return null;
}
return .new(
icon: Icons.help_outline_rounded,
label: context.t.troubleshoot,
onAction: () => unawaited(context.pushRoute(AssetTroubleshootRoute(asset: asset))),
);
}
}