-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement local/remote folder delete
- Loading branch information
Showing
3 changed files
with
72 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:hooks_riverpod/hooks_riverpod.dart'; | ||
import 'package:syncvault/helpers.dart'; | ||
import 'package:syncvault/src/accounts/controllers/folder_controller.dart'; | ||
import 'package:syncvault/src/accounts/models/folder_model.dart'; | ||
|
||
class DeleteFolderDialogWidget extends ConsumerWidget { | ||
const DeleteFolderDialogWidget({super.key, required this.model}); | ||
|
||
final FolderModel model; | ||
|
||
@override | ||
Widget build(BuildContext context, WidgetRef ref) { | ||
final folderNotifier = ref.read(uploadDeleteControllerProvider.notifier); | ||
|
||
return AlertDialog( | ||
title: Text('Delete ${model.folderName}?'), | ||
content: const Text( | ||
'Remote delete deletes the local state and uploaded files.\nLocal delete deletes only local state.\nThis does not affect your local files.', | ||
textAlign: TextAlign.left, | ||
), | ||
actions: [ | ||
TextButton( | ||
onPressed: () async { | ||
if (context.mounted) { | ||
Navigator.of(context).pop(); | ||
} | ||
await folderNotifier.delete(model, true); | ||
}, | ||
child: const Text('Remote Delete')), | ||
TextButton( | ||
onPressed: () async { | ||
if (context.mounted) { | ||
Navigator.of(context).pop(); | ||
} | ||
await folderNotifier.delete(model, false); | ||
}, | ||
child: const Text('Local Delete')), | ||
ElevatedButton( | ||
onPressed: () { | ||
if (context.mounted) { | ||
Navigator.of(context).pop(); | ||
} | ||
}, | ||
child: const Text('Cancel'), | ||
) | ||
], | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters