2022-02-09 11:41:02 -07:00
|
|
|
import 'package:flutter/material.dart';
|
2022-02-13 14:10:42 -07:00
|
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
2022-04-23 19:08:45 -07:00
|
|
|
import 'package:immich_mobile/shared/providers/asset.provider.dart';
|
2022-02-13 14:10:42 -07:00
|
|
|
import 'package:immich_mobile/modules/home/providers/home_page_state.provider.dart';
|
2022-02-09 11:41:02 -07:00
|
|
|
|
2022-02-13 14:10:42 -07:00
|
|
|
class DeleteDialog extends ConsumerWidget {
|
2022-02-09 11:41:02 -07:00
|
|
|
const DeleteDialog({Key? key}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
2022-02-13 14:10:42 -07:00
|
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
|
|
final homePageState = ref.watch(homePageStateProvider);
|
|
|
|
|
2022-02-09 11:41:02 -07:00
|
|
|
return AlertDialog(
|
|
|
|
backgroundColor: Colors.grey[200],
|
|
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
|
|
|
title: const Text("Delete Permanently"),
|
2022-06-25 13:12:47 -07:00
|
|
|
content: const Text(
|
|
|
|
"These items will be permanently deleted from Immich and from your device"),
|
2022-02-09 11:41:02 -07:00
|
|
|
actions: [
|
|
|
|
TextButton(
|
|
|
|
onPressed: () {
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
},
|
|
|
|
child: const Text(
|
|
|
|
"Cancel",
|
|
|
|
style: TextStyle(color: Colors.blueGrey),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
TextButton(
|
2022-02-13 14:10:42 -07:00
|
|
|
onPressed: () {
|
2022-06-25 13:12:47 -07:00
|
|
|
ref
|
|
|
|
.watch(assetProvider.notifier)
|
|
|
|
.deleteAssets(homePageState.selectedItems);
|
2022-02-13 14:10:42 -07:00
|
|
|
ref.watch(homePageStateProvider.notifier).disableMultiSelect();
|
|
|
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
},
|
2022-02-09 11:41:02 -07:00
|
|
|
child: Text(
|
|
|
|
"Delete",
|
|
|
|
style: TextStyle(color: Colors.red[400]),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|