diff --git a/lib/ui/actions/collection/collection_sharing_actions.dart b/lib/ui/actions/collection/collection_sharing_actions.dart index f2ed5c399..352ee0fd9 100644 --- a/lib/ui/actions/collection/collection_sharing_actions.dart +++ b/lib/ui/actions/collection/collection_sharing_actions.dart @@ -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'; @@ -269,6 +271,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"); @@ -321,10 +324,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: [ + 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) { diff --git a/lib/ui/components/action_sheet_widget.dart b/lib/ui/components/action_sheet_widget.dart index 737c80acd..305905a33 100644 --- a/lib/ui/components/action_sheet_widget.dart +++ b/lib/ui/components/action_sheet_widget.dart @@ -23,6 +23,7 @@ Future showActionSheet({ bool isDismissible = true, bool isCheckIconGreen = false, String? title, + Widget? bodyWidget, String? body, String? bodyHighlight, }) { @@ -36,6 +37,7 @@ Future showActionSheet({ builder: (_) { return ActionSheetWidget( title: title, + bodyWidget: bodyWidget, body: body, bodyHighlight: bodyHighlight, actionButtons: buttons, @@ -48,6 +50,7 @@ Future showActionSheet({ class ActionSheetWidget extends StatelessWidget { final String? title; + final Widget? bodyWidget; final String? body; final String? bodyHighlight; final List actionButtons; @@ -59,6 +62,7 @@ class ActionSheetWidget extends StatelessWidget { required this.actionSheetType, required this.isCheckIconGreen, this.title, + this.bodyWidget, this.body, this.bodyHighlight, super.key, @@ -66,7 +70,8 @@ class ActionSheetWidget extends StatelessWidget { @override Widget build(BuildContext context) { - final isTitleAndBodyNull = title == null && body == null; + final isTitleAndBodyNull = + title == null && bodyWidget == null && body == null; final blur = MediaQuery.of(context).platformBrightness == Brightness.light ? blurMuted : blurBase; @@ -103,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, @@ -125,14 +131,17 @@ class ActionSheetWidget extends StatelessWidget { class ContentContainerWidget extends StatelessWidget { final String? title; + final Widget? bodyWidget; final String? body; final String? bodyHighlight; final ActionSheetType actionSheetType; final bool isCheckIconGreen; + const ContentContainerWidget({ required this.actionSheetType, required this.isCheckIconGreen, this.title, + this.bodyWidget, this.body, this.bodyHighlight, super.key, @@ -141,6 +150,8 @@ class ContentContainerWidget extends StatelessWidget { @override 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 @@ -155,17 +166,19 @@ class ContentContainerWidget extends StatelessWidget { style: textTheme.largeBold .copyWith(color: textBaseDark), //constant color ), - title == null || body == null + title == null || bodyMissing ? const SizedBox.shrink() : const SizedBox(height: 19), actionSheetType == ActionSheetType.defaultActionSheet - ? body == null + ? bodyMissing ? const SizedBox.shrink() - : Text( - body!, - style: textTheme.body - .copyWith(color: textMutedDark), //constant color - ) + : (bodyWidget != null + ? bodyWidget! + : Text( + body!, + style: textTheme.body + .copyWith(color: textMutedDark), //constant color + )) : Icon( Icons.check_outlined, size: 48,