Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Use sheet contexts for cast and mail actions

Neeraj Guptabc492c294121
diff --git a/mobile/apps/photos/lib/ui/cast/cast.dart b/mobile/apps/photos/lib/ui/cast/cast.dart
index 1e1d82f816..c018002b94 100644
--- a/mobile/apps/photos/lib/ui/cast/cast.dart
+++ b/mobile/apps/photos/lib/ui/cast/cast.dart
@@ -56,7 +56,7 @@ Future<void> showCastSheet(BuildContext context, Collection collection) async {
if (!context.mounted) return;
return showBottomSheetComponent(
context: context,
- builder: (_) => BottomSheetComponent(
+ builder: (sheetContext) => BottomSheetComponent(
isScrollable: sessions.isNotEmpty,
initialChildSize: 0.6,
snapSizes: const [0.6, 1.0],
@@ -71,7 +71,8 @@ Future<void> showCastSheet(BuildContext context, Collection collection) async {
leading: const HugeIcon(icon: HugeIcons.strokeRoundedTvSmart),
shouldSurfaceExecutionStates: false,
onTap: () async {
- Navigator.of(context).pop();
+ Navigator.of(sheetContext).pop();
+ if (!context.mounted) return;
await showPairWithAutoSheet(context, collection);
},
),
@@ -83,7 +84,8 @@ Future<void> showCastSheet(BuildContext context, Collection collection) async {
leading: const HugeIcon(icon: HugeIcons.strokeRoundedTv02),
shouldSurfaceExecutionStates: false,
onTap: () async {
- Navigator.of(context).pop();
+ Navigator.of(sheetContext).pop();
+ if (!context.mounted) return;
await showPairWithCodeSheet(context, collection);
},
),
diff --git a/mobile/apps/photos/lib/utils/email_util.dart b/mobile/apps/photos/lib/utils/email_util.dart
index 56abcfdcb4..a466df15c6 100644
--- a/mobile/apps/photos/lib/utils/email_util.dart
+++ b/mobile/apps/photos/lib/utils/email_util.dart
@@ -347,8 +347,10 @@ Future<bool> sendComposedEmail(
if (!context.mounted) return false;
await showCupertinoModalPopup(
context: context,
- builder: (_) => CupertinoActionSheet(
- title: Text(AppLocalizations.of(context).selectMailApp + " \n $to"),
+ builder: (sheetContext) => CupertinoActionSheet(
+ title: Text(
+ AppLocalizations.of(sheetContext).selectMailApp + " \n $to",
+ ),
actions: [
for (final app in result.options)
CupertinoActionSheetAction(
@@ -358,16 +360,16 @@ Future<bool> sendComposedEmail(
mailApp: app,
emailContent: emailContent,
);
- if (context.mounted) {
- Navigator.of(context).pop();
+ if (sheetContext.mounted) {
+ Navigator.of(sheetContext).pop();
}
},
),
],
cancelButton: CupertinoActionSheetAction(
- child: Text(AppLocalizations.of(context).cancel),
+ child: Text(AppLocalizations.of(sheetContext).cancel),
onPressed: () {
- Navigator.of(context).pop();
+ Navigator.of(sheetContext).pop();
},
),
),