π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Migrate SnackBar to Toast notifications
ashilkn1b81d17d2c56
diff --git a/mobile/apps/locker/lib/services/favorites_service.dart b/mobile/apps/locker/lib/services/favorites_service.dartindex e5dcea3bca..87068f5da1 100644--- a/mobile/apps/locker/lib/services/favorites_service.dart+++ b/mobile/apps/locker/lib/services/favorites_service.dart@@ -247,10 +247,7 @@ class FavoritesService {}// If no other collection found, move to uncategorized- if (targetCollection == null) {- targetCollection =- await _collectionService.getOrCreateUncategorizedCollection();- }+ targetCollection ??= await _collectionService.getOrCreateUncategorizedCollection();await _collectionService.move(file,diff --git a/mobile/apps/locker/lib/ui/components/add_to_collection_dialog.dart b/mobile/apps/locker/lib/ui/components/add_to_collection_dialog.dartindex 9b477a3277..9f9ddf29e2 100644--- a/mobile/apps/locker/lib/ui/components/add_to_collection_dialog.dart+++ b/mobile/apps/locker/lib/ui/components/add_to_collection_dialog.dart@@ -1,12 +1,12 @@import "package:ente_ui/components/title_bar_title_widget.dart";import "package:ente_ui/theme/ente_theme.dart";+import "package:ente_ui/utils/toast_util.dart";import "package:flutter/material.dart";import "package:locker/l10n/l10n.dart";import "package:locker/services/collections/models/collection.dart";import "package:locker/ui/components/collection_selection_widget.dart";import "package:locker/ui/components/gradient_button.dart";import "package:locker/utils/collection_list_util.dart";-import "package:locker/utils/snack_bar_utils.dart";class AddToCollectionDialogResult {final List<Collection> selectedCollections;@@ -66,7 +66,7 @@ class _AddToCollectionDialogState extends State<AddToCollectionDialog> {.toList();if (selectedCollections.isEmpty) {- SnackBarUtils.showWarningSnackBar(+ showToast(widget.snackBarContext,widget.snackBarContext.l10n.pleaseSelectAtLeastOneCollection,);diff --git a/mobile/apps/locker/lib/ui/components/delete_share_link_dialog.dart b/mobile/apps/locker/lib/ui/components/delete_share_link_dialog.dartindex 539cd29466..a73b0ec2a3 100644--- a/mobile/apps/locker/lib/ui/components/delete_share_link_dialog.dart+++ b/mobile/apps/locker/lib/ui/components/delete_share_link_dialog.dart@@ -1,10 +1,10 @@import "package:ente_ui/components/buttons/button_widget.dart";import "package:ente_ui/components/buttons/models/button_type.dart";import "package:ente_ui/utils/dialog_util.dart";+import "package:ente_ui/utils/toast_util.dart";import "package:flutter/material.dart";import "package:locker/l10n/l10n.dart";import "package:locker/services/files/links/links_service.dart";-import "package:locker/utils/snack_bar_utils.dart";Future<void> deleteShareLink(BuildContext context, int fileID) async {final result = await showChoiceDialog(@@ -29,7 +29,7 @@ Future<void> deleteShareLink(BuildContext context, int fileID) async {await dialog.hide();if (context.mounted) {- SnackBarUtils.showInfoSnackBar(+ showToast(context,context.l10n.shareLinkDeletedSuccessfully,);@@ -38,7 +38,7 @@ Future<void> deleteShareLink(BuildContext context, int fileID) async {await dialog.hide();if (context.mounted) {- SnackBarUtils.showWarningSnackBar(+ showToast(context,'${context.l10n.failedToDeleteShareLink}: ${e.toString()}',);diff --git a/mobile/apps/locker/lib/ui/components/file_edit_dialog.dart b/mobile/apps/locker/lib/ui/components/file_edit_dialog.dartindex 6683a61c46..4739a8be39 100644--- a/mobile/apps/locker/lib/ui/components/file_edit_dialog.dart+++ b/mobile/apps/locker/lib/ui/components/file_edit_dialog.dart@@ -1,5 +1,6 @@import "package:ente_ui/components/title_bar_title_widget.dart";import 'package:ente_ui/theme/ente_theme.dart';+import 'package:ente_ui/utils/toast_util.dart';import 'package:flutter/material.dart';import 'package:locker/l10n/l10n.dart';import 'package:locker/services/collections/collections_service.dart';@@ -9,7 +10,6 @@ import 'package:locker/ui/components/collection_selection_widget.dart';import 'package:locker/ui/components/form_text_input_widget.dart';import "package:locker/ui/components/gradient_button.dart";import 'package:locker/utils/collection_list_util.dart';-import 'package:locker/utils/snack_bar_utils.dart';class FileEditDialogResult {final String title;@@ -126,7 +126,7 @@ class _FileEditDialogState extends State<FileEditDialog> {.toList();if (selectedCollections.isEmpty) {- SnackBarUtils.showWarningSnackBar(+ showToast(widget.snackBarContext,widget.snackBarContext.l10n.pleaseSelectAtLeastOneCollection,);diff --git a/mobile/apps/locker/lib/ui/components/file_restore_dialog.dart b/mobile/apps/locker/lib/ui/components/file_restore_dialog.dartindex 3d927a8a26..b603817da3 100644--- a/mobile/apps/locker/lib/ui/components/file_restore_dialog.dart+++ b/mobile/apps/locker/lib/ui/components/file_restore_dialog.dart@@ -1,12 +1,12 @@import "package:ente_ui/components/title_bar_title_widget.dart";import 'package:ente_ui/theme/ente_theme.dart';+import 'package:ente_ui/utils/toast_util.dart';import 'package:flutter/material.dart';import 'package:locker/l10n/l10n.dart';import 'package:locker/services/collections/models/collection.dart';import 'package:locker/services/files/sync/models/file.dart';import 'package:locker/ui/components/collection_selection_widget.dart';import "package:locker/ui/components/gradient_button.dart";-import 'package:locker/utils/snack_bar_utils.dart';class FileRestoreDialogResult {final List<Collection> selectedCollections;@@ -69,7 +69,7 @@ class _FileRestoreDialogState extends State<FileRestoreDialog> {.toList();if (selectedCollections.isEmpty) {- SnackBarUtils.showWarningSnackBar(+ showToast(context,context.l10n.pleaseSelectAtLeastOneCollection,);diff --git a/mobile/apps/locker/lib/ui/components/file_upload_dialog.dart b/mobile/apps/locker/lib/ui/components/file_upload_dialog.dartindex 434b428db5..dd30ba11df 100644--- a/mobile/apps/locker/lib/ui/components/file_upload_dialog.dart+++ b/mobile/apps/locker/lib/ui/components/file_upload_dialog.dart@@ -5,12 +5,12 @@ import 'package:ente_ui/components/buttons/models/button_type.dart';import 'package:ente_ui/components/text_input_widget.dart';import "package:ente_ui/components/title_bar_title_widget.dart";import 'package:ente_ui/theme/ente_theme.dart';+import 'package:ente_ui/utils/toast_util.dart';import 'package:flutter/material.dart';import 'package:locker/l10n/l10n.dart';import 'package:locker/services/collections/models/collection.dart';import 'package:locker/ui/components/collection_selection_widget.dart';import 'package:locker/utils/file_icon_utils.dart';-import 'package:locker/utils/snack_bar_utils.dart';import 'package:path/path.dart' as path;class FileUploadDialogResult {@@ -85,7 +85,7 @@ class _FileUploadDialogState extends State<FileUploadDialog> {.toList();if (selectedCollections.isEmpty) {- SnackBarUtils.showWarningSnackBar(+ showToast(context,context.l10n.pleaseSelectAtLeastOneCollection,);diff --git a/mobile/apps/locker/lib/ui/pages/account_credentials_page.dart b/mobile/apps/locker/lib/ui/pages/account_credentials_page.dartindex cce79a19b5..c0f27f234f 100644--- a/mobile/apps/locker/lib/ui/pages/account_credentials_page.dart+++ b/mobile/apps/locker/lib/ui/pages/account_credentials_page.dart@@ -1,3 +1,4 @@+import 'package:ente_ui/utils/toast_util.dart';import 'package:flutter/material.dart';import 'package:flutter/services.dart';import 'package:locker/l10n/l10n.dart';@@ -241,12 +242,9 @@ class _AccountCredentialsPageState}Clipboard.setData(ClipboardData(text: value));if (!mounted) return;- ScaffoldMessenger.of(context).showSnackBar(- SnackBar(- content: Text(context.l10n.copiedToClipboard(label)),- duration: const Duration(seconds: 2),- backgroundColor: Colors.green,- ),+ showToast(+ context,+ context.l10n.copiedToClipboard(label),);}}diff --git a/mobile/apps/locker/lib/ui/pages/base_info_page.dart b/mobile/apps/locker/lib/ui/pages/base_info_page.dartindex c20c0559b6..cb0135313e 100644--- a/mobile/apps/locker/lib/ui/pages/base_info_page.dart+++ b/mobile/apps/locker/lib/ui/pages/base_info_page.dart@@ -1,6 +1,7 @@import 'package:dio/dio.dart';import "package:ente_ui/components/title_bar_title_widget.dart";import 'package:ente_ui/theme/ente_theme.dart';+import 'package:ente_ui/utils/toast_util.dart';import 'package:flutter/material.dart';import 'package:flutter/services.dart';import 'package:locker/l10n/l10n.dart';@@ -255,11 +256,9 @@ abstract class BaseInfoPageState<T extends InfoData, W extends BaseInfoPage<T>>_currentMode = InfoPageMode.view;});- ScaffoldMessenger.of(context).showSnackBar(- SnackBar(- content: Text(context.l10n.recordSavedSuccessfully),- backgroundColor: Colors.green,- ),+ showToast(+ context,+ context.l10n.recordSavedSuccessfully,);}}@@ -276,13 +275,9 @@ abstract class BaseInfoPageState<T extends InfoData, W extends BaseInfoPage<T>>return e.toString();}();- ScaffoldMessenger.of(context).showSnackBar(- SnackBar(- content: Text(- '${context.l10n.failedToSaveRecord}: $errorDetails',- ),- backgroundColor: Colors.red,- ),+ showToast(+ context,+ '${context.l10n.failedToSaveRecord}: $errorDetails',);}} finally {@@ -327,11 +322,9 @@ abstract class BaseInfoPageState<T extends InfoData, W extends BaseInfoPage<T>>Future<void> _createNewFile(InfoItem infoItem) async {if (_selectedCollectionIds.isEmpty) {- ScaffoldMessenger.of(context).showSnackBar(- SnackBar(- content: Text(context.l10n.pleaseSelectAtLeastOneCollection),- backgroundColor: Colors.red,- ),+ showToast(+ context,+ context.l10n.pleaseSelectAtLeastOneCollection,);return;}@@ -374,11 +367,9 @@ abstract class BaseInfoPageState<T extends InfoData, W extends BaseInfoPage<T>>// Show success message after navigationFuture.delayed(const Duration(milliseconds: 100), () {if (mounted) {- ScaffoldMessenger.of(context).showSnackBar(- SnackBar(- content: Text(message),- backgroundColor: Colors.green,- ),+ showToast(+ context,+ message,);}});@@ -394,12 +385,9 @@ abstract class BaseInfoPageState<T extends InfoData, W extends BaseInfoPage<T>>void _copyToClipboard(String text, String fieldName) {Clipboard.setData(ClipboardData(text: text));- ScaffoldMessenger.of(context).showSnackBar(- SnackBar(- content: Text(context.l10n.copiedToClipboard(fieldName)),- duration: const Duration(seconds: 2),- backgroundColor: Colors.green,- ),+ showToast(+ context,+ context.l10n.copiedToClipboard(fieldName),);}diff --git a/mobile/apps/locker/lib/ui/pages/personal_note_page.dart b/mobile/apps/locker/lib/ui/pages/personal_note_page.dartindex 67e1bcbddf..c1428e0c13 100644--- a/mobile/apps/locker/lib/ui/pages/personal_note_page.dart+++ b/mobile/apps/locker/lib/ui/pages/personal_note_page.dart@@ -1,6 +1,7 @@import 'dart:math' as math;import 'package:ente_ui/theme/ente_theme.dart';+import 'package:ente_ui/utils/toast_util.dart';import 'package:flutter/material.dart';import 'package:flutter/services.dart';import 'package:intl/intl.dart';@@ -458,12 +459,9 @@ class _PersonalNotePageStatereturn;}Clipboard.setData(ClipboardData(text: contentText));- ScaffoldMessenger.of(context).showSnackBar(- SnackBar(- content: Text(context.l10n.copiedToClipboard(context.l10n.note)),- duration: const Duration(seconds: 2),- backgroundColor: Colors.green,- ),+ showToast(+ context,+ context.l10n.copiedToClipboard(context.l10n.note),);}diff --git a/mobile/apps/locker/lib/ui/pages/physical_records_page.dart b/mobile/apps/locker/lib/ui/pages/physical_records_page.dartindex 64681232eb..3b7e733c74 100644--- a/mobile/apps/locker/lib/ui/pages/physical_records_page.dart+++ b/mobile/apps/locker/lib/ui/pages/physical_records_page.dart@@ -1,3 +1,4 @@+import 'package:ente_ui/utils/toast_util.dart';import 'package:flutter/material.dart';import 'package:flutter/services.dart';import 'package:locker/l10n/l10n.dart';@@ -165,12 +166,9 @@ class _PhysicalRecordsPageState}Clipboard.setData(ClipboardData(text: value));if (!mounted) return;- ScaffoldMessenger.of(context).showSnackBar(- SnackBar(- content: Text(context.l10n.copiedToClipboard(label)),- duration: const Duration(seconds: 2),- backgroundColor: Colors.green,- ),+ showToast(+ context,+ context.l10n.copiedToClipboard(label),);}diff --git a/mobile/apps/locker/lib/ui/pages/trash_page.dart b/mobile/apps/locker/lib/ui/pages/trash_page.dartindex d527f449b9..d2c31b51dc 100644--- a/mobile/apps/locker/lib/ui/pages/trash_page.dart+++ b/mobile/apps/locker/lib/ui/pages/trash_page.dart@@ -4,6 +4,7 @@ import "package:ente_ui/theme/colors.dart";import 'package:ente_ui/theme/ente_theme.dart';import "package:ente_ui/theme/text_style.dart";import 'package:ente_ui/utils/dialog_util.dart';+import 'package:ente_ui/utils/toast_util.dart';import 'package:flutter/material.dart';import "package:hugeicons/hugeicons.dart";import 'package:locker/l10n/l10n.dart';@@ -17,7 +18,6 @@ import "package:locker/ui/components/empty_state_widget.dart";import 'package:locker/ui/components/file_restore_dialog.dart';import 'package:locker/ui/components/item_list_view.dart';import 'package:locker/utils/collection_list_util.dart';-import 'package:locker/utils/snack_bar_utils.dart';class TrashPage extends StatefulWidget {final List<TrashFile> trashFiles;@@ -81,7 +81,7 @@ class _TrashPageState extends State<TrashPage> {);if (availableCollections.isEmpty) {- SnackBarUtils.showWarningSnackBar(+ showToast(context,context.l10n.noCollectionsAvailableForRestore,);@@ -109,12 +109,12 @@ class _TrashPageState extends State<TrashPage> {_sortedTrashFiles.remove(file);_allTrashFiles.remove(file);});- SnackBarUtils.showWarningSnackBar(+ showToast(context,context.l10n.deletedPermanently(file.displayName),);}).catchError((error) {- SnackBarUtils.showWarningSnackBar(+ showToast(context,context.l10n.failedToDeleteFile(error.toString()),);@@ -144,7 +144,7 @@ class _TrashPageState extends State<TrashPage> {await dialog.hide();- SnackBarUtils.showInfoSnackBar(+ showToast(context,context.l10n.restoredFileToCollection(file.displayName,@@ -154,7 +154,7 @@ class _TrashPageState extends State<TrashPage> {} catch (error) {await dialog.hide();- SnackBarUtils.showWarningSnackBar(+ showToast(context,context.l10n.failedToRestoreFile(file.displayName, error.toString()),);@@ -188,13 +188,13 @@ class _TrashPageState extends State<TrashPage> {_sortedTrashFiles.clear();_allTrashFiles.clear();});- SnackBarUtils.showInfoSnackBar(+ showToast(context,context.l10n.trashClearedSuccessfully,);Navigator.of(context).pop();} catch (error) {- SnackBarUtils.showWarningSnackBar(+ showToast(context,context.l10n.failedToClearTrash(error.toString()),);diff --git a/mobile/apps/locker/lib/ui/viewer/actions/file_selection_overlay_bar.dart b/mobile/apps/locker/lib/ui/viewer/actions/file_selection_overlay_bar.dartindex ea332259e6..e735e45dae 100644--- a/mobile/apps/locker/lib/ui/viewer/actions/file_selection_overlay_bar.dart+++ b/mobile/apps/locker/lib/ui/viewer/actions/file_selection_overlay_bar.dart@@ -2,6 +2,7 @@ import "package:ente_events/event_bus.dart";import "package:ente_ui/components/buttons/button_widget.dart";import "package:ente_ui/theme/ente_theme.dart";import "package:ente_ui/utils/dialog_util.dart";+import "package:ente_ui/utils/toast_util.dart";import "package:flutter/material.dart";import "package:hugeicons/hugeicons.dart";import "package:locker/events/collections_updated_event.dart";@@ -17,7 +18,6 @@ import "package:locker/ui/components/selection_action_button_widget.dart";import "package:locker/utils/collection_list_util.dart";import "package:locker/utils/file_actions.dart";import "package:locker/utils/file_util.dart";-import "package:locker/utils/snack_bar_utils.dart";import "package:logging/logging.dart";class FileSelectionOverlayBar extends StatefulWidget {@@ -415,7 +415,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {} catch (e, stackTrace) {_logger.severe("Failed to download files: $e", e, stackTrace);if (context.mounted) {- SnackBarUtils.showWarningSnackBar(+ showToast(context,context.l10n.failedToDownloadOrDecrypt,);@@ -424,7 +424,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {}void _shareMultipleFiles(BuildContext context) {- SnackBarUtils.showWarningSnackBar(+ showToast(context,"Sharing multiple files is coming soon",);@@ -517,7 +517,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {if (addFutures.isEmpty) {await dialog.hide();- SnackBarUtils.showInfoSnackBar(+ showToast(context,context.l10n.noChangesWereMade,);@@ -534,7 +534,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {widget.selectedFiles.clearAll();- SnackBarUtils.showInfoSnackBar(+ showToast(context,context.l10n.fileUpdatedSuccessfully,);@@ -544,7 +544,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {'Failed add-to operation: $e',);- SnackBarUtils.showWarningSnackBar(+ showToast(context,context.l10n.failedToUpdateFile(e.toString()),);@@ -605,7 +605,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {widget.selectedFiles.clearAll();- SnackBarUtils.showInfoSnackBar(+ showToast(context,context.l10n.fileDeletedSuccessfully,);@@ -636,7 +636,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {} catch (e, stackTrace) {_logger.severe("Failed to download file: $e", e, stackTrace);if (context.mounted) {- SnackBarUtils.showWarningSnackBar(+ showToast(context,context.l10n.failedToDownloadOrDecrypt,);@@ -671,7 +671,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {final message = _isImportant? "File marked as important": "File removed from important";- SnackBarUtils.showInfoSnackBar(context, message);+ showToast(context, message);}} catch (e, stackTrace) {_logger.severe("Failed to toggle important status: $e", e, stackTrace);@@ -680,7 +680,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {if (context.mounted) {final errorMessage ='Failed to update important status: ${e.toString()}';- SnackBarUtils.showWarningSnackBar(context, errorMessage);+ showToast(context, errorMessage);}}}@@ -709,7 +709,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {if (filesToMark.isEmpty) {await dialog.hide();if (context.mounted) {- SnackBarUtils.showInfoSnackBar(+ showToast(context,"All files are already marked as important",);@@ -731,7 +731,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {final message = filesToMark.length == 1? "1 file marked as important": "${filesToMark.length} files marked as important";- SnackBarUtils.showInfoSnackBar(context, message);+ showToast(context, message);}} catch (e, stackTrace) {_logger.severe(@@ -744,7 +744,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {if (context.mounted) {final errorMessage ='Failed to mark files as important: ${e.toString()}';- SnackBarUtils.showWarningSnackBar(context, errorMessage);+ showToast(context, errorMessage);}}}diff --git a/mobile/apps/locker/lib/utils/collection_actions.dart b/mobile/apps/locker/lib/utils/collection_actions.dartindex 74c4c1cff5..d0e11063b3 100644--- a/mobile/apps/locker/lib/utils/collection_actions.dart+++ b/mobile/apps/locker/lib/utils/collection_actions.dart@@ -23,7 +23,6 @@ import "package:locker/services/configuration.dart";import "package:locker/services/trash/trash_service.dart";import "package:locker/ui/components/delete_confirmation_dialog.dart";import "package:locker/ui/components/input_dialog_sheet.dart";-import 'package:locker/utils/snack_bar_utils.dart';import 'package:logging/logging.dart';/// Utility class for common collection actions like edit and delete@@ -95,7 +94,7 @@ class CollectionActions {await CollectionService.instance.rename(collection, newName);await progressDialog.hide();- SnackBarUtils.showInfoSnackBar(+ showToast(context,context.l10n.collectionRenamedSuccessfully,);@@ -108,7 +107,7 @@ class CollectionActions {} catch (error) {await progressDialog.hide();- SnackBarUtils.showWarningSnackBar(+ showToast(context,context.l10n.failedToRenameCollection(error.toString()),);@@ -204,7 +203,7 @@ class CollectionActions {);}- SnackBarUtils.showInfoSnackBar(+ showToast(context,"${collections.length} collections deleted successfully",);@@ -220,7 +219,7 @@ class CollectionActions {} catch (error) {await progressDialog.hide();- SnackBarUtils.showWarningSnackBar(+ showToast(context,context.l10n.failedToDeleteCollection(error.toString()),);@@ -235,7 +234,7 @@ class CollectionActions {}) async {final l10n = context.l10n;if (!collection.type.canDelete) {- SnackBarUtils.showWarningSnackBar(+ showToast(context,l10n.collectionCannotBeDeleted,);@@ -253,7 +252,7 @@ class CollectionActions {await progressDialog.hide();- SnackBarUtils.showInfoSnackBar(+ showToast(context,l10n.collectionDeletedSuccessfully,);@@ -263,7 +262,7 @@ class CollectionActions {} catch (error) {await progressDialog.hide();- SnackBarUtils.showWarningSnackBar(+ showToast(context,l10n.failedToDeleteCollection(error.toString()),);@@ -299,7 +298,7 @@ class CollectionActions {await progressDialog.hide();- SnackBarUtils.showInfoSnackBar(+ showToast(context,l10n.collectionDeletedSuccessfully,);@@ -309,7 +308,7 @@ class CollectionActions {} catch (error) {await progressDialog.hide();- SnackBarUtils.showWarningSnackBar(+ showToast(context,l10n.failedToDeleteCollection(error.toString()),);@@ -355,7 +354,7 @@ class CollectionActions {} else if (actionResult.action == ButtonAction.first) {onSuccess?.call();Navigator.of(context).pop();- SnackBarUtils.showInfoSnackBar(+ showToast(context,"Leave collection successfully",);@@ -404,7 +403,7 @@ class CollectionActions {} else if (actionResult.action == ButtonAction.first) {onSuccess?.call();Navigator.of(context).pop();- SnackBarUtils.showInfoSnackBar(+ showToast(context,"Leave collection successfully",);diff --git a/mobile/apps/locker/lib/utils/file_actions.dart b/mobile/apps/locker/lib/utils/file_actions.dartindex 9ad385f7cf..50640d8ae1 100644--- a/mobile/apps/locker/lib/utils/file_actions.dart+++ b/mobile/apps/locker/lib/utils/file_actions.dart@@ -1,5 +1,6 @@import "package:ente_ui/components/buttons/button_widget.dart";import "package:ente_ui/utils/dialog_util.dart";+import "package:ente_ui/utils/toast_util.dart";import "package:flutter/material.dart";import "package:locker/l10n/l10n.dart";import "package:locker/services/collections/collections_service.dart";@@ -12,7 +13,6 @@ import "package:locker/ui/components/delete_confirmation_dialog.dart";import "package:locker/ui/components/file_edit_dialog.dart";import "package:locker/ui/components/share_link_dialog.dart";import "package:locker/utils/collection_list_util.dart";-import "package:locker/utils/snack_bar_utils.dart";import "package:logging/logging.dart";/// Utility class for common file actions like edit, share, and delete@@ -94,7 +94,7 @@ class FileActions {return;}- SnackBarUtils.showInfoSnackBar(+ showToast(context,context.l10n.fileUpdatedSuccessfully,);@@ -106,7 +106,7 @@ class FileActions {return;}- SnackBarUtils.showWarningSnackBar(+ showToast(context,context.l10n.failedToUpdateFile(e.toString()),);@@ -115,7 +115,7 @@ class FileActions {if (!context.mounted) {return;}- SnackBarUtils.showWarningSnackBar(+ showToast(context,context.l10n.noChangesWereMade,);@@ -153,7 +153,7 @@ class FileActions {await dialog.hide();if (context.mounted) {- SnackBarUtils.showWarningSnackBar(+ showToast(context,'${context.l10n.failedToCreateShareLink}: ${e.toString()}',);@@ -197,7 +197,7 @@ class FileActions {await dialog.hide();if (context.mounted) {- SnackBarUtils.showInfoSnackBar(+ showToast(context,context.l10n.fileDeletedSuccessfully,);@@ -208,7 +208,7 @@ class FileActions {await dialog.hide();if (context.mounted) {- SnackBarUtils.showWarningSnackBar(+ showToast(context,context.l10n.failedToDeleteFile(e.toString()),);@@ -266,7 +266,7 @@ class FileActions {await dialog.hide();if (context.mounted) {- SnackBarUtils.showInfoSnackBar(+ showToast(context,context.l10n.fileDeletedSuccessfully,);diff --git a/mobile/apps/locker/lib/utils/file_util.dart b/mobile/apps/locker/lib/utils/file_util.dartindex 03a2b04f82..f8c7be1716 100644--- a/mobile/apps/locker/lib/utils/file_util.dart+++ b/mobile/apps/locker/lib/utils/file_util.dart@@ -4,6 +4,7 @@ import "dart:typed_data";import "package:ente_ui/components/progress_dialog.dart";import "package:ente_ui/utils/dialog_util.dart";+import "package:ente_ui/utils/toast_util.dart";import "package:flutter/material.dart";import "package:locker/l10n/l10n.dart";import "package:locker/models/info/info_item.dart";@@ -17,7 +18,6 @@ import "package:locker/ui/pages/base_info_page.dart";import "package:locker/ui/pages/emergency_contact_page.dart";import "package:locker/ui/pages/personal_note_page.dart";import "package:locker/ui/pages/physical_records_page.dart";-import "package:locker/utils/snack_bar_utils.dart";import "package:logging/logging.dart";import "package:open_file/open_file.dart";import "package:path/path.dart" as p;@@ -103,7 +103,7 @@ class FileUtil {}if (!(Platform.isAndroid || Platform.isIOS)) {- SnackBarUtils.showWarningSnackBar(+ showToast(context,'Downloads are only supported on Android and iOS',);@@ -180,19 +180,19 @@ class FileUtil {? '${savedNames.first} saved to Downloads': '${savedNames.length} files saved to Downloads';_logger.info('Files saved: $savedPaths');- SnackBarUtils.showInfoSnackBar(context, message);+ showToast(context, message);}return true;} catch (e, s) {_logger.severe('Failed to save files to Downloads', e, s);if (e is UnsupportedError) {- SnackBarUtils.showWarningSnackBar(+ showToast(context,'This file type is not supported for download',);} else {- SnackBarUtils.showWarningSnackBar(+ showToast(context,context.l10n.failedToDownloadOrDecrypt,);diff --git a/mobile/apps/locker/lib/utils/snack_bar_utils.dart b/mobile/apps/locker/lib/utils/snack_bar_utils.dartdeleted file mode 100644index b825ce06dd..0000000000--- a/mobile/apps/locker/lib/utils/snack_bar_utils.dart+++ /dev/null@@ -1,41 +0,0 @@-import 'package:ente_ui/theme/ente_theme.dart';-import 'package:flutter/material.dart';--class SnackBarUtils {- static void showInfoSnackBar(BuildContext context, String message) {- if (!context.mounted) return;- final colorScheme = getEnteColorScheme(context);- _showSnackBar(- context,- message,- backgroundColor: colorScheme.primary500,- );- }-- static void showWarningSnackBar(BuildContext context, String message) {- if (!context.mounted) return;- final colorScheme = getEnteColorScheme(context);- _showSnackBar(- context,- message,- backgroundColor: colorScheme.warning500,- );- }-- static void _showSnackBar(- BuildContext context,- String message, {- Color? backgroundColor,- }) {- if (!context.mounted) return;-- final colorScheme = getEnteColorScheme(context);-- ScaffoldMessenger.of(context).showSnackBar(- SnackBar(- content: Text(message),- backgroundColor: backgroundColor ?? colorScheme.primary500,- ),- );- }-}