Explorar el Código

Fix more lint issues

Neeraj Gupta hace 3 años
padre
commit
6a0e7b2315
Se han modificado 33 ficheros con 310 adiciones y 526 borrados
  1. 3 0
      analysis_options.yaml
  2. 6 6
      lib/events/sync_status_update_event.dart
  3. 4 4
      lib/events/tab_changed_event.dart
  4. 4 4
      lib/models/galleryType.dart
  5. 0 3
      lib/services/favorites_service.dart
  6. 10 19
      lib/services/local_sync_service.dart
  7. 27 53
      lib/services/remote_sync_service.dart
  8. 4 5
      lib/services/sync_service.dart
  9. 6 13
      lib/ui/account/login_page.dart
  10. 18 29
      lib/ui/account/password_reentry_page.dart
  11. 6 8
      lib/ui/account/recovery_page.dart
  12. 2 2
      lib/ui/collections_gallery_widget.dart
  13. 2 5
      lib/ui/common/bottomShadow.dart
  14. 33 69
      lib/ui/home_widget.dart
  15. 3 6
      lib/ui/loading_photos_widget.dart
  16. 9 23
      lib/ui/nav_bar.dart
  17. 25 43
      lib/ui/shared_collections_gallery.dart
  18. 13 17
      lib/ui/status_bar_widget.dart
  19. 3 7
      lib/ui/tools/free_space_page.dart
  20. 34 36
      lib/ui/tools/set_wallpaper_dialog.dart
  21. 1 1
      lib/ui/viewer/file/custom_app_bar.dart
  22. 2 5
      lib/ui/viewer/file/exif_info_dialog.dart
  23. 2 4
      lib/ui/viewer/file/video_controls.dart
  24. 2 2
      lib/ui/viewer/gallery/collection_page.dart
  25. 7 15
      lib/ui/viewer/gallery/device_folder_page.dart
  26. 12 21
      lib/ui/viewer/gallery/gallery_app_bar_widget.dart
  27. 16 33
      lib/ui/viewer/gallery/gallery_overlay_widget.dart
  28. 6 10
      lib/ui/viewer/search/location_search_results_page.dart
  29. 1 1
      lib/ui/viewer/search/location_search_widget.dart
  30. 2 0
      lib/ui/viewer/search/search_page.dart
  31. 3 4
      lib/utils/file_sync_util.dart
  32. 43 77
      lib/utils/file_uploader.dart
  33. 1 1
      lib/utils/hex.dart

+ 3 - 0
analysis_options.yaml

@@ -41,6 +41,9 @@ analyzer:
     unused_import: error
     unused_import: error
     prefer_is_empty: warning
     prefer_is_empty: warning
     use_rethrow_when_possible: info
     use_rethrow_when_possible: info
+    unused_field: warning
+    use_key_in_widget_constructors: warning
+
 
 
     prefer_const_constructors: ignore # too many warnings
     prefer_const_constructors: ignore # too many warnings
     prefer_const_declarations: ignore # too many warnings
     prefer_const_declarations: ignore # too many warnings

+ 6 - 6
lib/events/sync_status_update_event.dart

@@ -27,12 +27,12 @@ class SyncStatusUpdate extends Event {
 }
 }
 
 
 enum SyncStatus {
 enum SyncStatus {
-  started_first_gallery_import,
-  completed_first_gallery_import,
-  applying_remote_diff,
-  preparing_for_upload,
-  in_progress,
+  startedFirstGalleryImport,
+  completedFirstGalleryImport,
+  applyingRemoteDiff,
+  preparingForUpload,
+  inProgress,
   paused,
   paused,
-  completed_backup,
+  completedBackup,
   error,
   error,
 }
 }

+ 4 - 4
lib/events/tab_changed_event.dart

@@ -16,8 +16,8 @@ class TabChangedEvent extends Event {
 }
 }
 
 
 enum TabChangedEventSource {
 enum TabChangedEventSource {
-  tab_bar,
-  page_view,
-  collections_page,
-  back_button,
+  tabBar,
+  pageView,
+  collectionsPage,
+  backButton,
 }
 }

+ 4 - 4
lib/models/galleryType.dart

@@ -2,9 +2,9 @@ enum GalleryType {
   homepage,
   homepage,
   archive,
   archive,
   trash,
   trash,
-  local_folder,
+  localFolder,
   // indicator for gallery view of collections shared with the user
   // indicator for gallery view of collections shared with the user
-  shared_collection,
-  owned_collection,
-  search_results
+  sharedCollection,
+  ownedCollection,
+  searchResults
 }
 }

+ 0 - 3
lib/services/favorites_service.dart

@@ -10,19 +10,16 @@ import 'package:photos/models/file.dart';
 import 'package:photos/services/collections_service.dart';
 import 'package:photos/services/collections_service.dart';
 import 'package:photos/services/remote_sync_service.dart';
 import 'package:photos/services/remote_sync_service.dart';
 import 'package:photos/utils/crypto_util.dart';
 import 'package:photos/utils/crypto_util.dart';
-import 'package:photos/utils/file_uploader.dart';
 
 
 class FavoritesService {
 class FavoritesService {
   Configuration _config;
   Configuration _config;
   CollectionsService _collectionsService;
   CollectionsService _collectionsService;
-  FileUploader _fileUploader;
   FilesDB _filesDB;
   FilesDB _filesDB;
   int _cachedFavoritesCollectionID;
   int _cachedFavoritesCollectionID;
 
 
   FavoritesService._privateConstructor() {
   FavoritesService._privateConstructor() {
     _config = Configuration.instance;
     _config = Configuration.instance;
     _collectionsService = CollectionsService.instance;
     _collectionsService = CollectionsService.instance;
-    _fileUploader = FileUploader.instance;
     _filesDB = FilesDB.instance;
     _filesDB = FilesDB.instance;
   }
   }
   static FavoritesService instance = FavoritesService._privateConstructor();
   static FavoritesService instance = FavoritesService._privateConstructor();

+ 10 - 19
lib/services/local_sync_service.dart

@@ -33,8 +33,7 @@ class LocalSyncService {
 
 
   LocalSyncService._privateConstructor();
   LocalSyncService._privateConstructor();
 
 
-  static final LocalSyncService instance =
-      LocalSyncService._privateConstructor();
+  static final LocalSyncService instance = LocalSyncService._privateConstructor();
 
 
   Future<void> init() async {
   Future<void> init() async {
     _prefs = await SharedPreferences.getInstance();
     _prefs = await SharedPreferences.getInstance();
@@ -86,8 +85,7 @@ class LocalSyncService {
       );
       );
     } else {
     } else {
       // Load from 0 - 01.01.2010
       // Load from 0 - 01.01.2010
-      Bus.instance
-          .fire(SyncStatusUpdate(SyncStatus.started_first_gallery_import));
+      Bus.instance.fire(SyncStatusUpdate(SyncStatus.startedFirstGalleryImport));
       var startTime = 0;
       var startTime = 0;
       var toYear = 2010;
       var toYear = 2010;
       var toTime = DateTime(toYear).microsecondsSinceEpoch;
       var toTime = DateTime(toYear).microsecondsSinceEpoch;
@@ -115,8 +113,7 @@ class LocalSyncService {
         !_prefs.getBool(kHasCompletedFirstImportKey)) {
         !_prefs.getBool(kHasCompletedFirstImportKey)) {
       await _prefs.setBool(kHasCompletedFirstImportKey, true);
       await _prefs.setBool(kHasCompletedFirstImportKey, true);
       _logger.fine("first gallery import finished");
       _logger.fine("first gallery import finished");
-      Bus.instance
-          .fire(SyncStatusUpdate(SyncStatus.completed_first_gallery_import));
+      Bus.instance.fire(SyncStatusUpdate(SyncStatus.completedFirstGalleryImport));
     }
     }
     final endTime = DateTime.now().microsecondsSinceEpoch;
     final endTime = DateTime.now().microsecondsSinceEpoch;
     final duration = Duration(microseconds: endTime - startTime);
     final duration = Duration(microseconds: endTime - startTime);
@@ -139,8 +136,7 @@ class LocalSyncService {
     );
     );
     final existingIDs = await _db.getExistingLocalFileIDs();
     final existingIDs = await _db.getExistingLocalFileIDs();
     final invalidIDs = getInvalidFileIDs().toSet();
     final invalidIDs = getInvalidFileIDs().toSet();
-    final unsyncedFiles =
-        await getUnsyncedFiles(localAssets, existingIDs, invalidIDs, _computer);
+    final unsyncedFiles = await getUnsyncedFiles(localAssets, existingIDs, invalidIDs, _computer);
     if (unsyncedFiles.isNotEmpty) {
     if (unsyncedFiles.isNotEmpty) {
       await _db.insertMultiple(unsyncedFiles);
       await _db.insertMultiple(unsyncedFiles);
       _logger.info(
       _logger.info(
@@ -203,8 +199,7 @@ class LocalSyncService {
   }
   }
 
 
   bool hasGrantedLimitedPermissions() {
   bool hasGrantedLimitedPermissions() {
-    return _prefs.getString(kPermissionStateKey) ==
-        PermissionState.limited.toString();
+    return _prefs.getString(kPermissionStateKey) == PermissionState.limited.toString();
   }
   }
 
 
   Future<void> onPermissionGranted(PermissionState state) async {
   Future<void> onPermissionGranted(PermissionState state) async {
@@ -233,12 +228,10 @@ class LocalSyncService {
     final files = await getDeviceFiles(fromTime, toTime, _computer);
     final files = await getDeviceFiles(fromTime, toTime, _computer);
     if (files.isNotEmpty) {
     if (files.isNotEmpty) {
       _logger.info("Fetched " + files.length.toString() + " files.");
       _logger.info("Fetched " + files.length.toString() + " files.");
-      final updatedFiles = files
-          .where((file) => existingLocalFileIDs.contains(file.localID))
-          .toList();
+      final updatedFiles =
+          files.where((file) => existingLocalFileIDs.contains(file.localID)).toList();
       updatedFiles.removeWhere((file) => editedFileIDs.contains(file.localID));
       updatedFiles.removeWhere((file) => editedFileIDs.contains(file.localID));
-      updatedFiles
-          .removeWhere((file) => downloadedFileIDs.contains(file.localID));
+      updatedFiles.removeWhere((file) => downloadedFileIDs.contains(file.localID));
       if (updatedFiles.isNotEmpty) {
       if (updatedFiles.isNotEmpty) {
         _logger.info(
         _logger.info(
           updatedFiles.length.toString() + " local files were updated.",
           updatedFiles.length.toString() + " local files were updated.",
@@ -276,15 +269,13 @@ class LocalSyncService {
       if (Platform.isIOS) {
       if (Platform.isIOS) {
         var assetEntity = await AssetEntity.fromId(file.localID);
         var assetEntity = await AssetEntity.fromId(file.localID);
         if (assetEntity != null) {
         if (assetEntity != null) {
-          var isLocallyAvailable =
-              await assetEntity.isLocallyAvailable(isOrigin: true);
+          var isLocallyAvailable = await assetEntity.isLocallyAvailable(isOrigin: true);
           _logger.info(
           _logger.info(
             're-upload asset ${file.toString()} with localAvailableFlag '
             're-upload asset ${file.toString()} with localAvailableFlag '
             '$isLocallyAvailable and fav ${assetEntity.isFavorite}',
             '$isLocallyAvailable and fav ${assetEntity.isFavorite}',
           );
           );
         } else {
         } else {
-          _logger
-              .info('re-upload failed to fetch assetInfo ${file.toString()}');
+          _logger.info('re-upload failed to fetch assetInfo ${file.toString()}');
         }
         }
       }
       }
     } catch (ignore) {
     } catch (ignore) {

+ 27 - 53
lib/services/remote_sync_service.dart

@@ -32,8 +32,7 @@ class RemoteSyncService {
   final _uploader = FileUploader.instance;
   final _uploader = FileUploader.instance;
   final _collectionsService = CollectionsService.instance;
   final _collectionsService = CollectionsService.instance;
   final _diffFetcher = DiffFetcher();
   final _diffFetcher = DiffFetcher();
-  final FileMigrationService _fileMigrationService =
-      FileMigrationService.instance;
+  final FileMigrationService _fileMigrationService = FileMigrationService.instance;
   int _completedUploads = 0;
   int _completedUploads = 0;
   SharedPreferences _prefs;
   SharedPreferences _prefs;
   Completer<void> _existingSync;
   Completer<void> _existingSync;
@@ -49,8 +48,7 @@ class RemoteSyncService {
 
 
   static const kMaximumPermissibleUploadsInThrottledMode = 4;
   static const kMaximumPermissibleUploadsInThrottledMode = 4;
 
 
-  static final RemoteSyncService instance =
-      RemoteSyncService._privateConstructor();
+  static final RemoteSyncService instance = RemoteSyncService._privateConstructor();
 
 
   RemoteSyncService._privateConstructor();
   RemoteSyncService._privateConstructor();
 
 
@@ -98,7 +96,7 @@ class RemoteSyncService {
           // session are not processed now
           // session are not processed now
           sync();
           sync();
         } else {
         } else {
-          Bus.instance.fire(SyncStatusUpdate(SyncStatus.completed_backup));
+          Bus.instance.fire(SyncStatusUpdate(SyncStatus.completedBackup));
         }
         }
       } else {
       } else {
         _existingSync.complete();
         _existingSync.complete();
@@ -141,11 +139,10 @@ class RemoteSyncService {
   }
   }
 
 
   Future<void> _syncUpdatedCollections(bool silently) async {
   Future<void> _syncUpdatedCollections(bool silently) async {
-    final updatedCollections =
-        await _collectionsService.getCollectionsToBeSynced();
+    final updatedCollections = await _collectionsService.getCollectionsToBeSynced();
 
 
     if (updatedCollections.isNotEmpty && !silently) {
     if (updatedCollections.isNotEmpty && !silently) {
-      Bus.instance.fire(SyncStatusUpdate(SyncStatus.applying_remote_diff));
+      Bus.instance.fire(SyncStatusUpdate(SyncStatus.applyingRemoteDiff));
     }
     }
     for (final c in updatedCollections) {
     for (final c in updatedCollections) {
       await _syncCollectionDiff(
       await _syncCollectionDiff(
@@ -169,12 +166,10 @@ class RemoteSyncService {
   }
   }
 
 
   Future<void> _syncCollectionDiff(int collectionID, int sinceTime) async {
   Future<void> _syncCollectionDiff(int collectionID, int sinceTime) async {
-    final diff =
-        await _diffFetcher.getEncryptedFilesDiff(collectionID, sinceTime);
+    final diff = await _diffFetcher.getEncryptedFilesDiff(collectionID, sinceTime);
     if (diff.deletedFiles.isNotEmpty) {
     if (diff.deletedFiles.isNotEmpty) {
       final fileIDs = diff.deletedFiles.map((f) => f.uploadedFileID).toList();
       final fileIDs = diff.deletedFiles.map((f) => f.uploadedFileID).toList();
-      final deletedFiles =
-          (await FilesDB.instance.getFilesFromIDs(fileIDs)).values.toList();
+      final deletedFiles = (await FilesDB.instance.getFilesFromIDs(fileIDs)).values.toList();
       await FilesDB.instance.deleteFilesFromCollection(collectionID, fileIDs);
       await FilesDB.instance.deleteFilesFromCollection(collectionID, fileIDs);
       Bus.instance.fire(
       Bus.instance.fire(
         CollectionUpdatedEvent(
         CollectionUpdatedEvent(
@@ -199,8 +194,7 @@ class RemoteSyncService {
             collectionID.toString(),
             collectionID.toString(),
       );
       );
       Bus.instance.fire(LocalPhotosUpdatedEvent(diff.updatedFiles));
       Bus.instance.fire(LocalPhotosUpdatedEvent(diff.updatedFiles));
-      Bus.instance
-          .fire(CollectionUpdatedEvent(collectionID, diff.updatedFiles));
+      Bus.instance.fire(CollectionUpdatedEvent(collectionID, diff.updatedFiles));
     }
     }
 
 
     if (diff.latestUpdatedAtTime > 0) {
     if (diff.latestUpdatedAtTime > 0) {
@@ -220,28 +214,23 @@ class RemoteSyncService {
   Future<List<File>> _getFilesToBeUploaded() async {
   Future<List<File>> _getFilesToBeUploaded() async {
     final foldersToBackUp = Configuration.instance.getPathsToBackUp();
     final foldersToBackUp = Configuration.instance.getPathsToBackUp();
     List<File> filesToBeUploaded;
     List<File> filesToBeUploaded;
-    if (LocalSyncService.instance.hasGrantedLimitedPermissions() &&
-        foldersToBackUp.isEmpty) {
+    if (LocalSyncService.instance.hasGrantedLimitedPermissions() && foldersToBackUp.isEmpty) {
       filesToBeUploaded = await _db.getAllLocalFiles();
       filesToBeUploaded = await _db.getAllLocalFiles();
     } else {
     } else {
-      filesToBeUploaded =
-          await _db.getFilesToBeUploadedWithinFolders(foldersToBackUp);
+      filesToBeUploaded = await _db.getFilesToBeUploadedWithinFolders(foldersToBackUp);
     }
     }
     if (!Configuration.instance.shouldBackupVideos() || _shouldThrottleSync()) {
     if (!Configuration.instance.shouldBackupVideos() || _shouldThrottleSync()) {
-      filesToBeUploaded
-          .removeWhere((element) => element.fileType == FileType.video);
+      filesToBeUploaded.removeWhere((element) => element.fileType == FileType.video);
     }
     }
     if (filesToBeUploaded.isNotEmpty) {
     if (filesToBeUploaded.isNotEmpty) {
       final int prevCount = filesToBeUploaded.length;
       final int prevCount = filesToBeUploaded.length;
       final ignoredIDs = await IgnoredFilesService.instance.ignoredIDs;
       final ignoredIDs = await IgnoredFilesService.instance.ignoredIDs;
       filesToBeUploaded.removeWhere(
       filesToBeUploaded.removeWhere(
-        (file) =>
-            IgnoredFilesService.instance.shouldSkipUpload(ignoredIDs, file),
+        (file) => IgnoredFilesService.instance.shouldSkipUpload(ignoredIDs, file),
       );
       );
       if (prevCount != filesToBeUploaded.length) {
       if (prevCount != filesToBeUploaded.length) {
         _logger.info(
         _logger.info(
-          (prevCount - filesToBeUploaded.length).toString() +
-              " files were ignored for upload",
+          (prevCount - filesToBeUploaded.length).toString() + " files were ignored for upload",
         );
         );
       }
       }
     }
     }
@@ -265,11 +254,10 @@ class RemoteSyncService {
     _logger.info(editedFiles.length.toString() + " files edited.");
     _logger.info(editedFiles.length.toString() + " files edited.");
 
 
     _completedUploads = 0;
     _completedUploads = 0;
-    int toBeUploaded =
-        filesToBeUploaded.length + updatedFileIDs.length + editedFiles.length;
+    int toBeUploaded = filesToBeUploaded.length + updatedFileIDs.length + editedFiles.length;
 
 
     if (toBeUploaded > 0) {
     if (toBeUploaded > 0) {
-      Bus.instance.fire(SyncStatusUpdate(SyncStatus.preparing_for_upload));
+      Bus.instance.fire(SyncStatusUpdate(SyncStatus.preparingForUpload));
       // verify if files upload is allowed based on their subscription plan and
       // verify if files upload is allowed based on their subscription plan and
       // storage limit. To avoid creating new endpoint, we are using
       // storage limit. To avoid creating new endpoint, we are using
       // fetchUploadUrls as alternative method.
       // fetchUploadUrls as alternative method.
@@ -277,10 +265,8 @@ class RemoteSyncService {
     }
     }
     final List<Future> futures = [];
     final List<Future> futures = [];
     for (final uploadedFileID in updatedFileIDs) {
     for (final uploadedFileID in updatedFileIDs) {
-      if (_shouldThrottleSync() &&
-          futures.length >= kMaximumPermissibleUploadsInThrottledMode) {
-        _logger
-            .info("Skipping some updated files as we are throttling uploads");
+      if (_shouldThrottleSync() && futures.length >= kMaximumPermissibleUploadsInThrottledMode) {
+        _logger.info("Skipping some updated files as we are throttling uploads");
         break;
         break;
       }
       }
       final file = await _db.getUploadedFileInAnyCollection(uploadedFileID);
       final file = await _db.getUploadedFileInAnyCollection(uploadedFileID);
@@ -288,23 +274,19 @@ class RemoteSyncService {
     }
     }
 
 
     for (final file in filesToBeUploaded) {
     for (final file in filesToBeUploaded) {
-      if (_shouldThrottleSync() &&
-          futures.length >= kMaximumPermissibleUploadsInThrottledMode) {
+      if (_shouldThrottleSync() && futures.length >= kMaximumPermissibleUploadsInThrottledMode) {
         _logger.info("Skipping some new files as we are throttling uploads");
         _logger.info("Skipping some new files as we are throttling uploads");
         break;
         break;
       }
       }
       // prefer existing collection ID for manually uploaded files.
       // prefer existing collection ID for manually uploaded files.
       // See https://github.com/ente-io/frame/pull/187
       // See https://github.com/ente-io/frame/pull/187
       final collectionID = file.collectionID ??
       final collectionID = file.collectionID ??
-          (await CollectionsService.instance
-                  .getOrCreateForPath(file.deviceFolder))
-              .id;
+          (await CollectionsService.instance.getOrCreateForPath(file.deviceFolder)).id;
       _uploadFile(file, collectionID, futures);
       _uploadFile(file, collectionID, futures);
     }
     }
 
 
     for (final file in editedFiles) {
     for (final file in editedFiles) {
-      if (_shouldThrottleSync() &&
-          futures.length >= kMaximumPermissibleUploadsInThrottledMode) {
+      if (_shouldThrottleSync() && futures.length >= kMaximumPermissibleUploadsInThrottledMode) {
         _logger.info("Skipping some edited files as we are throttling uploads");
         _logger.info("Skipping some edited files as we are throttling uploads");
         break;
         break;
       }
       }
@@ -332,17 +314,15 @@ class RemoteSyncService {
   }
   }
 
 
   void _uploadFile(File file, int collectionID, List<Future> futures) {
   void _uploadFile(File file, int collectionID, List<Future> futures) {
-    final future = _uploader
-        .upload(file, collectionID)
-        .then((uploadedFile) => _onFileUploaded(uploadedFile));
+    final future =
+        _uploader.upload(file, collectionID).then((uploadedFile) => _onFileUploaded(uploadedFile));
     futures.add(future);
     futures.add(future);
   }
   }
 
 
   Future<void> _onFileUploaded(File file) async {
   Future<void> _onFileUploaded(File file) async {
     Bus.instance.fire(CollectionUpdatedEvent(file.collectionID, [file]));
     Bus.instance.fire(CollectionUpdatedEvent(file.collectionID, [file]));
     _completedUploads++;
     _completedUploads++;
-    final toBeUploadedInThisSession =
-        FileUploader.instance.getCurrentSessionUploadCount();
+    final toBeUploadedInThisSession = FileUploader.instance.getCurrentSessionUploadCount();
     if (toBeUploadedInThisSession == 0) {
     if (toBeUploadedInThisSession == 0) {
       return;
       return;
     }
     }
@@ -360,7 +340,7 @@ class RemoteSyncService {
     }
     }
     Bus.instance.fire(
     Bus.instance.fire(
       SyncStatusUpdate(
       SyncStatusUpdate(
-        SyncStatus.in_progress,
+        SyncStatus.inProgress,
         completed: _completedUploads,
         completed: _completedUploads,
         total: toBeUploadedInThisSession,
         total: toBeUploadedInThisSession,
       ),
       ),
@@ -380,9 +360,7 @@ class RemoteSyncService {
       final existingFiles = file.deviceFolder == null
       final existingFiles = file.deviceFolder == null
           ? null
           ? null
           : await _db.getMatchingFiles(file.title, file.deviceFolder);
           : await _db.getMatchingFiles(file.title, file.deviceFolder);
-      if (existingFiles == null ||
-          existingFiles.isEmpty ||
-          userID != file.ownerID) {
+      if (existingFiles == null || existingFiles.isEmpty || userID != file.ownerID) {
         // File uploaded from a different device or uploaded by different user
         // File uploaded from a different device or uploaded by different user
         // Other rare possibilities : The local file is present on
         // Other rare possibilities : The local file is present on
         // device but it's not imported in local db due to missing permission
         // device but it's not imported in local db due to missing permission
@@ -400,10 +378,7 @@ class RemoteSyncService {
         // case when localID for a file changes and the file is uploaded again in
         // case when localID for a file changes and the file is uploaded again in
         // the same collection
         // the same collection
         final fileWithLocalID = existingFiles.firstWhere(
         final fileWithLocalID = existingFiles.firstWhere(
-          (e) =>
-              file.localID != null &&
-              e.localID != null &&
-              e.localID == file.localID,
+          (e) => file.localID != null && e.localID != null && e.localID == file.localID,
           orElse: () => existingFiles.firstWhere(
           orElse: () => existingFiles.firstWhere(
             (e) => e.localID != null,
             (e) => e.localID != null,
             orElse: () => null,
             orElse: () => null,
@@ -487,8 +462,7 @@ class RemoteSyncService {
   // return true if the client needs to re-sync the collections from previous
   // return true if the client needs to re-sync the collections from previous
   // version
   // version
   bool _hasReSynced() {
   bool _hasReSynced() {
-    return _prefs.containsKey(kHasSyncedEditTime) &&
-        _prefs.containsKey(kHasSyncedArchiveKey);
+    return _prefs.containsKey(kHasSyncedEditTime) && _prefs.containsKey(kHasSyncedArchiveKey);
   }
   }
 
 
   Future<void> _markReSyncAsDone() async {
   Future<void> _markReSyncAsDone() async {

+ 4 - 5
lib/services/sync_service.dart

@@ -82,10 +82,9 @@ class SyncService {
     try {
     try {
       await _doSync();
       await _doSync();
       if (_lastSyncStatusEvent != null &&
       if (_lastSyncStatusEvent != null &&
-          _lastSyncStatusEvent.status !=
-              SyncStatus.completed_first_gallery_import &&
-          _lastSyncStatusEvent.status != SyncStatus.completed_backup) {
-        Bus.instance.fire(SyncStatusUpdate(SyncStatus.completed_backup));
+          _lastSyncStatusEvent.status != SyncStatus.completedFirstGalleryImport &&
+          _lastSyncStatusEvent.status != SyncStatus.completedBackup) {
+        Bus.instance.fire(SyncStatusUpdate(SyncStatus.completedBackup));
       }
       }
       successful = true;
       successful = true;
     } on WiFiUnavailableError {
     } on WiFiUnavailableError {
@@ -96,7 +95,7 @@ class SyncService {
     } on SyncStopRequestedError {
     } on SyncStopRequestedError {
       _syncStopRequested = false;
       _syncStopRequested = false;
       Bus.instance.fire(
       Bus.instance.fire(
-        SyncStatusUpdate(SyncStatus.completed_backup, wasStopped: true),
+        SyncStatusUpdate(SyncStatus.completedBackup, wasStopped: true),
       );
       );
     } on NoActiveSubscriptionError {
     } on NoActiveSubscriptionError {
       Bus.instance.fire(
       Bus.instance.fire(

+ 6 - 13
lib/ui/account/login_page.dart

@@ -17,7 +17,7 @@ class _LoginPageState extends State<LoginPage> {
   final _config = Configuration.instance;
   final _config = Configuration.instance;
   bool _emailIsValid = false;
   bool _emailIsValid = false;
   String _email;
   String _email;
-  Color _emailInputFieldColor = null;
+  Color _emailInputFieldColor;
 
 
   @override
   @override
   void initState() {
   void initState() {
@@ -56,8 +56,7 @@ class _LoginPageState extends State<LoginPage> {
         buttonText: 'Log in',
         buttonText: 'Log in',
         onPressedFunction: () {
         onPressedFunction: () {
           UserService.instance.setEmail(_email);
           UserService.instance.setEmail(_email);
-          UserService.instance
-              .getOtt(context, _email, isCreateAccountScreen: false);
+          UserService.instance.getOtt(context, _email, isCreateAccountScreen: false);
           FocusScope.of(context).unfocus();
           FocusScope.of(context).unfocus();
         },
         },
       ),
       ),
@@ -73,8 +72,7 @@ class _LoginPageState extends State<LoginPage> {
           child: ListView(
           child: ListView(
             children: [
             children: [
               Padding(
               Padding(
-                padding:
-                    const EdgeInsets.symmetric(vertical: 30, horizontal: 20),
+                padding: const EdgeInsets.symmetric(vertical: 30, horizontal: 20),
                 child: Text(
                 child: Text(
                   'Welcome back!',
                   'Welcome back!',
                   style: Theme.of(context).textTheme.headline4,
                   style: Theme.of(context).textTheme.headline4,
@@ -88,8 +86,7 @@ class _LoginPageState extends State<LoginPage> {
                     fillColor: _emailInputFieldColor,
                     fillColor: _emailInputFieldColor,
                     filled: true,
                     filled: true,
                     hintText: 'Email',
                     hintText: 'Email',
-                    contentPadding:
-                        EdgeInsets.symmetric(horizontal: 15, vertical: 15),
+                    contentPadding: EdgeInsets.symmetric(horizontal: 15, vertical: 15),
                     border: UnderlineInputBorder(
                     border: UnderlineInputBorder(
                       borderSide: BorderSide.none,
                       borderSide: BorderSide.none,
                       borderRadius: BorderRadius.circular(6),
                       borderRadius: BorderRadius.circular(6),
@@ -111,8 +108,7 @@ class _LoginPageState extends State<LoginPage> {
                       _email = value.trim();
                       _email = value.trim();
                       _emailIsValid = EmailValidator.validate(_email);
                       _emailIsValid = EmailValidator.validate(_email);
                       if (_emailIsValid) {
                       if (_emailIsValid) {
-                        _emailInputFieldColor =
-                            Color.fromRGBO(45, 194, 98, 0.2);
+                        _emailInputFieldColor = Color.fromRGBO(45, 194, 98, 0.2);
                       } else {
                       } else {
                         _emailInputFieldColor = null;
                         _emailInputFieldColor = null;
                       }
                       }
@@ -138,10 +134,7 @@ class _LoginPageState extends State<LoginPage> {
                       flex: 5,
                       flex: 5,
                       child: RichText(
                       child: RichText(
                         text: TextSpan(
                         text: TextSpan(
-                          style: Theme.of(context)
-                              .textTheme
-                              .subtitle1
-                              .copyWith(fontSize: 12),
+                          style: Theme.of(context).textTheme.subtitle1.copyWith(fontSize: 12),
                           children: [
                           children: [
                             TextSpan(
                             TextSpan(
                               text: "By clicking log in, I agree to the ",
                               text: "By clicking log in, I agree to the ",

+ 18 - 29
lib/ui/account/password_reentry_page.dart

@@ -99,8 +99,7 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {
           child: ListView(
           child: ListView(
             children: [
             children: [
               Padding(
               Padding(
-                padding:
-                    const EdgeInsets.symmetric(vertical: 30, horizontal: 20),
+                padding: const EdgeInsets.symmetric(vertical: 30, horizontal: 20),
                 child: Text(
                 child: Text(
                   'Welcome back!',
                   'Welcome back!',
                   style: Theme.of(context).textTheme.headline4,
                   style: Theme.of(context).textTheme.headline4,
@@ -121,9 +120,7 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {
                     suffixIcon: _passwordInFocus
                     suffixIcon: _passwordInFocus
                         ? IconButton(
                         ? IconButton(
                             icon: Icon(
                             icon: Icon(
-                              _passwordVisible
-                                  ? Icons.visibility
-                                  : Icons.visibility_off,
+                              _passwordVisible ? Icons.visibility : Icons.visibility_off,
                               color: Theme.of(context).iconTheme.color,
                               color: Theme.of(context).iconTheme.color,
                               size: 20,
                               size: 20,
                             ),
                             ),
@@ -171,40 +168,32 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {
                           ),
                           ),
                         );
                         );
                       },
                       },
-                      child: Container(
-                        child: Center(
-                          child: Text(
-                            "Forgot password",
-                            style:
-                                Theme.of(context).textTheme.subtitle1.copyWith(
-                                      fontSize: 14,
-                                      decoration: TextDecoration.underline,
-                                    ),
-                          ),
+                      child: Center(
+                        child: Text(
+                          "Forgot password",
+                          style: Theme.of(context).textTheme.subtitle1.copyWith(
+                                fontSize: 14,
+                                decoration: TextDecoration.underline,
+                              ),
                         ),
                         ),
                       ),
                       ),
                     ),
                     ),
                     GestureDetector(
                     GestureDetector(
                       behavior: HitTestBehavior.opaque,
                       behavior: HitTestBehavior.opaque,
                       onTap: () async {
                       onTap: () async {
-                        final dialog =
-                            createProgressDialog(context, "Please wait...");
+                        final dialog = createProgressDialog(context, "Please wait...");
                         await dialog.show();
                         await dialog.show();
                         await Configuration.instance.logout();
                         await Configuration.instance.logout();
                         await dialog.hide();
                         await dialog.hide();
-                        Navigator.of(context)
-                            .popUntil((route) => route.isFirst);
+                        Navigator.of(context).popUntil((route) => route.isFirst);
                       },
                       },
-                      child: Container(
-                        child: Center(
-                          child: Text(
-                            "Change email",
-                            style:
-                                Theme.of(context).textTheme.subtitle1.copyWith(
-                                      fontSize: 14,
-                                      decoration: TextDecoration.underline,
-                                    ),
-                          ),
+                      child: Center(
+                        child: Text(
+                          "Change email",
+                          style: Theme.of(context).textTheme.subtitle1.copyWith(
+                                fontSize: 14,
+                                decoration: TextDecoration.underline,
+                              ),
                         ),
                         ),
                       ),
                       ),
                     ),
                     ),

+ 6 - 8
lib/ui/account/recovery_page.dart

@@ -82,8 +82,7 @@ class _RecoveryPageState extends State<RecoveryPage> {
             child: ListView(
             child: ListView(
               children: [
               children: [
                 Padding(
                 Padding(
-                  padding:
-                      const EdgeInsets.symmetric(vertical: 30, horizontal: 20),
+                  padding: const EdgeInsets.symmetric(vertical: 30, horizontal: 20),
                   child: Text(
                   child: Text(
                     'Forgot password',
                     'Forgot password',
                     style: Theme.of(context).textTheme.headline4,
                     style: Theme.of(context).textTheme.headline4,
@@ -103,7 +102,7 @@ class _RecoveryPageState extends State<RecoveryPage> {
                     ),
                     ),
                     style: TextStyle(
                     style: TextStyle(
                       fontSize: 14,
                       fontSize: 14,
-                      fontFeatures: [FontFeature.tabularFigures()],
+                      fontFeatures: const [FontFeature.tabularFigures()],
                     ),
                     ),
                     controller: _recoveryKey,
                     controller: _recoveryKey,
                     autofocus: false,
                     autofocus: false,
@@ -137,11 +136,10 @@ class _RecoveryPageState extends State<RecoveryPage> {
                         child: Center(
                         child: Center(
                           child: Text(
                           child: Text(
                             "No recovery key?",
                             "No recovery key?",
-                            style:
-                                Theme.of(context).textTheme.subtitle1.copyWith(
-                                      fontSize: 14,
-                                      decoration: TextDecoration.underline,
-                                    ),
+                            style: Theme.of(context).textTheme.subtitle1.copyWith(
+                                  fontSize: 14,
+                                  decoration: TextDecoration.underline,
+                                ),
                           ),
                           ),
                         ),
                         ),
                       ),
                       ),

+ 2 - 2
lib/ui/collections_gallery_widget.dart

@@ -304,7 +304,7 @@ class _CollectionsGalleryWidgetState extends State<CollectionsGalleryWidget>
                         color: Theme.of(context).iconTheme.color.withOpacity(0.24),
                         color: Theme.of(context).iconTheme.color.withOpacity(0.24),
                       ),
                       ),
                     ),
                     ),
-                    child: Container(
+                    child: SizedBox(
                       height: 48,
                       height: 48,
                       width: double.infinity,
                       width: double.infinity,
                       child: Padding(
                       child: Padding(
@@ -488,7 +488,7 @@ class _CollectionsGalleryWidgetState extends State<CollectionsGalleryWidget>
             "long press to select photos and click + to create an album",
             "long press to select photos and click + to create an album",
             toastLength: Toast.LENGTH_LONG,
             toastLength: Toast.LENGTH_LONG,
           );
           );
-          Bus.instance.fire(TabChangedEvent(0, TabChangedEventSource.collections_page));
+          Bus.instance.fire(TabChangedEvent(0, TabChangedEventSource.collectionsPage));
         },
         },
       );
       );
     }
     }

+ 2 - 5
lib/ui/common/bottomShadow.dart

@@ -3,8 +3,7 @@ import 'package:flutter/material.dart';
 class BottomShadowWidget extends StatelessWidget {
 class BottomShadowWidget extends StatelessWidget {
   final double offsetDy;
   final double offsetDy;
   final Color shadowColor;
   final Color shadowColor;
-  const BottomShadowWidget({this.offsetDy = 28, this.shadowColor, Key key})
-      : super(key: key);
+  const BottomShadowWidget({this.offsetDy = 28, this.shadowColor, Key key}) : super(key: key);
 
 
   @override
   @override
   Widget build(BuildContext context) {
   Widget build(BuildContext context) {
@@ -14,9 +13,7 @@ class BottomShadowWidget extends StatelessWidget {
         color: Colors.transparent,
         color: Colors.transparent,
         boxShadow: [
         boxShadow: [
           BoxShadow(
           BoxShadow(
-            color: shadowColor == null
-                ? Theme.of(context).backgroundColor
-                : shadowColor,
+            color: shadowColor ?? Theme.of(context).backgroundColor,
             spreadRadius: 42,
             spreadRadius: 42,
             blurRadius: 42,
             blurRadius: 42,
             offset: Offset(0, offsetDy), // changes position of shadow
             offset: Offset(0, offsetDy), // changes position of shadow

+ 33 - 69
lib/ui/home_widget.dart

@@ -101,9 +101,8 @@ class _HomeWidgetState extends State<HomeWidget> {
         ],
         ],
       ),
       ),
     );
     );
-    _tabChangedEventSubscription =
-        Bus.instance.on<TabChangedEvent>().listen((event) {
-      if (event.source != TabChangedEventSource.page_view) {
+    _tabChangedEventSubscription = Bus.instance.on<TabChangedEvent>().listen((event) {
+      if (event.source != TabChangedEventSource.pageView) {
         _selectedTabIndex = event.selectedIndex;
         _selectedTabIndex = event.selectedIndex;
         _pageController.animateToPage(
         _pageController.animateToPage(
           event.selectedIndex,
           event.selectedIndex,
@@ -112,16 +111,13 @@ class _HomeWidgetState extends State<HomeWidget> {
         );
         );
       }
       }
     });
     });
-    _subscriptionPurchaseEvent =
-        Bus.instance.on<SubscriptionPurchasedEvent>().listen((event) {
+    _subscriptionPurchaseEvent = Bus.instance.on<SubscriptionPurchasedEvent>().listen((event) {
       setState(() {});
       setState(() {});
     });
     });
-    _accountConfiguredEvent =
-        Bus.instance.on<AccountConfiguredEvent>().listen((event) {
+    _accountConfiguredEvent = Bus.instance.on<AccountConfiguredEvent>().listen((event) {
       setState(() {});
       setState(() {});
     });
     });
-    _triggerLogoutEvent =
-        Bus.instance.on<TriggerLogoutEvent>().listen((event) async {
+    _triggerLogoutEvent = Bus.instance.on<TriggerLogoutEvent>().listen((event) async {
       AlertDialog alert = AlertDialog(
       AlertDialog alert = AlertDialog(
         title: Text("Session expired"),
         title: Text("Session expired"),
         content: Text("Please login again"),
         content: Text("Please login again"),
@@ -158,16 +154,13 @@ class _HomeWidgetState extends State<HomeWidget> {
         setState(() {});
         setState(() {});
       }
       }
     });
     });
-    _permissionGrantedEvent =
-        Bus.instance.on<PermissionGrantedEvent>().listen((event) async {
+    _permissionGrantedEvent = Bus.instance.on<PermissionGrantedEvent>().listen((event) async {
       if (mounted) {
       if (mounted) {
         setState(() {});
         setState(() {});
       }
       }
     });
     });
-    _firstImportEvent =
-        Bus.instance.on<SyncStatusUpdate>().listen((event) async {
-      if (mounted &&
-          event.status == SyncStatus.completed_first_gallery_import) {
+    _firstImportEvent = Bus.instance.on<SyncStatusUpdate>().listen((event) async {
+      if (mounted && event.status == SyncStatus.completedFirstGalleryImport) {
         Duration delayInRefresh = Duration(milliseconds: 0);
         Duration delayInRefresh = Duration(milliseconds: 0);
         // Loading page will redirect to BackupFolderSelectionPage.
         // Loading page will redirect to BackupFolderSelectionPage.
         // To avoid showing folder hook in middle during routing,
         // To avoid showing folder hook in middle during routing,
@@ -188,8 +181,7 @@ class _HomeWidgetState extends State<HomeWidget> {
         );
         );
       }
       }
     });
     });
-    _backupFoldersUpdatedEvent =
-        Bus.instance.on<BackupFoldersUpdatedEvent>().listen((event) async {
+    _backupFoldersUpdatedEvent = Bus.instance.on<BackupFoldersUpdatedEvent>().listen((event) async {
       if (mounted) {
       if (mounted) {
         setState(() {});
         setState(() {});
       }
       }
@@ -229,8 +221,7 @@ class _HomeWidgetState extends State<HomeWidget> {
   }
   }
 
 
   void _initMediaShareSubscription() {
   void _initMediaShareSubscription() {
-    _intentDataStreamSubscription =
-        ReceiveSharingIntent.getMediaStream().listen(
+    _intentDataStreamSubscription = ReceiveSharingIntent.getMediaStream().listen(
       (List<SharedMediaFile> value) {
       (List<SharedMediaFile> value) {
         setState(() {
         setState(() {
           _sharedFiles = value;
           _sharedFiles = value;
@@ -269,8 +260,7 @@ class _HomeWidgetState extends State<HomeWidget> {
             return true;
             return true;
           }
           }
         } else {
         } else {
-          Bus.instance
-              .fire(TabChangedEvent(0, TabChangedEventSource.back_button));
+          Bus.instance.fire(TabChangedEvent(0, TabChangedEventSource.backButton));
           return false;
           return false;
         }
         }
       },
       },
@@ -292,17 +282,14 @@ class _HomeWidgetState extends State<HomeWidget> {
       return CreateCollectionPage(null, _sharedFiles);
       return CreateCollectionPage(null, _sharedFiles);
     }
     }
 
 
-    final bool showBackupFolderHook =
-        Configuration.instance.getPathsToBackUp().isEmpty &&
-            !LocalSyncService.instance.hasGrantedLimitedPermissions() &&
-            CollectionsService.instance.getActiveCollections().isEmpty;
+    final bool showBackupFolderHook = Configuration.instance.getPathsToBackUp().isEmpty &&
+        !LocalSyncService.instance.hasGrantedLimitedPermissions() &&
+        CollectionsService.instance.getActiveCollections().isEmpty;
     return Stack(
     return Stack(
       children: [
       children: [
         ExtentsPageView(
         ExtentsPageView(
           children: [
           children: [
-            showBackupFolderHook
-                ? _getBackupFolderSelectionHook()
-                : _getMainGalleryWidget(),
+            showBackupFolderHook ? _getBackupFolderSelectionHook() : _getMainGalleryWidget(),
             _deviceFolderGalleryWidget,
             _deviceFolderGalleryWidget,
             _sharedCollectionGallery,
             _sharedCollectionGallery,
             _settingsPage,
             _settingsPage,
@@ -311,7 +298,7 @@ class _HomeWidgetState extends State<HomeWidget> {
             Bus.instance.fire(
             Bus.instance.fire(
               TabChangedEvent(
               TabChangedEvent(
                 page,
                 page,
-                TabChangedEventSource.page_view,
+                TabChangedEventSource.pageView,
               ),
               ),
             );
             );
           },
           },
@@ -387,8 +374,7 @@ class _HomeWidgetState extends State<HomeWidget> {
       asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) async {
       asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) async {
         final importantPaths = Configuration.instance.getPathsToBackUp();
         final importantPaths = Configuration.instance.getPathsToBackUp();
         final ownerID = Configuration.instance.getUserID();
         final ownerID = Configuration.instance.getUserID();
-        final archivedCollectionIds =
-            CollectionsService.instance.getArchivedCollections();
+        final archivedCollectionIds = CollectionsService.instance.getArchivedCollections();
         FileLoadResult result;
         FileLoadResult result;
         if (importantPaths.isNotEmpty) {
         if (importantPaths.isNotEmpty) {
           result = await FilesDB.instance.getImportantFiles(
           result = await FilesDB.instance.getImportantFiles(
@@ -493,8 +479,7 @@ class _HomeWidgetState extends State<HomeWidget> {
                     Color(0xFF1DB954),
                     Color(0xFF1DB954),
                   ],
                   ],
                   onTap: () async {
                   onTap: () async {
-                    if (LocalSyncService.instance
-                        .hasGrantedLimitedPermissions()) {
+                    if (LocalSyncService.instance.hasGrantedLimitedPermissions()) {
                       PhotoManager.presentLimited();
                       PhotoManager.presentLimited();
                     } else {
                     } else {
                       routeToPage(
                       routeToPage(
@@ -566,13 +551,11 @@ class HomeBottomNavigationBar extends StatefulWidget {
   final int selectedTabIndex;
   final int selectedTabIndex;
 
 
   @override
   @override
-  _HomeBottomNavigationBarState createState() =>
-      _HomeBottomNavigationBarState();
+  _HomeBottomNavigationBarState createState() => _HomeBottomNavigationBarState();
 }
 }
 
 
 class _HomeBottomNavigationBarState extends State<HomeBottomNavigationBar> {
 class _HomeBottomNavigationBarState extends State<HomeBottomNavigationBar> {
   StreamSubscription<TabChangedEvent> _tabChangedEventSubscription;
   StreamSubscription<TabChangedEvent> _tabChangedEventSubscription;
-  final _logger = Logger((_HomeBottomNavigationBarState).toString());
   int currentTabIndex = 0;
   int currentTabIndex = 0;
 
 
   @override
   @override
@@ -582,9 +565,8 @@ class _HomeBottomNavigationBarState extends State<HomeBottomNavigationBar> {
     widget.selectedFiles.addListener(() {
     widget.selectedFiles.addListener(() {
       setState(() {});
       setState(() {});
     });
     });
-    _tabChangedEventSubscription =
-        Bus.instance.on<TabChangedEvent>().listen((event) {
-      if (event.source != TabChangedEventSource.tab_bar) {
+    _tabChangedEventSubscription = Bus.instance.on<TabChangedEvent>().listen((event) {
+      if (event.source != TabChangedEventSource.tabBar) {
         debugPrint('index changed to ${event.selectedIndex}');
         debugPrint('index changed to ${event.selectedIndex}');
         if (mounted) {
         if (mounted) {
           setState(() {
           setState(() {
@@ -605,7 +587,7 @@ class _HomeBottomNavigationBarState extends State<HomeBottomNavigationBar> {
     Bus.instance.fire(
     Bus.instance.fire(
       TabChangedEvent(
       TabChangedEvent(
         index,
         index,
-        TabChangedEventSource.tab_bar,
+        TabChangedEventSource.tabBar,
       ),
       ),
     );
     );
   }
   }
@@ -640,32 +622,23 @@ class _HomeBottomNavigationBarState extends State<HomeBottomNavigationBar> {
                           filter: ImageFilter.blur(sigmaX: 20, sigmaY: 20),
                           filter: ImageFilter.blur(sigmaX: 20, sigmaY: 20),
                           child: GNav(
                           child: GNav(
                             curve: Curves.easeOutExpo,
                             curve: Curves.easeOutExpo,
-                            backgroundColor: Theme.of(context)
-                                .colorScheme
-                                .gNavBackgroundColor,
+                            backgroundColor: Theme.of(context).colorScheme.gNavBackgroundColor,
                             mainAxisAlignment: MainAxisAlignment.center,
                             mainAxisAlignment: MainAxisAlignment.center,
                             rippleColor: Colors.white.withOpacity(0.1),
                             rippleColor: Colors.white.withOpacity(0.1),
-                            activeColor: Theme.of(context)
-                                .colorScheme
-                                .gNavBarActiveColor,
+                            activeColor: Theme.of(context).colorScheme.gNavBarActiveColor,
                             iconSize: 24,
                             iconSize: 24,
                             padding: EdgeInsets.fromLTRB(16, 8, 16, 8),
                             padding: EdgeInsets.fromLTRB(16, 8, 16, 8),
                             duration: Duration(milliseconds: 200),
                             duration: Duration(milliseconds: 200),
                             gap: 0,
                             gap: 0,
                             tabBorderRadius: 24,
                             tabBorderRadius: 24,
-                            tabBackgroundColor: Theme.of(context)
-                                .colorScheme
-                                .gNavBarActiveColor,
+                            tabBackgroundColor: Theme.of(context).colorScheme.gNavBarActiveColor,
                             haptic: false,
                             haptic: false,
                             tabs: [
                             tabs: [
                               GButton(
                               GButton(
                                 margin: EdgeInsets.fromLTRB(6, 6, 0, 6),
                                 margin: EdgeInsets.fromLTRB(6, 6, 0, 6),
                                 icon: Icons.home,
                                 icon: Icons.home,
-                                iconColor:
-                                    Theme.of(context).colorScheme.gNavIconColor,
-                                iconActiveColor: Theme.of(context)
-                                    .colorScheme
-                                    .gNavActiveIconColor,
+                                iconColor: Theme.of(context).colorScheme.gNavIconColor,
+                                iconActiveColor: Theme.of(context).colorScheme.gNavActiveIconColor,
                                 text: '',
                                 text: '',
                                 onPressed: () {
                                 onPressed: () {
                                   _onTabChange(
                                   _onTabChange(
@@ -676,11 +649,8 @@ class _HomeBottomNavigationBarState extends State<HomeBottomNavigationBar> {
                               GButton(
                               GButton(
                                 margin: EdgeInsets.fromLTRB(0, 6, 0, 6),
                                 margin: EdgeInsets.fromLTRB(0, 6, 0, 6),
                                 icon: Icons.photo_library,
                                 icon: Icons.photo_library,
-                                iconColor:
-                                    Theme.of(context).colorScheme.gNavIconColor,
-                                iconActiveColor: Theme.of(context)
-                                    .colorScheme
-                                    .gNavActiveIconColor,
+                                iconColor: Theme.of(context).colorScheme.gNavIconColor,
+                                iconActiveColor: Theme.of(context).colorScheme.gNavActiveIconColor,
                                 text: '',
                                 text: '',
                                 onPressed: () {
                                 onPressed: () {
                                   _onTabChange(
                                   _onTabChange(
@@ -691,11 +661,8 @@ class _HomeBottomNavigationBarState extends State<HomeBottomNavigationBar> {
                               GButton(
                               GButton(
                                 margin: EdgeInsets.fromLTRB(0, 6, 0, 6),
                                 margin: EdgeInsets.fromLTRB(0, 6, 0, 6),
                                 icon: Icons.folder_shared,
                                 icon: Icons.folder_shared,
-                                iconColor:
-                                    Theme.of(context).colorScheme.gNavIconColor,
-                                iconActiveColor: Theme.of(context)
-                                    .colorScheme
-                                    .gNavActiveIconColor,
+                                iconColor: Theme.of(context).colorScheme.gNavIconColor,
+                                iconActiveColor: Theme.of(context).colorScheme.gNavActiveIconColor,
                                 text: '',
                                 text: '',
                                 onPressed: () {
                                 onPressed: () {
                                   _onTabChange(
                                   _onTabChange(
@@ -706,11 +673,8 @@ class _HomeBottomNavigationBarState extends State<HomeBottomNavigationBar> {
                               GButton(
                               GButton(
                                 margin: EdgeInsets.fromLTRB(0, 6, 6, 6),
                                 margin: EdgeInsets.fromLTRB(0, 6, 6, 6),
                                 icon: Icons.person,
                                 icon: Icons.person,
-                                iconColor:
-                                    Theme.of(context).colorScheme.gNavIconColor,
-                                iconActiveColor: Theme.of(context)
-                                    .colorScheme
-                                    .gNavActiveIconColor,
+                                iconColor: Theme.of(context).colorScheme.gNavIconColor,
+                                iconActiveColor: Theme.of(context).colorScheme.gNavActiveIconColor,
                                 text: '',
                                 text: '',
                                 onPressed: () {
                                 onPressed: () {
                                   _onTabChange(
                                   _onTabChange(

+ 3 - 6
lib/ui/loading_photos_widget.dart

@@ -37,10 +37,8 @@ class _LoadingPhotosWidgetState extends State<LoadingPhotosWidget> {
   @override
   @override
   void initState() {
   void initState() {
     super.initState();
     super.initState();
-    _firstImportEvent =
-        Bus.instance.on<SyncStatusUpdate>().listen((event) async {
-      if (mounted &&
-          event.status == SyncStatus.completed_first_gallery_import) {
+    _firstImportEvent = Bus.instance.on<SyncStatusUpdate>().listen((event) async {
+      if (mounted && event.status == SyncStatus.completedFirstGalleryImport) {
         if (LocalSyncService.instance.hasGrantedLimitedPermissions()) {
         if (LocalSyncService.instance.hasGrantedLimitedPermissions()) {
           // Do nothing, let HomeWidget refresh
           // Do nothing, let HomeWidget refresh
         } else {
         } else {
@@ -80,8 +78,7 @@ class _LoadingPhotosWidgetState extends State<LoadingPhotosWidget> {
 
 
   @override
   @override
   Widget build(BuildContext context) {
   Widget build(BuildContext context) {
-    final isLightMode =
-        MediaQuery.of(context).platformBrightness == Brightness.light;
+    final isLightMode = MediaQuery.of(context).platformBrightness == Brightness.light;
     return Scaffold(
     return Scaffold(
       body: SingleChildScrollView(
       body: SingleChildScrollView(
         child: Center(
         child: Center(

+ 9 - 23
lib/ui/nav_bar.dart

@@ -101,20 +101,16 @@ class _GNavState extends State<GNav> {
                 iconColor: t.iconColor ?? widget.color,
                 iconColor: t.iconColor ?? widget.color,
                 iconSize: t.iconSize ?? widget.iconSize,
                 iconSize: t.iconSize ?? widget.iconSize,
                 textColor: t.textColor ?? widget.activeColor,
                 textColor: t.textColor ?? widget.activeColor,
-                rippleColor:
-                    t.rippleColor ?? widget.rippleColor ?? Colors.transparent,
-                hoverColor:
-                    t.hoverColor ?? widget.hoverColor ?? Colors.transparent,
+                rippleColor: t.rippleColor ?? widget.rippleColor ?? Colors.transparent,
+                hoverColor: t.hoverColor ?? widget.hoverColor ?? Colors.transparent,
                 padding: t.padding ?? widget.padding,
                 padding: t.padding ?? widget.padding,
                 icon: t.icon,
                 icon: t.icon,
                 haptic: widget.haptic ?? true,
                 haptic: widget.haptic ?? true,
                 leading: t.leading,
                 leading: t.leading,
                 curve: widget.curve ?? Curves.easeInCubic,
                 curve: widget.curve ?? Curves.easeInCubic,
-                backgroundGradient:
-                    t.backgroundGradient ?? widget.tabBackgroundGradient,
-                backgroundColor: t.backgroundColor ??
-                    widget.tabBackgroundColor ??
-                    Colors.transparent,
+                backgroundGradient: t.backgroundGradient ?? widget.tabBackgroundGradient,
+                backgroundColor:
+                    t.backgroundColor ?? widget.tabBackgroundColor ?? Colors.transparent,
                 duration: widget.duration ?? const Duration(milliseconds: 500),
                 duration: widget.duration ?? const Duration(milliseconds: 500),
                 onPressed: () {
                 onPressed: () {
                   if (!clickable) return;
                   if (!clickable) return;
@@ -124,8 +120,7 @@ class _GNavState extends State<GNav> {
                   });
                   });
                   widget.onTabChange(selectedIndex);
                   widget.onTabChange(selectedIndex);
 
 
-                  Future.delayed(
-                      widget.duration ?? const Duration(milliseconds: 500), () {
+                  Future.delayed(widget.duration ?? const Duration(milliseconds: 500), () {
                     setState(() {
                     setState(() {
                       clickable = true;
                       clickable = true;
                     });
                     });
@@ -301,9 +296,8 @@ class _ButtonState extends State<Button> with TickerProviderStateMixin {
     super.initState();
     super.initState();
     _expanded = widget.active;
     _expanded = widget.active;
 
 
-    expandController =
-        AnimationController(vsync: this, duration: widget.duration)
-          ..addListener(() => setState(() {}));
+    expandController = AnimationController(vsync: this, duration: widget.duration)
+      ..addListener(() => setState(() {}));
   }
   }
 
 
   @override
   @override
@@ -315,12 +309,6 @@ class _ButtonState extends State<Button> with TickerProviderStateMixin {
 
 
   @override
   @override
   Widget build(BuildContext context) {
   Widget build(BuildContext context) {
-    var curveValue = expandController
-        .drive(
-          CurveTween(curve: _expanded ? widget.curve : widget.curve.flipped),
-        )
-        .value;
-
     _expanded = !widget.active;
     _expanded = !widget.active;
     if (_expanded) {
     if (_expanded) {
       expandController.reverse();
       expandController.reverse();
@@ -356,9 +344,7 @@ class _ButtonState extends State<Button> with TickerProviderStateMixin {
             // curve: !_expanded ? widget.curve : widget.curve.flipped,
             // curve: !_expanded ? widget.curve : widget.curve.flipped,
             decoration: BoxDecoration(
             decoration: BoxDecoration(
               boxShadow: widget.shadow,
               boxShadow: widget.shadow,
-              border: widget.active
-                  ? (widget.activeBorder ?? widget.border)
-                  : widget.border,
+              border: widget.active ? (widget.activeBorder ?? widget.border) : widget.border,
               gradient: widget.gradient,
               gradient: widget.gradient,
               color: _expanded
               color: _expanded
                   ? widget.color.withOpacity(0)
                   ? widget.color.withOpacity(0)

+ 25 - 43
lib/ui/shared_collections_gallery.dart

@@ -28,8 +28,7 @@ class SharedCollectionGallery extends StatefulWidget {
   const SharedCollectionGallery({Key key}) : super(key: key);
   const SharedCollectionGallery({Key key}) : super(key: key);
 
 
   @override
   @override
-  _SharedCollectionGalleryState createState() =>
-      _SharedCollectionGalleryState();
+  _SharedCollectionGalleryState createState() => _SharedCollectionGalleryState();
 }
 }
 
 
 class _SharedCollectionGalleryState extends State<SharedCollectionGallery>
 class _SharedCollectionGalleryState extends State<SharedCollectionGallery>
@@ -41,13 +40,11 @@ class _SharedCollectionGalleryState extends State<SharedCollectionGallery>
 
 
   @override
   @override
   void initState() {
   void initState() {
-    _localFilesSubscription =
-        Bus.instance.on<LocalPhotosUpdatedEvent>().listen((event) {
+    _localFilesSubscription = Bus.instance.on<LocalPhotosUpdatedEvent>().listen((event) {
       _logger.info("Files updated");
       _logger.info("Files updated");
       setState(() {});
       setState(() {});
     });
     });
-    _collectionUpdatesSubscription =
-        Bus.instance.on<CollectionUpdatedEvent>().listen((event) {
+    _collectionUpdatesSubscription = Bus.instance.on<CollectionUpdatedEvent>().listen((event) {
       setState(() {});
       setState(() {});
     });
     });
     _loggedOutEvent = Bus.instance.on<UserLoggedOutEvent>().listen((event) {
     _loggedOutEvent = Bus.instance.on<UserLoggedOutEvent>().listen((event) {
@@ -61,13 +58,11 @@ class _SharedCollectionGalleryState extends State<SharedCollectionGallery>
     super.build(context);
     super.build(context);
     return FutureBuilder<SharedCollections>(
     return FutureBuilder<SharedCollections>(
       future:
       future:
-          Future.value(CollectionsService.instance.getLatestCollectionFiles())
-              .then((files) async {
+          Future.value(CollectionsService.instance.getLatestCollectionFiles()).then((files) async {
         final List<CollectionWithThumbnail> outgoing = [];
         final List<CollectionWithThumbnail> outgoing = [];
         final List<CollectionWithThumbnail> incoming = [];
         final List<CollectionWithThumbnail> incoming = [];
         for (final file in files) {
         for (final file in files) {
-          final c =
-              CollectionsService.instance.getCollectionByID(file.collectionID);
+          final c = CollectionsService.instance.getCollectionByID(file.collectionID);
           if (c.owner.id == Configuration.instance.getUserID()) {
           if (c.owner.id == Configuration.instance.getUserID()) {
             if (c.sharees.isNotEmpty || c.publicURLs.isNotEmpty) {
             if (c.sharees.isNotEmpty || c.publicURLs.isNotEmpty) {
               outgoing.add(
               outgoing.add(
@@ -87,12 +82,10 @@ class _SharedCollectionGalleryState extends State<SharedCollectionGallery>
           }
           }
         }
         }
         outgoing.sort((first, second) {
         outgoing.sort((first, second) {
-          return second.collection.updationTime
-              .compareTo(first.collection.updationTime);
+          return second.collection.updationTime.compareTo(first.collection.updationTime);
         });
         });
         incoming.sort((first, second) {
         incoming.sort((first, second) {
-          return second.collection.updationTime
-              .compareTo(first.collection.updationTime);
+          return second.collection.updationTime.compareTo(first.collection.updationTime);
         });
         });
         return SharedCollections(outgoing, incoming);
         return SharedCollections(outgoing, incoming);
       }),
       }),
@@ -114,10 +107,10 @@ class _SharedCollectionGalleryState extends State<SharedCollectionGallery>
     const double crossAxisSpacingOfGrid = 9;
     const double crossAxisSpacingOfGrid = 9;
     Size size = MediaQuery.of(context).size;
     Size size = MediaQuery.of(context).size;
     int albumsCountInOneRow = max(size.width ~/ 220.0, 2);
     int albumsCountInOneRow = max(size.width ~/ 220.0, 2);
-    double totalWhiteSpaceOfRow = (horizontalPaddingOfGridRow * 2) +
-        (albumsCountInOneRow - 1) * crossAxisSpacingOfGrid;
-    final double sideOfThumbnail = (size.width / albumsCountInOneRow) -
-        (totalWhiteSpaceOfRow / albumsCountInOneRow);
+    double totalWhiteSpaceOfRow =
+        (horizontalPaddingOfGridRow * 2) + (albumsCountInOneRow - 1) * crossAxisSpacingOfGrid;
+    final double sideOfThumbnail =
+        (size.width / albumsCountInOneRow) - (totalWhiteSpaceOfRow / albumsCountInOneRow);
     return SingleChildScrollView(
     return SingleChildScrollView(
       child: Container(
       child: Container(
         margin: const EdgeInsets.only(bottom: 50),
         margin: const EdgeInsets.only(bottom: 50),
@@ -142,8 +135,7 @@ class _SharedCollectionGalleryState extends State<SharedCollectionGallery>
                         crossAxisCount: albumsCountInOneRow,
                         crossAxisCount: albumsCountInOneRow,
                         mainAxisSpacing: 12,
                         mainAxisSpacing: 12,
                         crossAxisSpacing: crossAxisSpacingOfGrid,
                         crossAxisSpacing: crossAxisSpacingOfGrid,
-                        childAspectRatio:
-                            sideOfThumbnail / (sideOfThumbnail + 24),
+                        childAspectRatio: sideOfThumbnail / (sideOfThumbnail + 24),
                       ), //24 is height of album title
                       ), //24 is height of album title
                     ),
                     ),
                   )
                   )
@@ -257,7 +249,7 @@ class _SharedCollectionGalleryState extends State<SharedCollectionGallery>
                   toastLength: Toast.LENGTH_LONG,
                   toastLength: Toast.LENGTH_LONG,
                 );
                 );
                 Bus.instance.fire(
                 Bus.instance.fire(
-                  TabChangedEvent(1, TabChangedEventSource.collections_page),
+                  TabChangedEvent(1, TabChangedEventSource.collectionsPage),
                 );
                 );
               },
               },
             ),
             ),
@@ -293,8 +285,7 @@ class OutgoingCollectionItem extends StatelessWidget {
     final sharees = <String>[];
     final sharees = <String>[];
     for (int index = 0; index < c.collection.sharees.length; index++) {
     for (int index = 0; index < c.collection.sharees.length; index++) {
       final sharee = c.collection.sharees[index];
       final sharee = c.collection.sharees[index];
-      final name =
-          (sharee.name?.isNotEmpty ?? false) ? sharee.name : sharee.email;
+      final name = (sharee.name?.isNotEmpty ?? false) ? sharee.name : sharee.email;
       if (index < 2) {
       if (index < 2) {
         sharees.add(name);
         sharees.add(name);
       } else {
       } else {
@@ -304,10 +295,7 @@ class OutgoingCollectionItem extends StatelessWidget {
           sharees.add(name);
           sharees.add(name);
         } else {
         } else {
           sharees.add(
           sharees.add(
-            "and " +
-                remaining.toString() +
-                " other" +
-                (remaining > 1 ? "s" : ""),
+            "and " + remaining.toString() + " other" + (remaining > 1 ? "s" : ""),
           );
           );
         }
         }
         break;
         break;
@@ -347,9 +335,7 @@ class OutgoingCollectionItem extends StatelessWidget {
                         ),
                         ),
                       ),
                       ),
                       Padding(padding: EdgeInsets.all(2)),
                       Padding(padding: EdgeInsets.all(2)),
-                      c.collection.publicURLs.isEmpty
-                          ? Container()
-                          : Icon(Icons.link),
+                      c.collection.publicURLs.isEmpty ? Container() : Icon(Icons.link),
                     ],
                     ],
                   ),
                   ),
                   sharees.isEmpty
                   sharees.isEmpty
@@ -375,7 +361,7 @@ class OutgoingCollectionItem extends StatelessWidget {
       onTap: () {
       onTap: () {
         final page = CollectionPage(
         final page = CollectionPage(
           c,
           c,
-          appBarType: GalleryType.owned_collection,
+          appBarType: GalleryType.ownedCollection,
           tagPrefix: "outgoing_collection",
           tagPrefix: "outgoing_collection",
         );
         );
         routeToPage(context, page);
         routeToPage(context, page);
@@ -396,14 +382,13 @@ class IncomingCollectionItem extends StatelessWidget {
   Widget build(BuildContext context) {
   Widget build(BuildContext context) {
     const double horizontalPaddingOfGridRow = 16;
     const double horizontalPaddingOfGridRow = 16;
     const double crossAxisSpacingOfGrid = 9;
     const double crossAxisSpacingOfGrid = 9;
-    TextStyle albumTitleTextStyle =
-        Theme.of(context).textTheme.subtitle1.copyWith(fontSize: 14);
+    TextStyle albumTitleTextStyle = Theme.of(context).textTheme.subtitle1.copyWith(fontSize: 14);
     Size size = MediaQuery.of(context).size;
     Size size = MediaQuery.of(context).size;
     int albumsCountInOneRow = max(size.width ~/ 220.0, 2);
     int albumsCountInOneRow = max(size.width ~/ 220.0, 2);
-    double totalWhiteSpaceOfRow = (horizontalPaddingOfGridRow * 2) +
-        (albumsCountInOneRow - 1) * crossAxisSpacingOfGrid;
-    final double sideOfThumbnail = (size.width / albumsCountInOneRow) -
-        (totalWhiteSpaceOfRow / albumsCountInOneRow);
+    double totalWhiteSpaceOfRow =
+        (horizontalPaddingOfGridRow * 2) + (albumsCountInOneRow - 1) * crossAxisSpacingOfGrid;
+    final double sideOfThumbnail =
+        (size.width / albumsCountInOneRow) - (totalWhiteSpaceOfRow / albumsCountInOneRow);
     return GestureDetector(
     return GestureDetector(
       child: Column(
       child: Column(
         crossAxisAlignment: CrossAxisAlignment.start,
         crossAxisAlignment: CrossAxisAlignment.start,
@@ -424,8 +409,7 @@ class IncomingCollectionItem extends StatelessWidget {
                     alignment: Alignment.bottomRight,
                     alignment: Alignment.bottomRight,
                     child: Container(
                     child: Container(
                       child: Text(
                       child: Text(
-                        c.collection.owner.name == null ||
-                                c.collection.owner.name.isEmpty
+                        c.collection.owner.name == null || c.collection.owner.name.isEmpty
                             ? c.collection.owner.email.substring(0, 1)
                             ? c.collection.owner.email.substring(0, 1)
                             : c.collection.owner.name.substring(0, 1),
                             : c.collection.owner.name.substring(0, 1),
                         textAlign: TextAlign.center,
                         textAlign: TextAlign.center,
@@ -434,9 +418,7 @@ class IncomingCollectionItem extends StatelessWidget {
                       margin: EdgeInsets.fromLTRB(0, 0, 4, 0),
                       margin: EdgeInsets.fromLTRB(0, 0, 4, 0),
                       decoration: BoxDecoration(
                       decoration: BoxDecoration(
                         shape: BoxShape.circle,
                         shape: BoxShape.circle,
-                        color: Theme.of(context)
-                            .colorScheme
-                            .defaultBackgroundColor,
+                        color: Theme.of(context).colorScheme.defaultBackgroundColor,
                       ),
                       ),
                     ),
                     ),
                   ),
                   ),
@@ -486,7 +468,7 @@ class IncomingCollectionItem extends StatelessWidget {
           context,
           context,
           CollectionPage(
           CollectionPage(
             c,
             c,
-            appBarType: GalleryType.shared_collection,
+            appBarType: GalleryType.sharedCollection,
             tagPrefix: "shared_collection",
             tagPrefix: "shared_collection",
           ),
           ),
         );
         );

+ 13 - 17
lib/ui/status_bar_widget.dart

@@ -22,8 +22,8 @@ class _StatusBarWidgetState extends State<StatusBarWidget> {
   @override
   @override
   void initState() {
   void initState() {
     _subscription = Bus.instance.on<SyncStatusUpdate>().listen((event) {
     _subscription = Bus.instance.on<SyncStatusUpdate>().listen((event) {
-      if (event.status == SyncStatus.completed_first_gallery_import ||
-          event.status == SyncStatus.completed_backup) {
+      if (event.status == SyncStatus.completedFirstGalleryImport ||
+          event.status == SyncStatus.completedBackup) {
         Future.delayed(Duration(milliseconds: 2000), () {
         Future.delayed(Duration(milliseconds: 2000), () {
           if (mounted) {
           if (mounted) {
             setState(() {
             setState(() {
@@ -110,17 +110,16 @@ class _SyncStatusWidgetState extends State<SyncStatusWidget> {
   @override
   @override
   Widget build(BuildContext context) {
   Widget build(BuildContext context) {
     bool isNotOutdatedEvent = _event != null &&
     bool isNotOutdatedEvent = _event != null &&
-        (_event.status == SyncStatus.completed_backup ||
-            _event.status == SyncStatus.completed_first_gallery_import) &&
-        (DateTime.now().microsecondsSinceEpoch - _event.timestamp >
-            kSleepDuration.inMicroseconds);
+        (_event.status == SyncStatus.completedBackup ||
+            _event.status == SyncStatus.completedFirstGalleryImport) &&
+        (DateTime.now().microsecondsSinceEpoch - _event.timestamp > kSleepDuration.inMicroseconds);
     if (_event == null || isNotOutdatedEvent) {
     if (_event == null || isNotOutdatedEvent) {
       return Container();
       return Container();
     }
     }
     if (_event.status == SyncStatus.error) {
     if (_event.status == SyncStatus.error) {
       return HeaderErrorWidget(error: _event.error);
       return HeaderErrorWidget(error: _event.error);
     }
     }
-    if (_event.status == SyncStatus.completed_backup) {
+    if (_event.status == SyncStatus.completedBackup) {
       return SyncStatusCompletedWidget();
       return SyncStatusCompletedWidget();
     }
     }
     return RefreshIndicatorWidget(_event);
     return RefreshIndicatorWidget(_event);
@@ -172,21 +171,18 @@ class RefreshIndicatorWidget extends StatelessWidget {
   }
   }
 
 
   String _getRefreshingText() {
   String _getRefreshingText() {
-    if (event.status == SyncStatus.started_first_gallery_import ||
-        event.status == SyncStatus.completed_first_gallery_import) {
+    if (event.status == SyncStatus.startedFirstGalleryImport ||
+        event.status == SyncStatus.completedFirstGalleryImport) {
       return "Loading gallery...";
       return "Loading gallery...";
     }
     }
-    if (event.status == SyncStatus.applying_remote_diff) {
+    if (event.status == SyncStatus.applyingRemoteDiff) {
       return "Syncing...";
       return "Syncing...";
     }
     }
-    if (event.status == SyncStatus.preparing_for_upload) {
+    if (event.status == SyncStatus.preparingForUpload) {
       return "Encrypting backup...";
       return "Encrypting backup...";
     }
     }
-    if (event.status == SyncStatus.in_progress) {
-      return event.completed.toString() +
-          "/" +
-          event.total.toString() +
-          " memories preserved";
+    if (event.status == SyncStatus.inProgress) {
+      return event.completed.toString() + "/" + event.total.toString() + " memories preserved";
     }
     }
     if (event.status == SyncStatus.paused) {
     if (event.status == SyncStatus.paused) {
       return event.reason;
       return event.reason;
@@ -194,7 +190,7 @@ class RefreshIndicatorWidget extends StatelessWidget {
     if (event.status == SyncStatus.error) {
     if (event.status == SyncStatus.error) {
       return event.reason ?? "Upload failed";
       return event.reason ?? "Upload failed";
     }
     }
-    if (event.status == SyncStatus.completed_backup) {
+    if (event.status == SyncStatus.completedBackup) {
       if (event.wasStopped) {
       if (event.wasStopped) {
         return "Sync stopped";
         return "Sync stopped";
       }
       }

+ 3 - 7
lib/ui/tools/free_space_page.dart

@@ -1,5 +1,4 @@
 import 'package:flutter/material.dart';
 import 'package:flutter/material.dart';
-import 'package:flutter/widgets.dart';
 import 'package:intl/intl.dart';
 import 'package:intl/intl.dart';
 import 'package:logging/logging.dart';
 import 'package:logging/logging.dart';
 import 'package:photos/ente_theme_data.dart';
 import 'package:photos/ente_theme_data.dart';
@@ -33,8 +32,7 @@ class _FreeSpacePageState extends State<FreeSpacePage> {
     Logger("FreeSpacePage").info(
     Logger("FreeSpacePage").info(
       "Number of uploaded files: " + widget.status.localIDs.length.toString(),
       "Number of uploaded files: " + widget.status.localIDs.length.toString(),
     );
     );
-    Logger("FreeSpacePage")
-        .info("Space consumed: " + widget.status.size.toString());
+    Logger("FreeSpacePage").info("Space consumed: " + widget.status.size.toString());
     return SingleChildScrollView(
     return SingleChildScrollView(
       child: _getWidget(widget.status),
       child: _getWidget(widget.status),
     );
     );
@@ -49,8 +47,7 @@ class _FreeSpacePageState extends State<FreeSpacePage> {
       color: Theme.of(context).colorScheme.onSurface.withOpacity(0.8),
       color: Theme.of(context).colorScheme.onSurface.withOpacity(0.8),
       fontWeight: FontWeight.w500,
       fontWeight: FontWeight.w500,
     );
     );
-    final isLightMode =
-        MediaQuery.of(context).platformBrightness == Brightness.light;
+    final isLightMode = MediaQuery.of(context).platformBrightness == Brightness.light;
     return Column(
     return Column(
       mainAxisAlignment: MainAxisAlignment.center,
       mainAxisAlignment: MainAxisAlignment.center,
       crossAxisAlignment: CrossAxisAlignment.center,
       crossAxisAlignment: CrossAxisAlignment.center,
@@ -83,8 +80,7 @@ class _FreeSpacePageState extends State<FreeSpacePage> {
               Expanded(
               Expanded(
                 child: Text(
                 child: Text(
                   count == 1
                   count == 1
-                      ? formattedCount.toString() +
-                          " file on this device has been backed up safely"
+                      ? formattedCount.toString() + " file on this device has been backed up safely"
                       : formattedCount.toString() +
                       : formattedCount.toString() +
                           " files on this device have been backed up safely",
                           " files on this device have been backed up safely",
                   style: informationTextStyle,
                   style: informationTextStyle,

+ 34 - 36
lib/ui/tools/set_wallpaper_dialog.dart

@@ -22,42 +22,40 @@ class _SetWallpaperDialogState extends State<SetWallpaperDialog> {
   Widget build(BuildContext context) {
   Widget build(BuildContext context) {
     final alert = AlertDialog(
     final alert = AlertDialog(
       title: Text("Set wallpaper"),
       title: Text("Set wallpaper"),
-      content: Container(
-        child: Column(
-          mainAxisSize: MainAxisSize.min,
-          children: [
-            RadioListTile(
-              title: const Text("Homescreen"),
-              value: WallpaperManagerFlutter.HOME_SCREEN,
-              groupValue: _lockscreenValue,
-              onChanged: (v) {
-                setState(() {
-                  _lockscreenValue = v;
-                });
-              },
-            ),
-            RadioListTile(
-              title: const Text("Lockscreen"),
-              value: WallpaperManagerFlutter.LOCK_SCREEN,
-              groupValue: _lockscreenValue,
-              onChanged: (v) {
-                setState(() {
-                  _lockscreenValue = v;
-                });
-              },
-            ),
-            RadioListTile(
-              title: const Text("Both"),
-              value: WallpaperManagerFlutter.BOTH_SCREENS,
-              groupValue: _lockscreenValue,
-              onChanged: (v) {
-                setState(() {
-                  _lockscreenValue = v;
-                });
-              },
-            ),
-          ],
-        ),
+      content: Column(
+        mainAxisSize: MainAxisSize.min,
+        children: [
+          RadioListTile(
+            title: const Text("Homescreen"),
+            value: WallpaperManagerFlutter.HOME_SCREEN,
+            groupValue: _lockscreenValue,
+            onChanged: (v) {
+              setState(() {
+                _lockscreenValue = v;
+              });
+            },
+          ),
+          RadioListTile(
+            title: const Text("Lockscreen"),
+            value: WallpaperManagerFlutter.LOCK_SCREEN,
+            groupValue: _lockscreenValue,
+            onChanged: (v) {
+              setState(() {
+                _lockscreenValue = v;
+              });
+            },
+          ),
+          RadioListTile(
+            title: const Text("Both"),
+            value: WallpaperManagerFlutter.BOTH_SCREENS,
+            groupValue: _lockscreenValue,
+            onChanged: (v) {
+              setState(() {
+                _lockscreenValue = v;
+              });
+            },
+          ),
+        ],
       ),
       ),
       actions: [
       actions: [
         TextButton(
         TextButton(

+ 1 - 1
lib/ui/viewer/file/custom_app_bar.dart

@@ -4,7 +4,7 @@ class CustomAppBar extends PreferredSize {
   final Widget child;
   final Widget child;
   final double height;
   final double height;
 
 
-  CustomAppBar(this.child, {this.height = kToolbarHeight});
+  const CustomAppBar(this.child, {Key key, this.height = kToolbarHeight}) : super(key: key);
 
 
   @override
   @override
   Size get preferredSize => Size.fromHeight(height);
   Size get preferredSize => Size.fromHeight(height);

+ 2 - 5
lib/ui/viewer/file/exif_info_dialog.dart

@@ -24,7 +24,7 @@ class _ExifInfoDialogState extends State<ExifInfoDialog> {
       ),
       ),
       content: Scrollbar(
       content: Scrollbar(
         controller: scrollController,
         controller: scrollController,
-        isAlwaysShown: true,
+        thumbVisibility: true,
         child: SingleChildScrollView(
         child: SingleChildScrollView(
           controller: scrollController,
           controller: scrollController,
           child: _getInfo(),
           child: _getInfo(),
@@ -71,10 +71,7 @@ class _ExifInfoDialogState extends State<ExifInfoDialog> {
                       FontFeature.tabularFigures(),
                       FontFeature.tabularFigures(),
                     ],
                     ],
                     height: 1.4,
                     height: 1.4,
-                    color: Theme.of(context)
-                        .colorScheme
-                        .onSurface
-                        .withOpacity(0.7),
+                    color: Theme.of(context).colorScheme.onSurface.withOpacity(0.7),
                   ),
                   ),
                 ),
                 ),
               ),
               ),

+ 2 - 4
lib/ui/viewer/file/video_controls.dart

@@ -156,8 +156,7 @@ class _VideoControlsState extends State<VideoControls> {
           color: Colors.transparent,
           color: Colors.transparent,
           child: Center(
           child: Center(
             child: AnimatedOpacity(
             child: AnimatedOpacity(
-              opacity:
-                  _latestValue != null && !_hideStuff && !_dragging ? 1.0 : 0.0,
+              opacity: _latestValue != null && !_hideStuff && !_dragging ? 1.0 : 0.0,
               duration: Duration(milliseconds: 300),
               duration: Duration(milliseconds: 300),
               child: GestureDetector(
               child: GestureDetector(
                 onTap: _playPause,
                 onTap: _playPause,
@@ -226,8 +225,7 @@ class _VideoControlsState extends State<VideoControls> {
 
 
     _updateState();
     _updateState();
 
 
-    if ((controller.value != null && controller.value.isPlaying) ||
-        chewieController.autoPlay) {
+    if ((controller.value != null && controller.value.isPlaying) || chewieController.autoPlay) {
       _startHideTimer();
       _startHideTimer();
     }
     }
 
 

+ 2 - 2
lib/ui/viewer/gallery/collection_page.dart

@@ -20,8 +20,8 @@ class CollectionPage extends StatelessWidget {
   CollectionPage(
   CollectionPage(
     this.c, {
     this.c, {
     this.tagPrefix = "collection",
     this.tagPrefix = "collection",
-    this.appBarType = GalleryType.owned_collection,
-    this.overlayType = GalleryType.owned_collection,
+    this.appBarType = GalleryType.ownedCollection,
+    this.overlayType = GalleryType.ownedCollection,
     Key key,
     Key key,
   }) : super(key: key);
   }) : super(key: key);
 
 

+ 7 - 15
lib/ui/viewer/gallery/device_folder_page.dart

@@ -38,9 +38,7 @@ class DeviceFolderPage extends StatelessWidget {
       },
       },
       tagPrefix: "device_folder:" + folder.path,
       tagPrefix: "device_folder:" + folder.path,
       selectedFiles: _selectedFiles,
       selectedFiles: _selectedFiles,
-      header: Configuration.instance.hasConfiguredAccount()
-          ? _getHeaderWidget()
-          : Container(),
+      header: Configuration.instance.hasConfiguredAccount() ? _getHeaderWidget() : Container(),
       initialFiles: [folder.thumbnail],
       initialFiles: [folder.thumbnail],
       footer: SizedBox(height: 32),
       footer: SizedBox(height: 32),
     );
     );
@@ -48,7 +46,7 @@ class DeviceFolderPage extends StatelessWidget {
       appBar: PreferredSize(
       appBar: PreferredSize(
         preferredSize: Size.fromHeight(50.0),
         preferredSize: Size.fromHeight(50.0),
         child: GalleryAppBarWidget(
         child: GalleryAppBarWidget(
-          GalleryType.local_folder,
+          GalleryType.localFolder,
           folder.name,
           folder.name,
           _selectedFiles,
           _selectedFiles,
           path: folder.thumbnail.deviceFolder,
           path: folder.thumbnail.deviceFolder,
@@ -59,7 +57,7 @@ class DeviceFolderPage extends StatelessWidget {
         children: [
         children: [
           gallery,
           gallery,
           GalleryOverlayWidget(
           GalleryOverlayWidget(
-            GalleryType.local_folder,
+            GalleryType.localFolder,
             _selectedFiles,
             _selectedFiles,
           )
           )
         ],
         ],
@@ -78,16 +76,13 @@ class BackupConfigurationHeaderWidget extends StatefulWidget {
   BackupConfigurationHeaderWidget(this.path, {Key key}) : super(key: key);
   BackupConfigurationHeaderWidget(this.path, {Key key}) : super(key: key);
 
 
   @override
   @override
-  _BackupConfigurationHeaderWidgetState createState() =>
-      _BackupConfigurationHeaderWidgetState();
+  _BackupConfigurationHeaderWidgetState createState() => _BackupConfigurationHeaderWidgetState();
 }
 }
 
 
-class _BackupConfigurationHeaderWidgetState
-    extends State<BackupConfigurationHeaderWidget> {
+class _BackupConfigurationHeaderWidgetState extends State<BackupConfigurationHeaderWidget> {
   @override
   @override
   Widget build(BuildContext context) {
   Widget build(BuildContext context) {
-    final isBackedUp =
-        Configuration.instance.getPathsToBackUp().contains(widget.path);
+    final isBackedUp = Configuration.instance.getPathsToBackUp().contains(widget.path);
     return Container(
     return Container(
       padding: EdgeInsets.only(left: 20, right: 12, top: 4, bottom: 4),
       padding: EdgeInsets.only(left: 20, right: 12, top: 4, bottom: 4),
       margin: EdgeInsets.only(bottom: 12),
       margin: EdgeInsets.only(bottom: 12),
@@ -100,10 +95,7 @@ class _BackupConfigurationHeaderWidgetState
               : Text(
               : Text(
                   "Backup disabled",
                   "Backup disabled",
                   style: TextStyle(
                   style: TextStyle(
-                    color: Theme.of(context)
-                        .colorScheme
-                        .defaultTextColor
-                        .withOpacity(0.7),
+                    color: Theme.of(context).colorScheme.defaultTextColor.withOpacity(0.7),
                   ),
                   ),
                 ),
                 ),
           Switch(
           Switch(

+ 12 - 21
lib/ui/viewer/gallery/gallery_app_bar_widget.dart

@@ -26,9 +26,10 @@ class GalleryAppBarWidget extends StatefulWidget {
     this.type,
     this.type,
     this.title,
     this.title,
     this.selectedFiles, {
     this.selectedFiles, {
+    Key key,
     this.path,
     this.path,
     this.collection,
     this.collection,
-  });
+  }) : super(key: key);
 
 
   @override
   @override
   _GalleryAppBarWidgetState createState() => _GalleryAppBarWidgetState();
   _GalleryAppBarWidgetState createState() => _GalleryAppBarWidgetState();
@@ -46,8 +47,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
       setState(() {});
       setState(() {});
     };
     };
     widget.selectedFiles.addListener(_selectedFilesListener);
     widget.selectedFiles.addListener(_selectedFilesListener);
-    _userAuthEventSubscription =
-        Bus.instance.on<SubscriptionPurchasedEvent>().listen((event) {
+    _userAuthEventSubscription = Bus.instance.on<SubscriptionPurchasedEvent>().listen((event) {
       setState(() {});
       setState(() {});
     });
     });
     _appBarTitle = widget.title;
     _appBarTitle = widget.title;
@@ -65,8 +65,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
   Widget build(BuildContext context) {
   Widget build(BuildContext context) {
     // if (widget.selectedFiles.files.isEmpty) {
     // if (widget.selectedFiles.files.isEmpty) {
     return AppBar(
     return AppBar(
-      backgroundColor:
-          widget.type == GalleryType.homepage ? Color(0x00000000) : null,
+      backgroundColor: widget.type == GalleryType.homepage ? Color(0x00000000) : null,
       elevation: 0,
       elevation: 0,
       centerTitle: false,
       centerTitle: false,
       title: widget.type == GalleryType.homepage
       title: widget.type == GalleryType.homepage
@@ -74,10 +73,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
           : TextButton(
           : TextButton(
               child: Text(
               child: Text(
                 _appBarTitle,
                 _appBarTitle,
-                style: Theme.of(context)
-                    .textTheme
-                    .headline5
-                    .copyWith(fontSize: 16),
+                style: Theme.of(context).textTheme.headline5.copyWith(fontSize: 16),
               ),
               ),
               onPressed: () => _renameAlbum(context),
               onPressed: () => _renameAlbum(context),
             ),
             ),
@@ -86,7 +82,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
   }
   }
 
 
   Future<dynamic> _renameAlbum(BuildContext context) async {
   Future<dynamic> _renameAlbum(BuildContext context) async {
-    if (widget.type != GalleryType.owned_collection) {
+    if (widget.type != GalleryType.ownedCollection) {
       return;
       return;
     }
     }
     final result = await showDialog<String>(
     final result = await showDialog<String>(
@@ -120,8 +116,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
     List<Widget> actions = <Widget>[];
     List<Widget> actions = <Widget>[];
     if (Configuration.instance.hasConfiguredAccount() &&
     if (Configuration.instance.hasConfiguredAccount() &&
         widget.selectedFiles.files.isEmpty &&
         widget.selectedFiles.files.isEmpty &&
-        (widget.type == GalleryType.local_folder ||
-            widget.type == GalleryType.owned_collection)) {
+        (widget.type == GalleryType.localFolder || widget.type == GalleryType.ownedCollection)) {
       actions.add(
       actions.add(
         Tooltip(
         Tooltip(
           message: "Share",
           message: "Share",
@@ -134,7 +129,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
         ),
         ),
       );
       );
     }
     }
-    if (widget.type == GalleryType.owned_collection) {
+    if (widget.type == GalleryType.ownedCollection) {
       actions.add(
       actions.add(
         PopupMenuButton(
         PopupMenuButton(
           itemBuilder: (context) {
           itemBuilder: (context) {
@@ -180,9 +175,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
               await changeCollectionVisibility(
               await changeCollectionVisibility(
                 context,
                 context,
                 widget.collection,
                 widget.collection,
-                widget.collection.isArchived()
-                    ? kVisibilityVisible
-                    : kVisibilityArchive,
+                widget.collection.isArchived() ? kVisibilityVisible : kVisibilityArchive,
               );
               );
             }
             }
           },
           },
@@ -198,17 +191,15 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
     await dialog.show();
     await dialog.show();
     try {
     try {
       if (collection == null) {
       if (collection == null) {
-        if (widget.type == GalleryType.local_folder) {
-          collection =
-              await CollectionsService.instance.getOrCreateForPath(widget.path);
+        if (widget.type == GalleryType.localFolder) {
+          collection = await CollectionsService.instance.getOrCreateForPath(widget.path);
         } else {
         } else {
           throw Exception(
           throw Exception(
             "Cannot create a collection of type" + widget.type.toString(),
             "Cannot create a collection of type" + widget.type.toString(),
           );
           );
         }
         }
       } else {
       } else {
-        final sharees =
-            await CollectionsService.instance.getSharees(collection.id);
+        final sharees = await CollectionsService.instance.getSharees(collection.id);
         collection = collection.copyWith(sharees: sharees);
         collection = collection.copyWith(sharees: sharees);
       }
       }
       await dialog.hide();
       await dialog.hide();

+ 16 - 33
lib/ui/viewer/gallery/gallery_overlay_widget.dart

@@ -50,8 +50,7 @@ class _GalleryOverlayWidgetState extends State<GalleryOverlayWidget> {
       setState(() {});
       setState(() {});
     };
     };
     widget.selectedFiles.addListener(_selectedFilesListener);
     widget.selectedFiles.addListener(_selectedFilesListener);
-    _userAuthEventSubscription =
-        Bus.instance.on<SubscriptionPurchasedEvent>().listen((event) {
+    _userAuthEventSubscription = Bus.instance.on<SubscriptionPurchasedEvent>().listen((event) {
       setState(() {});
       setState(() {});
     });
     });
     super.initState();
     super.initState();
@@ -121,8 +120,7 @@ class _OverlayWidgetState extends State<OverlayWidget> {
       setState(() {});
       setState(() {});
     };
     };
     widget.selectedFiles.addListener(_selectedFilesListener);
     widget.selectedFiles.addListener(_selectedFilesListener);
-    _userAuthEventSubscription =
-        Bus.instance.on<SubscriptionPurchasedEvent>().listen((event) {
+    _userAuthEventSubscription = Bus.instance.on<SubscriptionPurchasedEvent>().listen((event) {
       setState(() {});
       setState(() {});
     });
     });
     super.initState();
     super.initState();
@@ -152,9 +150,7 @@ class _OverlayWidgetState extends State<OverlayWidget> {
                 child: BackdropFilter(
                 child: BackdropFilter(
                   filter: ImageFilter.blur(sigmaX: 50, sigmaY: 50),
                   filter: ImageFilter.blur(sigmaX: 50, sigmaY: 50),
                   child: Container(
                   child: Container(
-                    color: Theme.of(context)
-                        .colorScheme
-                        .frostyBlurBackdropFilterColor,
+                    color: Theme.of(context).colorScheme.frostyBlurBackdropFilterColor,
                     width: double.infinity,
                     width: double.infinity,
                     child: Row(
                     child: Row(
                       mainAxisAlignment: MainAxisAlignment.spaceBetween,
                       mainAxisAlignment: MainAxisAlignment.spaceBetween,
@@ -162,15 +158,10 @@ class _OverlayWidgetState extends State<OverlayWidget> {
                         Padding(
                         Padding(
                           padding: const EdgeInsets.fromLTRB(13, 13, 0, 13),
                           padding: const EdgeInsets.fromLTRB(13, 13, 0, 13),
                           child: Text(
                           child: Text(
-                            widget.selectedFiles.files.length.toString() +
-                                ' selected',
-                            style: Theme.of(context)
-                                .textTheme
-                                .subtitle2
-                                .copyWith(
+                            widget.selectedFiles.files.length.toString() + ' selected',
+                            style: Theme.of(context).textTheme.subtitle2.copyWith(
                                   fontWeight: FontWeight.w600,
                                   fontWeight: FontWeight.w600,
-                                  color:
-                                      Theme.of(context).colorScheme.iconColor,
+                                  color: Theme.of(context).colorScheme.iconColor,
                                 ),
                                 ),
                           ),
                           ),
                         ),
                         ),
@@ -197,9 +188,7 @@ class _OverlayWidgetState extends State<OverlayWidget> {
                       padding: EdgeInsets.symmetric(vertical: 8),
                       padding: EdgeInsets.symmetric(vertical: 8),
                       //height: 32,
                       //height: 32,
                       width: 86,
                       width: 86,
-                      color: Theme.of(context)
-                          .colorScheme
-                          .frostyBlurBackdropFilterColor,
+                      color: Theme.of(context).colorScheme.frostyBlurBackdropFilterColor,
                       child: Center(
                       child: Center(
                         child: Text(
                         child: Text(
                           'Cancel',
                           'Cancel',
@@ -260,15 +249,13 @@ class _OverlayWidgetState extends State<OverlayWidget> {
     }
     }
     // skip add button for incoming collection till this feature is implemented
     // skip add button for incoming collection till this feature is implemented
     if (Configuration.instance.hasConfiguredAccount() &&
     if (Configuration.instance.hasConfiguredAccount() &&
-        widget.type != GalleryType.shared_collection) {
+        widget.type != GalleryType.sharedCollection) {
       String msg = "Add";
       String msg = "Add";
       IconData iconData = Platform.isAndroid ? Icons.add : CupertinoIcons.add;
       IconData iconData = Platform.isAndroid ? Icons.add : CupertinoIcons.add;
       // show upload icon instead of add for files selected in local gallery
       // show upload icon instead of add for files selected in local gallery
-      if (widget.type == GalleryType.local_folder) {
+      if (widget.type == GalleryType.localFolder) {
         msg = "Upload";
         msg = "Upload";
-        iconData = Platform.isAndroid
-            ? Icons.cloud_upload
-            : CupertinoIcons.cloud_upload;
+        iconData = Platform.isAndroid ? Icons.cloud_upload : CupertinoIcons.cloud_upload;
       }
       }
       actions.add(
       actions.add(
         Tooltip(
         Tooltip(
@@ -284,7 +271,7 @@ class _OverlayWidgetState extends State<OverlayWidget> {
       );
       );
     }
     }
     if (Configuration.instance.hasConfiguredAccount() &&
     if (Configuration.instance.hasConfiguredAccount() &&
-        widget.type == GalleryType.owned_collection &&
+        widget.type == GalleryType.ownedCollection &&
         widget.collection.type != CollectionType.favorites) {
         widget.collection.type != CollectionType.favorites) {
       actions.add(
       actions.add(
         Tooltip(
         Tooltip(
@@ -292,9 +279,7 @@ class _OverlayWidgetState extends State<OverlayWidget> {
           child: IconButton(
           child: IconButton(
             color: Theme.of(context).colorScheme.iconColor,
             color: Theme.of(context).colorScheme.iconColor,
             icon: Icon(
             icon: Icon(
-              Platform.isAndroid
-                  ? Icons.arrow_forward
-                  : CupertinoIcons.arrow_right,
+              Platform.isAndroid ? Icons.arrow_forward : CupertinoIcons.arrow_right,
             ),
             ),
             onPressed: () {
             onPressed: () {
               _moveFiles();
               _moveFiles();
@@ -318,21 +303,20 @@ class _OverlayWidgetState extends State<OverlayWidget> {
     );
     );
     if (widget.type == GalleryType.homepage ||
     if (widget.type == GalleryType.homepage ||
         widget.type == GalleryType.archive ||
         widget.type == GalleryType.archive ||
-        widget.type == GalleryType.local_folder) {
+        widget.type == GalleryType.localFolder) {
       actions.add(
       actions.add(
         Tooltip(
         Tooltip(
           message: "Delete",
           message: "Delete",
           child: IconButton(
           child: IconButton(
             color: Theme.of(context).colorScheme.iconColor,
             color: Theme.of(context).colorScheme.iconColor,
-            icon:
-                Icon(Platform.isAndroid ? Icons.delete : CupertinoIcons.delete),
+            icon: Icon(Platform.isAndroid ? Icons.delete : CupertinoIcons.delete),
             onPressed: () {
             onPressed: () {
               _showDeleteSheet(context);
               _showDeleteSheet(context);
             },
             },
           ),
           ),
         ),
         ),
       );
       );
-    } else if (widget.type == GalleryType.owned_collection) {
+    } else if (widget.type == GalleryType.ownedCollection) {
       if (widget.collection.type == CollectionType.folder) {
       if (widget.collection.type == CollectionType.folder) {
         actions.add(
         actions.add(
           Tooltip(
           Tooltip(
@@ -366,8 +350,7 @@ class _OverlayWidgetState extends State<OverlayWidget> {
       }
       }
     }
     }
 
 
-    if (widget.type == GalleryType.homepage ||
-        widget.type == GalleryType.archive) {
+    if (widget.type == GalleryType.homepage || widget.type == GalleryType.archive) {
       bool showArchive = widget.type == GalleryType.homepage;
       bool showArchive = widget.type == GalleryType.homepage;
       actions.add(
       actions.add(
         Tooltip(
         Tooltip(

+ 6 - 10
lib/ui/viewer/search/location_search_results_page.dart

@@ -18,12 +18,10 @@ class LocationSearchResultsPage extends StatefulWidget {
   final ViewPort viewPort;
   final ViewPort viewPort;
   final String name;
   final String name;
 
 
-  LocationSearchResultsPage(this.viewPort, this.name, {Key key})
-      : super(key: key);
+  LocationSearchResultsPage(this.viewPort, this.name, {Key key}) : super(key: key);
 
 
   @override
   @override
-  _LocationSearchResultsPageState createState() =>
-      _LocationSearchResultsPageState();
+  _LocationSearchResultsPageState createState() => _LocationSearchResultsPageState();
 }
 }
 
 
 class _LocationSearchResultsPageState extends State<LocationSearchResultsPage> {
 class _LocationSearchResultsPageState extends State<LocationSearchResultsPage> {
@@ -35,12 +33,10 @@ class _LocationSearchResultsPageState extends State<LocationSearchResultsPage> {
       appBar: AppBar(
       appBar: AppBar(
         title: Text(widget.name),
         title: Text(widget.name),
       ),
       ),
-      body: Container(
-        child: Gallery(
-          tagPrefix: "location_search",
-          selectedFiles: _selectedFiles,
-          footer: SizedBox(height: 32),
-        ),
+      body: Gallery(
+        tagPrefix: "location_search",
+        selectedFiles: _selectedFiles,
+        footer: SizedBox(height: 32),
       ),
       ),
     );
     );
   }
   }

+ 1 - 1
lib/ui/viewer/search/location_search_widget.dart

@@ -95,7 +95,7 @@ class LocationSearchResultWidget extends StatelessWidget {
   @override
   @override
   Widget build(BuildContext context) {
   Widget build(BuildContext context) {
     return Container(
     return Container(
-      padding: new EdgeInsets.symmetric(vertical: 6.0, horizontal: 6.0),
+      padding: EdgeInsets.symmetric(vertical: 6.0, horizontal: 6.0),
       margin: EdgeInsets.symmetric(vertical: 6.0),
       margin: EdgeInsets.symmetric(vertical: 6.0),
       child: Column(
       child: Column(
         children: <Widget>[
         children: <Widget>[

+ 2 - 0
lib/ui/viewer/search/search_page.dart

@@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
 import 'package:photos/ui/viewer/search/location_search_widget.dart';
 import 'package:photos/ui/viewer/search/location_search_widget.dart';
 
 
 class SearchPage extends StatefulWidget {
 class SearchPage extends StatefulWidget {
+  const SearchPage({Key key}) : super(key: key);
+
   @override
   @override
   _SearchPageState createState() => _SearchPageState();
   _SearchPageState createState() => _SearchPageState();
 }
 }

+ 3 - 4
lib/utils/file_sync_util.dart

@@ -63,12 +63,11 @@ Future<List<File>> getUnsyncedFiles(
   Set<String> invalidIDs,
   Set<String> invalidIDs,
   Computer computer,
   Computer computer,
 ) async {
 ) async {
-  final args = Map<String, dynamic>();
+  final Map<String, dynamic> args = <String, dynamic>{};
   args['assets'] = assets;
   args['assets'] = assets;
   args['existingIDs'] = existingIDs;
   args['existingIDs'] = existingIDs;
   args['invalidIDs'] = invalidIDs;
   args['invalidIDs'] = invalidIDs;
-  final unsyncedAssets =
-      await computer.compute(_getUnsyncedAssets, param: args);
+  final unsyncedAssets = await computer.compute(_getUnsyncedAssets, param: args);
   if (unsyncedAssets.isEmpty) {
   if (unsyncedAssets.isEmpty) {
     return [];
     return [];
   }
   }
@@ -158,7 +157,7 @@ Future<List<File>> _computeFiles(
   List<File> files,
   List<File> files,
   Computer computer,
   Computer computer,
 ) async {
 ) async {
-  final args = Map<String, dynamic>();
+  final Map<String, dynamic> args = <String, dynamic>{};
   args["pathEntity"] = pathEntity;
   args["pathEntity"] = pathEntity;
   args["assetList"] = await _getAllAssetLists(pathEntity);
   args["assetList"] = await _getAllAssetLists(pathEntity);
   args["fromTime"] = fromTime;
   args["fromTime"] = fromTime;

+ 43 - 77
lib/utils/file_uploader.dart

@@ -42,7 +42,7 @@ class FileUploader {
 
 
   final _logger = Logger("FileUploader");
   final _logger = Logger("FileUploader");
   final _dio = Network.instance.getDio();
   final _dio = Network.instance.getDio();
-  final _queue = LinkedHashMap<String, FileUploadItem>();
+  final LinkedHashMap _queue = LinkedHashMap<String, FileUploadItem>();
   final _uploadLocks = UploadLocksDB.instance;
   final _uploadLocks = UploadLocksDB.instance;
   final kSafeBufferForLockExpiry = Duration(days: 1).inMicroseconds;
   final kSafeBufferForLockExpiry = Duration(days: 1).inMicroseconds;
   final kBGTaskDeathTimeout = Duration(seconds: 5).inMicroseconds;
   final kBGTaskDeathTimeout = Duration(seconds: 5).inMicroseconds;
@@ -68,19 +68,17 @@ class FileUploader {
   Future<void> init(bool isBackground) async {
   Future<void> init(bool isBackground) async {
     _prefs = await SharedPreferences.getInstance();
     _prefs = await SharedPreferences.getInstance();
     _isBackground = isBackground;
     _isBackground = isBackground;
-    _processType =
-        isBackground ? ProcessType.background : ProcessType.foreground;
+    _processType = isBackground ? ProcessType.background : ProcessType.foreground;
     final currentTime = DateTime.now().microsecondsSinceEpoch;
     final currentTime = DateTime.now().microsecondsSinceEpoch;
     await _uploadLocks.releaseLocksAcquiredByOwnerBefore(
     await _uploadLocks.releaseLocksAcquiredByOwnerBefore(
       _processType.toString(),
       _processType.toString(),
       currentTime,
       currentTime,
     );
     );
-    await _uploadLocks
-        .releaseAllLocksAcquiredBefore(currentTime - kSafeBufferForLockExpiry);
+    await _uploadLocks.releaseAllLocksAcquiredBefore(currentTime - kSafeBufferForLockExpiry);
     if (!isBackground) {
     if (!isBackground) {
       await _prefs.reload();
       await _prefs.reload();
-      final isBGTaskDead = (_prefs.getInt(kLastBGTaskHeartBeatTime) ?? 0) <
-          (currentTime - kBGTaskDeathTimeout);
+      final isBGTaskDead =
+          (_prefs.getInt(kLastBGTaskHeartBeatTime) ?? 0) < (currentTime - kBGTaskDeathTimeout);
       if (isBGTaskDead) {
       if (isBGTaskDead) {
         await _uploadLocks.releaseLocksAcquiredByOwnerBefore(
         await _uploadLocks.releaseLocksAcquiredByOwnerBefore(
           ProcessType.background.toString(),
           ProcessType.background.toString(),
@@ -138,10 +136,7 @@ class FileUploader {
 
 
   Future<File> forceUpload(File file, int collectionID) async {
   Future<File> forceUpload(File file, int collectionID) async {
     _logger.info(
     _logger.info(
-      "Force uploading " +
-          file.toString() +
-          " into collection " +
-          collectionID.toString(),
+      "Force uploading " + file.toString() + " into collection " + collectionID.toString(),
     );
     );
     _totalCountInUploadSession++;
     _totalCountInUploadSession++;
     // If the file hasn't been queued yet, ez.
     // If the file hasn't been queued yet, ez.
@@ -151,22 +146,20 @@ class FileUploader {
         file,
         file,
         collectionID,
         collectionID,
         completer,
         completer,
-        status: UploadStatus.in_progress,
+        status: UploadStatus.inProgress,
       );
       );
       _encryptAndUploadFileToCollection(file, collectionID, forcedUpload: true);
       _encryptAndUploadFileToCollection(file, collectionID, forcedUpload: true);
       return completer.future;
       return completer.future;
     }
     }
     var item = _queue[file.localID];
     var item = _queue[file.localID];
     // If the file is being uploaded right now, wait and proceed
     // If the file is being uploaded right now, wait and proceed
-    if (item.status == UploadStatus.in_progress ||
-        item.status == UploadStatus.in_background) {
+    if (item.status == UploadStatus.inProgress || item.status == UploadStatus.inBackground) {
       _totalCountInUploadSession--;
       _totalCountInUploadSession--;
       final uploadedFile = await item.completer.future;
       final uploadedFile = await item.completer.future;
       if (uploadedFile.collectionID == collectionID) {
       if (uploadedFile.collectionID == collectionID) {
         // Do nothing
         // Do nothing
       } else {
       } else {
-        await CollectionsService.instance
-            .addToCollection(collectionID, [uploadedFile]);
+        await CollectionsService.instance.addToCollection(collectionID, [uploadedFile]);
       }
       }
       return uploadedFile;
       return uploadedFile;
     } else {
     } else {
@@ -175,7 +168,7 @@ class FileUploader {
       // 2. Force upload the file
       // 2. Force upload the file
       // 3. Add to the relevant collection
       // 3. Add to the relevant collection
       item = _queue[file.localID];
       item = _queue[file.localID];
-      item.status = UploadStatus.in_progress;
+      item.status = UploadStatus.inProgress;
       final uploadedFile = await _encryptAndUploadFileToCollection(
       final uploadedFile = await _encryptAndUploadFileToCollection(
         file,
         file,
         collectionID,
         collectionID,
@@ -184,8 +177,7 @@ class FileUploader {
       if (item.collectionID == collectionID) {
       if (item.collectionID == collectionID) {
         return uploadedFile;
         return uploadedFile;
       } else {
       } else {
-        await CollectionsService.instance
-            .addToCollection(item.collectionID, [uploadedFile]);
+        await CollectionsService.instance.addToCollection(item.collectionID, [uploadedFile]);
         return uploadedFile;
         return uploadedFile;
       }
       }
     }
     }
@@ -198,7 +190,7 @@ class FileUploader {
   void clearQueue(final Error reason) {
   void clearQueue(final Error reason) {
     final List<String> uploadsToBeRemoved = [];
     final List<String> uploadsToBeRemoved = [];
     _queue.entries
     _queue.entries
-        .where((entry) => entry.value.status == UploadStatus.not_started)
+        .where((entry) => entry.value.status == UploadStatus.notStarted)
         .forEach((pendingUpload) {
         .forEach((pendingUpload) {
       uploadsToBeRemoved.add(pendingUpload.key);
       uploadsToBeRemoved.add(pendingUpload.key);
     });
     });
@@ -211,7 +203,7 @@ class FileUploader {
   void removeFromQueueWhere(final bool Function(File) fn, final Error reason) {
   void removeFromQueueWhere(final bool Function(File) fn, final Error reason) {
     List<String> uploadsToBeRemoved = [];
     List<String> uploadsToBeRemoved = [];
     _queue.entries
     _queue.entries
-        .where((entry) => entry.value.status == UploadStatus.not_started)
+        .where((entry) => entry.value.status == UploadStatus.notStarted)
         .forEach((pendingUpload) {
         .forEach((pendingUpload) {
       if (fn(pendingUpload.value.file)) {
       if (fn(pendingUpload.value.file)) {
         uploadsToBeRemoved.add(pendingUpload.key);
         uploadsToBeRemoved.add(pendingUpload.key);
@@ -235,7 +227,7 @@ class FileUploader {
     if (_uploadCounter < kMaximumConcurrentUploads) {
     if (_uploadCounter < kMaximumConcurrentUploads) {
       var pendingEntry = _queue.entries
       var pendingEntry = _queue.entries
           .firstWhere(
           .firstWhere(
-            (entry) => entry.value.status == UploadStatus.not_started,
+            (entry) => entry.value.status == UploadStatus.notStarted,
             orElse: () => null,
             orElse: () => null,
           )
           )
           ?.value;
           ?.value;
@@ -247,14 +239,14 @@ class FileUploader {
         pendingEntry = _queue.entries
         pendingEntry = _queue.entries
             .firstWhere(
             .firstWhere(
               (entry) =>
               (entry) =>
-                  entry.value.status == UploadStatus.not_started &&
+                  entry.value.status == UploadStatus.notStarted &&
                   entry.value.file.fileType != FileType.video,
                   entry.value.file.fileType != FileType.video,
               orElse: () => null,
               orElse: () => null,
             )
             )
             ?.value;
             ?.value;
       }
       }
       if (pendingEntry != null) {
       if (pendingEntry != null) {
-        pendingEntry.status = UploadStatus.in_progress;
+        pendingEntry.status = UploadStatus.inProgress;
         _encryptAndUploadFileToCollection(
         _encryptAndUploadFileToCollection(
           pendingEntry.file,
           pendingEntry.file,
           pendingEntry.collectionID,
           pendingEntry.collectionID,
@@ -274,8 +266,7 @@ class FileUploader {
     }
     }
     final localID = file.localID;
     final localID = file.localID;
     try {
     try {
-      final uploadedFile =
-          await _tryToUpload(file, collectionID, forcedUpload).timeout(
+      final uploadedFile = await _tryToUpload(file, collectionID, forcedUpload).timeout(
         kFileUploadTimeout,
         kFileUploadTimeout,
         onTimeout: () {
         onTimeout: () {
           final message = "Upload timed out for file " + file.toString();
           final message = "Upload timed out for file " + file.toString();
@@ -287,7 +278,7 @@ class FileUploader {
       return uploadedFile;
       return uploadedFile;
     } catch (e) {
     } catch (e) {
       if (e is LockAlreadyAcquiredError) {
       if (e is LockAlreadyAcquiredError) {
-        _queue[localID].status = UploadStatus.in_background;
+        _queue[localID].status = UploadStatus.inBackground;
         return _queue[localID].completer.future;
         return _queue[localID].completer.future;
       } else {
       } else {
         _queue.remove(localID).completer.completeError(e);
         _queue.remove(localID).completer.completeError(e);
@@ -308,9 +299,8 @@ class FileUploader {
     bool forcedUpload,
     bool forcedUpload,
   ) async {
   ) async {
     final connectivityResult = await (Connectivity().checkConnectivity());
     final connectivityResult = await (Connectivity().checkConnectivity());
-    var canUploadUnderCurrentNetworkConditions =
-        (connectivityResult == ConnectivityResult.wifi ||
-            Configuration.instance.shouldBackupOverMobileData());
+    var canUploadUnderCurrentNetworkConditions = (connectivityResult == ConnectivityResult.wifi ||
+        Configuration.instance.shouldBackupOverMobileData());
     if (!canUploadUnderCurrentNetworkConditions && !forcedUpload) {
     if (!canUploadUnderCurrentNetworkConditions && !forcedUpload) {
       throw WiFiUnavailableError();
       throw WiFiUnavailableError();
     }
     }
@@ -334,10 +324,8 @@ class FileUploader {
     }
     }
 
 
     final tempDirectory = Configuration.instance.getTempDirectory();
     final tempDirectory = Configuration.instance.getTempDirectory();
-    final encryptedFilePath = tempDirectory +
-        file.generatedID.toString() +
-        (_isBackground ? "_bg" : "") +
-        ".encrypted";
+    final encryptedFilePath =
+        tempDirectory + file.generatedID.toString() + (_isBackground ? "_bg" : "") + ".encrypted";
     final encryptedThumbnailPath = tempDirectory +
     final encryptedThumbnailPath = tempDirectory +
         file.generatedID.toString() +
         file.generatedID.toString() +
         "_thumbnail" +
         "_thumbnail" +
@@ -347,10 +335,7 @@ class FileUploader {
 
 
     try {
     try {
       _logger.info(
       _logger.info(
-        "Trying to upload " +
-            file.toString() +
-            ", isForced: " +
-            forcedUpload.toString(),
+        "Trying to upload " + file.toString() + ", isForced: " + forcedUpload.toString(),
       );
       );
       try {
       try {
         mediaUploadData = await getUploadDataFromEnteFile(file);
         mediaUploadData = await getUploadDataFromEnteFile(file);
@@ -362,8 +347,7 @@ class FileUploader {
         }
         }
       }
       }
       Uint8List key;
       Uint8List key;
-      bool isUpdatedFile =
-          file.uploadedFileID != null && file.updationTime == -1;
+      bool isUpdatedFile = file.uploadedFileID != null && file.updationTime == -1;
       if (isUpdatedFile) {
       if (isUpdatedFile) {
         _logger.info("File was updated " + file.toString());
         _logger.info("File was updated " + file.toString());
         key = decryptFileKey(file);
         key = decryptFileKey(file);
@@ -388,29 +372,23 @@ class FileUploader {
         await io.File(encryptedThumbnailPath).delete();
         await io.File(encryptedThumbnailPath).delete();
       }
       }
       final encryptedThumbnailFile = io.File(encryptedThumbnailPath);
       final encryptedThumbnailFile = io.File(encryptedThumbnailPath);
-      await encryptedThumbnailFile
-          .writeAsBytes(encryptedThumbnailData.encryptedData);
+      await encryptedThumbnailFile.writeAsBytes(encryptedThumbnailData.encryptedData);
 
 
       final thumbnailUploadURL = await _getUploadURL();
       final thumbnailUploadURL = await _getUploadURL();
-      String thumbnailObjectKey =
-          await _putFile(thumbnailUploadURL, encryptedThumbnailFile);
+      String thumbnailObjectKey = await _putFile(thumbnailUploadURL, encryptedThumbnailFile);
 
 
       final fileUploadURL = await _getUploadURL();
       final fileUploadURL = await _getUploadURL();
       String fileObjectKey = await _putFile(fileUploadURL, encryptedFile);
       String fileObjectKey = await _putFile(fileUploadURL, encryptedFile);
 
 
-      final metadata =
-          await file.getMetadataForUpload(mediaUploadData.sourceFile);
+      final metadata = await file.getMetadataForUpload(mediaUploadData.sourceFile);
       final encryptedMetadataData = await CryptoUtil.encryptChaCha(
       final encryptedMetadataData = await CryptoUtil.encryptChaCha(
         utf8.encode(jsonEncode(metadata)),
         utf8.encode(jsonEncode(metadata)),
         fileAttributes.key,
         fileAttributes.key,
       );
       );
       final fileDecryptionHeader = Sodium.bin2base64(fileAttributes.header);
       final fileDecryptionHeader = Sodium.bin2base64(fileAttributes.header);
-      final thumbnailDecryptionHeader =
-          Sodium.bin2base64(encryptedThumbnailData.header);
-      final encryptedMetadata =
-          Sodium.bin2base64(encryptedMetadataData.encryptedData);
-      final metadataDecryptionHeader =
-          Sodium.bin2base64(encryptedMetadataData.header);
+      final thumbnailDecryptionHeader = Sodium.bin2base64(encryptedThumbnailData.header);
+      final encryptedMetadata = Sodium.bin2base64(encryptedMetadataData.encryptedData);
+      final metadataDecryptionHeader = Sodium.bin2base64(encryptedMetadataData.header);
       if (SyncService.instance.shouldStopSync()) {
       if (SyncService.instance.shouldStopSync()) {
         throw SyncStopRequestedError();
         throw SyncStopRequestedError();
       }
       }
@@ -434,10 +412,8 @@ class FileUploader {
           fileAttributes.key,
           fileAttributes.key,
           CollectionsService.instance.getCollectionKey(collectionID),
           CollectionsService.instance.getCollectionKey(collectionID),
         );
         );
-        final encryptedKey =
-            Sodium.bin2base64(encryptedFileKeyData.encryptedData);
-        final keyDecryptionNonce =
-            Sodium.bin2base64(encryptedFileKeyData.nonce);
+        final encryptedKey = Sodium.bin2base64(encryptedFileKeyData.encryptedData);
+        final keyDecryptionNonce = Sodium.bin2base64(encryptedFileKeyData.nonce);
         remoteFile = await _uploadFile(
         remoteFile = await _uploadFile(
           file,
           file,
           collectionID,
           collectionID,
@@ -474,9 +450,7 @@ class FileUploader {
       }
       }
       rethrow;
       rethrow;
     } finally {
     } finally {
-      if (io.Platform.isIOS &&
-          mediaUploadData != null &&
-          mediaUploadData.sourceFile != null) {
+      if (io.Platform.isIOS && mediaUploadData != null && mediaUploadData.sourceFile != null) {
         await mediaUploadData.sourceFile.delete();
         await mediaUploadData.sourceFile.delete();
       }
       }
       if (io.File(encryptedFilePath).existsSync()) {
       if (io.File(encryptedFilePath).existsSync()) {
@@ -680,9 +654,7 @@ class FileUploader {
             headers: {"X-Auth-Token": Configuration.instance.getToken()},
             headers: {"X-Auth-Token": Configuration.instance.getToken()},
           ),
           ),
         );
         );
-        final urls = (response.data["urls"] as List)
-            .map((e) => UploadURL.fromMap(e))
-            .toList();
+        final urls = (response.data["urls"] as List).map((e) => UploadURL.fromMap(e)).toList();
         _uploadURLs.addAll(urls);
         _uploadURLs.addAll(urls);
       } on DioError catch (e, s) {
       } on DioError catch (e, s) {
         if (e.response != null) {
         if (e.response != null) {
@@ -719,10 +691,7 @@ class FileUploader {
   }) async {
   }) async {
     final fileSize = contentLength ?? await file.length();
     final fileSize = contentLength ?? await file.length();
     _logger.info(
     _logger.info(
-      "Putting object for " +
-          file.toString() +
-          " of size: " +
-          fileSize.toString(),
+      "Putting object for " + file.toString() + " of size: " + fileSize.toString(),
     );
     );
     final startTime = DateTime.now().millisecondsSinceEpoch;
     final startTime = DateTime.now().millisecondsSinceEpoch;
     try {
     try {
@@ -737,8 +706,7 @@ class FileUploader {
       );
       );
       _logger.info(
       _logger.info(
         "Upload speed : " +
         "Upload speed : " +
-            (fileSize / (DateTime.now().millisecondsSinceEpoch - startTime))
-                .toString() +
+            (fileSize / (DateTime.now().millisecondsSinceEpoch - startTime)).toString() +
             " kilo bytes per second",
             " kilo bytes per second",
       );
       );
 
 
@@ -773,9 +741,8 @@ class FileUploader {
   }
   }
 
 
   Future<void> _pollBackgroundUploadStatus() async {
   Future<void> _pollBackgroundUploadStatus() async {
-    final blockedUploads = _queue.entries
-        .where((e) => e.value.status == UploadStatus.in_background)
-        .toList();
+    final blockedUploads =
+        _queue.entries.where((e) => e.value.status == UploadStatus.inBackground).toList();
     for (final upload in blockedUploads) {
     for (final upload in blockedUploads) {
       final file = upload.value.file;
       final file = upload.value.file;
       final isStillLocked = await _uploadLocks.isLocked(
       final isStillLocked = await _uploadLocks.isLocked(
@@ -784,8 +751,7 @@ class FileUploader {
       );
       );
       if (!isStillLocked) {
       if (!isStillLocked) {
         final completer = _queue.remove(upload.key).completer;
         final completer = _queue.remove(upload.key).completer;
-        final dbFile =
-            await FilesDB.instance.getFile(upload.value.file.generatedID);
+        final dbFile = await FilesDB.instance.getFile(upload.value.file.generatedID);
         if (dbFile.uploadedFileID != null) {
         if (dbFile.uploadedFileID != null) {
           _logger.info("Background upload success detected");
           _logger.info("Background upload success detected");
           completer.complete(dbFile);
           completer.complete(dbFile);
@@ -811,14 +777,14 @@ class FileUploadItem {
     this.file,
     this.file,
     this.collectionID,
     this.collectionID,
     this.completer, {
     this.completer, {
-    this.status = UploadStatus.not_started,
+    this.status = UploadStatus.notStarted,
   });
   });
 }
 }
 
 
 enum UploadStatus {
 enum UploadStatus {
-  not_started,
-  in_progress,
-  in_background,
+  notStarted,
+  inProgress,
+  inBackground,
   completed,
   completed,
 }
 }
 
 

+ 1 - 1
lib/utils/hex.dart

@@ -27,7 +27,7 @@ class HexEncoder extends Converter<List<int>, String> {
 
 
   @override
   @override
   String convert(List<int> bytes) {
   String convert(List<int> bytes) {
-    StringBuffer buffer = new StringBuffer();
+    StringBuffer buffer = StringBuffer();
     for (int part in bytes) {
     for (int part in bytes) {
       if (part & 0xff != part) {
       if (part & 0xff != part) {
         throw FormatException("Non-byte integer detected");
         throw FormatException("Non-byte integer detected");