Show critical warning while removing others file from album

This commit is contained in:
Neeraj Gupta 2023-02-03 05:44:49 +05:30
parent 2eba2a9954
commit eb4c449b58
No known key found for this signature in database
GPG key ID: 3C5A1684DC1729E1
2 changed files with 12 additions and 5 deletions

View file

@ -16,13 +16,15 @@ extension CollectionFileActions on CollectionActions {
BuildContext bContext,
Collection collection,
SelectedFiles selectedFiles,
bool removingOthersFile,
) async {
final actionResult = await showActionSheet(
context: bContext,
buttons: [
ButtonWidget(
labelText: "Yes, remove",
buttonType: ButtonType.neutral,
labelText: "Remove",
buttonType:
removingOthersFile ? ButtonType.critical : ButtonType.neutral,
buttonSize: ButtonSize.large,
shouldStickToDarkTheme: true,
isInAlert: true,
@ -48,9 +50,11 @@ extension CollectionFileActions on CollectionActions {
isInAlert: true,
),
],
title: "Remove from album?",
body: "Selected items will be removed from this album. Items which are "
"only in this album will be moved to Uncategorized.",
title: removingOthersFile ? "Remove from album?" : null,
body: removingOthersFile
? "Some of the items you are removing were "
"added by other people, and you will lose access to them"
: "Selected items will be removed from this album",
actionSheetType: ActionSheetType.defaultActionSheet,
);
if (actionResult != null && actionResult == ButtonAction.error) {

View file

@ -316,10 +316,13 @@ class _FileSelectionActionWidgetState extends State<FileSelectionActionWidget> {
widget.selectedFiles
.unSelectAll(split.ownedByOtherUsers.toSet(), skipNotify: true);
}
final bool removingOthersFile =
isCollectionOwner && split.ownedByOtherUsers.isNotEmpty;
await collectionActions.showRemoveFromCollectionSheetV2(
context,
widget.collection!,
widget.selectedFiles,
removingOthersFile,
);
}