Update delete album copy

This commit is contained in:
Neeraj Gupta 2023-01-26 10:53:50 +05:30
parent d369052b4d
commit 78c1ce8aa0
No known key found for this signature in database
GPG key ID: 3C5A1684DC1729E1
2 changed files with 23 additions and 4 deletions

View file

@ -11,6 +11,8 @@ import 'package:photos/models/magic_metadata.dart';
import 'package:photos/services/collections_service.dart';
import 'package:photos/services/hidden_service.dart';
import 'package:photos/services/user_service.dart';
import 'package:photos/theme/colors.dart';
import 'package:photos/theme/ente_theme.dart';
import 'package:photos/ui/components/action_sheet_widget.dart';
import 'package:photos/ui/components/button_widget.dart';
import 'package:photos/ui/components/models/button_type.dart';
@ -270,6 +272,7 @@ class CollectionActions {
BuildContext bContext,
Collection collection,
) async {
final textTheme = getEnteTextTheme(bContext);
final currentUserID = Configuration.instance.getUserID()!;
if (collection.owner!.id != currentUserID) {
throw AssertionError("Can not delete album owned by others");
@ -322,10 +325,24 @@ class CollectionActions {
isInAlert: true,
),
],
title: "Delete album?",
body: "This album will be deleted. Do you also want to delete the "
"photos (and videos) that are present in this album?",
bodyHighlight: "They will be deleted from all albums.",
bodyWidget: RichText(
text: TextSpan(
style: textTheme.body.copyWith(color: textMutedDark),
children: <TextSpan>[
const TextSpan(
text: 'Also delete the photos (and videos) present in this '
'album from ',
),
TextSpan(
text: 'all',
style: textTheme.body.copyWith(color: textBaseDark),
),
const TextSpan(
text: ' other albums they are part of?',
),
],
),
),
actionSheetType: ActionSheetType.defaultActionSheet,
);
if (actionResult != null && actionResult == ButtonAction.error) {

View file

@ -108,6 +108,7 @@ class ActionSheetWidget extends StatelessWidget {
padding: const EdgeInsets.only(bottom: 28),
child: ContentContainerWidget(
title: title,
bodyWidget: bodyWidget,
body: body,
bodyHighlight: bodyHighlight,
actionSheetType: actionSheetType,
@ -150,6 +151,7 @@ class ContentContainerWidget extends StatelessWidget {
Widget build(BuildContext context) {
final textTheme = getEnteTextTheme(context);
final bool bodyMissing = body == null && bodyWidget == null;
debugPrint("body missing $bodyMissing");
return Column(
mainAxisSize: MainAxisSize.min,
//todo: set cross axis to center when icon should be shown in place of body