Просмотр исходного кода

Merge pull request #293 from ente-io/onboarding_fixes

Vishnu Mohandas 3 лет назад
Родитель
Сommit
d018d0b2a9
41 измененных файлов с 215 добавлено и 182 удалено
  1. BIN
      fonts/Montserrat-Bold.ttf
  2. BIN
      fonts/Montserrat-Medium.ttf
  3. BIN
      fonts/NunitoSans-Bold.ttf
  4. BIN
      fonts/NunitoSans-Regular.ttf
  5. BIN
      fonts/Ubuntu-Light.ttf
  6. BIN
      fonts/Ubuntu-Regular.ttf
  7. 16 1
      lib/ente_theme_data.dart
  8. 8 8
      lib/services/user_service.dart
  9. 1 1
      lib/ui/collections_gallery_widget.dart
  10. 9 5
      lib/ui/create_collection_page.dart
  11. 1 1
      lib/ui/deduplicate_page.dart
  12. 6 6
      lib/ui/fading_app_bar.dart
  13. 1 1
      lib/ui/file_info_dialog.dart
  14. 2 2
      lib/ui/gallery_overlay_widget.dart
  15. 20 4
      lib/ui/grant_permissions_widget.dart
  16. 4 4
      lib/ui/image_editor_page.dart
  17. 60 76
      lib/ui/landing_page_widget.dart
  18. 25 10
      lib/ui/loading_photos_widget.dart
  19. 1 1
      lib/ui/manage_links_widget.dart
  20. 1 1
      lib/ui/password_entry_page.dart
  21. 0 1
      lib/ui/payment/child_subscription_widget.dart
  22. 3 3
      lib/ui/payment/stripe_subscription_page.dart
  23. 1 1
      lib/ui/payment/subscription_page.dart
  24. 1 1
      lib/ui/recovery_key_page.dart
  25. 1 1
      lib/ui/recovery_page.dart
  26. 1 1
      lib/ui/sessions_page.dart
  27. 2 2
      lib/ui/set_wallpaper_dialog.dart
  28. 3 3
      lib/ui/settings/account_section_widget.dart
  29. 3 2
      lib/ui/settings/backup_section_widget.dart
  30. 0 1
      lib/ui/settings/danger_section_widget.dart
  31. 1 1
      lib/ui/settings/info_section_widget.dart
  32. 2 2
      lib/ui/settings/security_section_widget.dart
  33. 3 3
      lib/ui/share_collection_widget.dart
  34. 1 1
      lib/ui/shared_collections_gallery.dart
  35. 1 1
      lib/ui/two_factor_setup_page.dart
  36. 1 1
      lib/ui/video_widget.dart
  37. 3 3
      lib/ui/zoomable_live_image.dart
  38. 6 6
      lib/utils/delete_file_util.dart
  39. 13 9
      lib/utils/magic_util.dart
  40. 13 9
      lib/utils/toast_util.dart
  41. 1 9
      pubspec.yaml

BIN
fonts/Montserrat-Bold.ttf


BIN
fonts/Montserrat-Medium.ttf


BIN
fonts/NunitoSans-Bold.ttf


BIN
fonts/NunitoSans-Regular.ttf


BIN
fonts/Ubuntu-Light.ttf


BIN
fonts/Ubuntu-Regular.ttf


+ 16 - 1
lib/ente_theme_data.dart

@@ -55,7 +55,7 @@ extension CustomColorScheme on ColorScheme {
       ? Colors.white
       : Color.fromRGBO(10, 15, 15, 1.0);
 
-  Color get greenText => Color.fromRGBO(40, 190, 92, 1);
+  Color get greenText => Color.fromARGB(255, 40, 190, 113);
 
   Color get cupertinoPickerTopColor => brightness == Brightness.light
       ? Color.fromARGB(255, 238, 238, 238)
@@ -102,6 +102,21 @@ extension CustomColorScheme on ColorScheme {
   Color get backupEnabledBgColor => brightness == Brightness.light
       ? Color.fromRGBO(230, 230, 230, 0.95)
       : Color.fromRGBO(10, 40, 40, 0.3);
+
+  Color get dotsIndicatorActiveColor => brightness == Brightness.light
+      ? Colors.black.withOpacity(0.5)
+      : Colors.white.withOpacity(0.5);
+
+  Color get dotsIndicatorInactiveColor => brightness == Brightness.light
+      ? Colors.black.withOpacity(0.12)
+      : Colors.white.withOpacity(0.12);
+
+  Color get toastTextColor =>
+      brightness == Brightness.light ? Colors.white : Colors.black;
+
+  Color get toastBackgroundColor => brightness == Brightness.light
+      ? Color.fromRGBO(24, 24, 24, 0.95)
+      : Color.fromRGBO(255, 255, 255, 0.95);
 }
 
 OutlinedButtonThemeData buildOutlinedButtonThemeData(

+ 8 - 8
lib/services/user_service.dart

@@ -210,7 +210,7 @@ class UserService {
       );
       await dialog.hide();
       if (response != null && response.statusCode == 200) {
-        showShortToast("Email verification successful!");
+        showShortToast(context, "Email verification successful!");
         Widget page;
         final String twoFASessionID = response.data["twoFactorSessionID"];
         if (twoFASessionID != null && twoFASessionID.isNotEmpty) {
@@ -275,7 +275,7 @@ class UserService {
       );
       await dialog.hide();
       if (response != null && response.statusCode == 200) {
-        showToast("Email changed to " + email);
+        showToast(context, "Email changed to " + email);
         _config.setEmail(email);
         Navigator.of(context).popUntil((route) => route.isFirst);
         Bus.instance.fire(UserDetailsChangedEvent());
@@ -384,7 +384,7 @@ class UserService {
       );
       await dialog.hide();
       if (response != null && response.statusCode == 200) {
-        showToast("Authentication successful!");
+        showToast(context, "Authentication successful!");
         await _saveConfiguration(response);
         Navigator.of(context).pushAndRemoveUntil(
           MaterialPageRoute(
@@ -399,7 +399,7 @@ class UserService {
       await dialog.hide();
       _logger.severe(e);
       if (e.response != null && e.response.statusCode == 404) {
-        showToast("Session expired");
+        showToast(context, "Session expired");
         Navigator.of(context).pushAndRemoveUntil(
           MaterialPageRoute(
             builder: (BuildContext context) {
@@ -446,7 +446,7 @@ class UserService {
     } on DioError catch (e) {
       _logger.severe(e);
       if (e.response != null && e.response.statusCode == 404) {
-        showToast("Session expired");
+        showToast(context, "Session expired");
         Navigator.of(context).pushAndRemoveUntil(
           MaterialPageRoute(
             builder: (BuildContext context) {
@@ -498,7 +498,7 @@ class UserService {
         },
       );
       if (response != null && response.statusCode == 200) {
-        showShortToast("Two-factor authentication successfully reset");
+        showShortToast(context, "Two-factor authentication successfully reset");
         await _saveConfiguration(response);
         Navigator.of(context).pushAndRemoveUntil(
           MaterialPageRoute(
@@ -512,7 +512,7 @@ class UserService {
     } on DioError catch (e) {
       _logger.severe(e);
       if (e.response != null && e.response.statusCode == 404) {
-        showToast("Session expired");
+        showToast(context, "Session expired");
         Navigator.of(context).pushAndRemoveUntil(
           MaterialPageRoute(
             builder: (BuildContext context) {
@@ -622,7 +622,7 @@ class UserService {
       );
       Bus.instance.fire(TwoFactorStatusChangeEvent(false));
       await dialog.hide();
-      showToast("Two-factor authentication has been disabled");
+      showToast(context, "Two-factor authentication has been disabled");
     } catch (e, s) {
       await dialog.hide();
       _logger.severe(e, s);

+ 1 - 1
lib/ui/collections_gallery_widget.dart

@@ -486,7 +486,7 @@ class _CollectionsGalleryWidgetState extends State<CollectionsGalleryWidget>
           ),
         ),
         onTap: () async {
-          await showToast(
+          await showToast(context,
               "long press to select photos and click + to create an album",
               toastLength: Toast.LENGTH_LONG);
           Bus.instance

+ 9 - 5
lib/ui/create_collection_page.dart

@@ -181,9 +181,11 @@ class _CreateCollectionPageState extends State<CreateCollectionPage> {
         ),
         onTap: () async {
           if (await _runCollectionAction(item.collection.id)) {
-            showShortToast(widget.actionType == CollectionActionType.addFiles
-                ? "Added successfully to " + item.collection.name
-                : "Moved successfully to " + item.collection.name);
+            showShortToast(
+                context,
+                widget.actionType == CollectionActionType.addFiles
+                    ? "Added successfully to " + item.collection.name
+                    : "Moved successfully to " + item.collection.name);
             _navigateToCollection(item.collection);
           }
         },
@@ -240,9 +242,11 @@ class _CreateCollectionPageState extends State<CreateCollectionPage> {
             if (collection != null) {
               if (await _runCollectionAction(collection.id)) {
                 if (widget.actionType == CollectionActionType.restoreFiles) {
-                  showShortToast('Restored files to album ' + _albumName);
+                  showShortToast(
+                      context, 'Restored files to album ' + _albumName);
                 } else {
-                  showShortToast("Album '" + _albumName + "' created.");
+                  showShortToast(
+                      context, "Album '" + _albumName + "' created.");
                 }
                 _navigateToCollection(collection);
               }

+ 1 - 1
lib/ui/deduplicate_page.dart

@@ -64,7 +64,7 @@ class _DeduplicatePageState extends State<DeduplicatePage> {
     _duplicates =
         DeduplicationService.instance.clubDuplicatesByTime(widget.duplicates);
     _selectAllFilesButFirst();
-    showToast("Long-press on an item to view in full-screen");
+    showToast(context, "Long-press on an item to view in full-screen");
   }
 
   void _selectAllFilesButFirst() {

+ 6 - 6
lib/ui/fading_app_bar.dart

@@ -219,7 +219,7 @@ class FadingAppBarState extends State<FadingAppBar> {
           } catch (e, s) {
             _logger.severe(e, s);
             hasError = true;
-            showToast("Sorry, could not add this to favorites!");
+            showToast(context, "Sorry, could not add this to favorites!");
           } finally {
             if (shouldBlockUser) {
               await dialog.hide();
@@ -231,7 +231,7 @@ class FadingAppBarState extends State<FadingAppBar> {
           } catch (e, s) {
             _logger.severe(e, s);
             hasError = true;
-            showToast("Sorry, could not remove this from favorites!");
+            showToast(context, "Sorry, could not remove this from favorites!");
           }
         }
         return hasError ? oldValue : isLiked;
@@ -294,7 +294,7 @@ class FadingAppBarState extends State<FadingAppBar> {
         isDestructiveAction: true,
         onPressed: () async {
           await deleteFilesOnDeviceOnly(context, [file]);
-          showToast("File deleted from device");
+          showToast(context, "File deleted from device");
           Navigator.of(context, rootNavigator: true).pop();
           // TODO: Fix behavior when inside a device folder
         },
@@ -305,7 +305,7 @@ class FadingAppBarState extends State<FadingAppBar> {
         isDestructiveAction: true,
         onPressed: () async {
           await deleteFilesFromRemoteOnly(context, [file]);
-          showShortToast("Moved to trash");
+          showShortToast(context, "Moved to trash");
           Navigator.of(context, rootNavigator: true).pop();
           // TODO: Fix behavior when inside a collection
         },
@@ -364,9 +364,9 @@ class FadingAppBarState extends State<FadingAppBar> {
     Bus.instance.fire(LocalPhotosUpdatedEvent([file]));
     await dialog.hide();
     if (file.fileType == FileType.livePhoto) {
-      showToast("Photo and video saved to gallery");
+      showToast(context, "Photo and video saved to gallery");
     } else {
-      showToast("File saved to gallery");
+      showToast(context, "File saved to gallery");
     }
   }
 }

+ 1 - 1
lib/ui/file_info_dialog.dart

@@ -275,7 +275,7 @@ class _FileInfoWidgetState extends State<FileInfoWidget> {
               ],
             ),
             onPressed: () {
-              showShortToast("This image has no exif data");
+              showShortToast(context, "This image has no exif data");
             },
           ),
         );

+ 2 - 2
lib/ui/gallery_overlay_widget.dart

@@ -448,7 +448,7 @@ class _OverlayWidgetState extends State<OverlayWidget> {
           await deleteFilesOnDeviceOnly(
               context, widget.selectedFiles.files.toList());
           _clearSelectedFiles();
-          showToast("Files deleted from device");
+          showToast(context, "Files deleted from device");
         },
       ));
       actions.add(CupertinoActionSheetAction(
@@ -459,7 +459,7 @@ class _OverlayWidgetState extends State<OverlayWidget> {
           await deleteFilesFromRemoteOnly(
               context, widget.selectedFiles.files.toList());
           _clearSelectedFiles();
-          showShortToast("Moved to trash");
+          showShortToast(context, "Moved to trash");
         },
       ));
       actions.add(CupertinoActionSheetAction(

+ 20 - 4
lib/ui/grant_permissions_widget.dart

@@ -10,6 +10,8 @@ class GrantPermissionsWidget extends StatelessWidget {
   const GrantPermissionsWidget({Key key}) : super(key: key);
   @override
   Widget build(BuildContext context) {
+    final isLightMode =
+        MediaQuery.of(context).platformBrightness == Brightness.light;
     return Scaffold(
       body: SingleChildScrollView(
         physics: NeverScrollableScrollPhysics(),
@@ -23,10 +25,24 @@ class GrantPermissionsWidget extends StatelessWidget {
                 children: [
                   Center(
                     child: Padding(
-                      padding: const EdgeInsets.fromLTRB(0, 140, 0, 50),
-                      child: Image.asset(
-                        "assets/gallery.png",
-                        height: 220,
+                      padding: const EdgeInsets.fromLTRB(0, 100, 0, 50),
+                      child: Stack(
+                        alignment: Alignment.center,
+                        children: [
+                          isLightMode
+                              ? Image.asset(
+                                  'assets/loading_photos_light.png',
+                                  color: Colors.white.withOpacity(0.4),
+                                  colorBlendMode: BlendMode.modulate,
+                                )
+                              : Image.asset('assets/loading_photos_dark.png'),
+                          Center(
+                            child: Image.asset(
+                              "assets/gallery.png",
+                              height: 160,
+                            ),
+                          ),
+                        ],
                       ),
                     ),
                   ),

+ 4 - 4
lib/ui/image_editor_page.dart

@@ -300,7 +300,7 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
 
     if (img == null) {
       _logger.severe("null rawImageData");
-      showToast("Something went wrong");
+      showToast(context, "Something went wrong");
       return;
     }
 
@@ -329,7 +329,7 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
 
     if (result == null) {
       _logger.severe("null result");
-      showToast("Something went wrong");
+      showToast(context, "Something went wrong");
       return;
     }
     try {
@@ -358,7 +358,7 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
       await LocalSyncService.instance.trackEditedFile(newFile);
       Bus.instance.fire(LocalPhotosUpdatedEvent([newFile]));
       SyncService.instance.sync();
-      showToast("Edits saved");
+      showToast(context, "Edits saved");
       _logger.info("Original file " + widget.originalFile.toString());
       _logger.info("Saved edits to file " + newFile.toString());
       final existingFiles = widget.detailPageConfig.files;
@@ -377,7 +377,7 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
         ),
       );
     } catch (e, s) {
-      showToast("Oops, could not save edits");
+      showToast(context, "Oops, could not save edits");
       _logger.severe(e, s);
     }
     await dialog.hide();

+ 60 - 76
lib/ui/landing_page_widget.dart

@@ -1,6 +1,7 @@
+import 'dart:io';
+
 import 'package:dots_indicator/dots_indicator.dart';
 import 'package:flutter/material.dart';
-import 'package:flutter/widgets.dart';
 import 'package:photos/core/configuration.dart';
 import 'package:photos/ente_theme_data.dart';
 import 'package:photos/ui/common/gradientButton.dart';
@@ -31,65 +32,35 @@ class _LandingPageWidgetState extends State<LandingPageWidget> {
         child: Column(
           children: [
             Padding(padding: const EdgeInsets.all(12)),
-            Text.rich(
-              TextSpan(
-                children: const <TextSpan>[
-                  TextSpan(
-                    text: "With ",
-                    style: TextStyle(
-                      fontSize: 16,
-                    ),
-                  ),
-                  TextSpan(
-                    text: "ente",
-                    style: TextStyle(
-                      fontWeight: FontWeight.bold,
-                      fontFamily: 'Montserrat',
-                      fontSize: 16,
-                    ),
-                  ),
-                ],
+            Text(
+              "ente",
+              style: TextStyle(
+                fontWeight: FontWeight.bold,
+                fontFamily: 'Montserrat',
+                fontSize: 42,
               ),
-              textAlign: TextAlign.center,
             ),
             Padding(
-              padding: EdgeInsets.all(2),
-            ),
-            Text.rich(
-              TextSpan(
-                children: const <TextSpan>[
-                  TextSpan(
-                    text: "your ",
-                    style: TextStyle(
-                      fontSize: 16,
-                    ),
-                  ),
-                  TextSpan(
-                    text: "memories",
-                    style: TextStyle(
-                      fontWeight: FontWeight.bold,
-                      fontSize: 16,
-                    ),
-                  ),
-                  TextSpan(
-                    text: " are",
-                    style: TextStyle(
-                      fontSize: 16,
-                    ),
-                  ),
-                ],
-              ),
-              textAlign: TextAlign.center,
+              padding: EdgeInsets.all(28),
             ),
+            _getFeatureSlider(),
             Padding(
-              padding: EdgeInsets.all(24),
+              padding: EdgeInsets.all(12),
             ),
-            _getFeatureSlider(),
             DotsIndicator(
               dotsCount: 3,
               position: _featureIndex,
               decorator: DotsDecorator(
-                activeColor: Theme.of(context).buttonColor,
+                activeColor:
+                    Theme.of(context).colorScheme.dotsIndicatorActiveColor,
+                color: Theme.of(context).colorScheme.dotsIndicatorInactiveColor,
+                activeShape: RoundedRectangleBorder(
+                    borderRadius: BorderRadius.circular(3)),
+                shape: RoundedRectangleBorder(
+                    borderRadius: BorderRadius.circular(3)),
+                size: Size(100, 5),
+                activeSize: Size(100, 5),
+                spacing: EdgeInsets.all(3),
               ),
             ),
             Padding(
@@ -106,6 +77,9 @@ class _LandingPageWidgetState extends State<LandingPageWidget> {
                       Theme.of(context).colorScheme.optionalActionButtonStyle,
                   child: Text(
                     "Existing user",
+                    style: TextStyle(
+                      color: Colors.black, // same for both themes
+                    ),
                   ),
                   onPressed: _navigateToSignInPage,
                 ),
@@ -142,19 +116,27 @@ class _LandingPageWidgetState extends State<LandingPageWidget> {
     return ConstrainedBox(
       constraints: BoxConstraints(maxHeight: 320),
       child: PageView(
-        children: const [
+        children: [
           FeatureItemWidget(
-              "assets/protected.png",
-              "Protected",
-              "End-to-end encrypted with your password,",
-              "visible only to you"),
-          FeatureItemWidget("assets/synced.png", "Synced",
-              "Available across all your devices,", "web, android and ios"),
+            "assets/protected.png",
+            "Private backups",
+            "for your memories",
+            "end-to-end encrypted by default",
+          ),
           FeatureItemWidget(
-              "assets/preserved.png",
-              "Preserved",
-              "Reliably replicated to a fallout shelter,",
-              "designed to outlive"),
+            "assets/preserved.png",
+            "Safely stored",
+            "at a fallout shelter",
+            "designed to outlive",
+          ),
+          FeatureItemWidget(
+            "assets/synced.png",
+            "Available",
+            "everywhere",
+            Platform.isAndroid
+                ? "android, ios, web, desktop"
+                : "ios, android, web, desktop",
+          ),
         ],
         onPageChanged: (index) {
           setState(() {
@@ -219,12 +201,16 @@ class _LandingPageWidgetState extends State<LandingPageWidget> {
 }
 
 class FeatureItemWidget extends StatelessWidget {
-  final String assetPath, featureTitle, firstLine, secondLine;
+  final String assetPath,
+      featureTitleFirstLine,
+      featureTitleSecondLine,
+      subText;
+
   const FeatureItemWidget(
     this.assetPath,
-    this.featureTitle,
-    this.firstLine,
-    this.secondLine, {
+    this.featureTitleFirstLine,
+    this.featureTitleSecondLine,
+    this.subText, {
     Key key,
   }) : super(key: key);
 
@@ -243,23 +229,21 @@ class FeatureItemWidget extends StatelessWidget {
           mainAxisAlignment: MainAxisAlignment.start,
           children: [
             Text(
-              featureTitle,
-              style: Theme.of(context).textTheme.headline6,
+              featureTitleFirstLine,
+              style: Theme.of(context).textTheme.headline5,
             ),
-            Padding(padding: EdgeInsets.all(12)),
+            Padding(padding: EdgeInsets.all(2)),
             Text(
-              firstLine,
-              textAlign: TextAlign.center,
-              style: TextStyle(
-                color: Theme.of(context).colorScheme.onSurface.withOpacity(0.9),
-              ),
+              featureTitleSecondLine,
+              style: Theme.of(context).textTheme.headline5,
             ),
-            Padding(padding: EdgeInsets.all(2)),
+            Padding(padding: EdgeInsets.all(12)),
             Text(
-              secondLine,
+              subText,
               textAlign: TextAlign.center,
               style: TextStyle(
-                color: Theme.of(context).colorScheme.onSurface.withOpacity(0.9),
+                color: Theme.of(context).colorScheme.onSurface.withOpacity(0.5),
+                fontSize: 16,
               ),
             ),
           ],

+ 25 - 10
lib/ui/loading_photos_widget.dart

@@ -28,10 +28,10 @@ class _LoadingPhotosWidgetState extends State<LoadingPhotosWidget> {
     "We have preserved over 3 million memories so far",
     "All our apps are open source",
     "Our encryption protocols have been reviewed by engineers at Google, Apple, Amazon, and Facebook",
-    "You can share files and folders with your loved ones, end-to-end encrypted",
+    "You can share links to your albums with your loved ones",
     "Our mobile apps run in the background to encrypt and backup new photos you take",
     "We use Xchacha20Poly1305 to safely encrypt your data",
-    "One of our data centers is in a fall out shelter 25m underground",
+    "One of our data centers is in an underground fall out shelter in Paris",
   ];
 
   @override
@@ -79,6 +79,8 @@ class _LoadingPhotosWidgetState extends State<LoadingPhotosWidget> {
 
   @override
   Widget build(BuildContext context) {
+    final isLightMode =
+        MediaQuery.of(context).platformBrightness == Brightness.light;
     return Scaffold(
       body: Center(
         child: Padding(
@@ -88,20 +90,33 @@ class _LoadingPhotosWidgetState extends State<LoadingPhotosWidget> {
             mainAxisAlignment: MainAxisAlignment.spaceEvenly,
             children: [
               Stack(alignment: Alignment.center, children: [
-                Image.asset(MediaQuery.of(context).platformBrightness ==
-                        Brightness.light
-                    ? 'assets/loading_photos_light.png'
-                    : 'assets/loading_photos_dark.png'),
-                Lottie.asset('assets/loadingGalleryLottie.json', height: 300)
+                isLightMode
+                    ? Image.asset(
+                        'assets/loading_photos_light.png',
+                        color: Colors.white.withOpacity(0.5),
+                        colorBlendMode: BlendMode.modulate,
+                      )
+                    : Image.asset(
+                        'assets/loading_photos_light.png',
+                        color: Colors.white.withOpacity(0.25),
+                        colorBlendMode: BlendMode.modulate,
+                      ),
+                Lottie.asset(
+                  'assets/loadingGalleryLottie.json',
+                  height: 400,
+                )
               ]),
               Column(
                 children: [
                   Row(
                     mainAxisAlignment: MainAxisAlignment.start,
                     children: [
-                      Text("Did you know?",
-                          style: Theme.of(context).textTheme.headline6.copyWith(
-                              color: Theme.of(context).colorScheme.greenText)),
+                      Text(
+                        "Did you know?",
+                        style: Theme.of(context).textTheme.headline6.copyWith(
+                              color: Theme.of(context).colorScheme.greenText,
+                            ),
+                      ),
                     ],
                   ),
                   const SizedBox(

+ 1 - 1
lib/ui/manage_links_widget.dart

@@ -414,7 +414,7 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
     try {
       await CollectionsService.instance.updateShareUrl(widget.collection, prop);
       await dialog.hide();
-      showToast("Album updated");
+      showToast(context, "Album updated");
     } catch (e) {
       await dialog.hide();
       await showGenericErrorDialog(context);

+ 1 - 1
lib/ui/password_entry_page.dart

@@ -429,7 +429,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
           .updatePassword(_passwordController1.text);
       await UserService.instance.updateKeyAttributes(keyAttributes);
       await dialog.hide();
-      showShortToast("Password changed successfully");
+      showShortToast(context, "Password changed successfully");
       Navigator.of(context).pop();
       if (widget.mode == PasswordEntryMode.reset) {
         Bus.instance.fire(SubscriptionPurchasedEvent());

+ 0 - 1
lib/ui/payment/child_subscription_widget.dart

@@ -82,7 +82,6 @@ class ChildSubscriptionWidget extends StatelessWidget {
               child: Text(
                 "leave family",
                 style: TextStyle(
-                  fontFamily: 'Ubuntu-Regular',
                   fontWeight: FontWeight.bold,
                   fontSize: 18,
                   color: Color.fromRGBO(255, 52, 52, 1),

+ 3 - 3
lib/ui/payment/stripe_subscription_page.dart

@@ -94,7 +94,7 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
     try {
       await _fetchSub();
     } catch (e) {
-      showToast("Failed to refresh subscription");
+      showToast(context, "Failed to refresh subscription");
     }
     await _dialog.hide();
 
@@ -274,7 +274,6 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
                       text: "Manage family",
                       style: TextStyle(
                         color: Colors.blue,
-                        fontFamily: 'Ubuntu',
                         fontSize: 15,
                       ),
                     ),
@@ -384,7 +383,8 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
           : await _billingService.cancelStripeSubscription();
       await _fetchSub();
     } catch (e) {
-      showToast(isRenewCancelled ? 'failed to renew' : 'failed to cancel');
+      showToast(
+          context, isRenewCancelled ? 'failed to renew' : 'failed to cancel');
     }
     await _dialog.hide();
   }

+ 1 - 1
lib/ui/payment/subscription_page.dart

@@ -86,7 +86,7 @@ class _SubscriptionPageState extends State<SubscriptionPage> {
                 text = "your plan was successfully downgraded";
               }
             }
-            showToast(text);
+            showToast(context, text);
             _currentSubscription = newSubscription;
             _hasActiveSubscription = _currentSubscription.isValid();
             setState(() {});

+ 1 - 1
lib/ui/recovery_key_page.dart

@@ -117,7 +117,7 @@ class _RecoveryKeyPageState extends State<RecoveryKeyPage> {
                       onTap: () async {
                         await Clipboard.setData(
                             ClipboardData(text: recoveryKey));
-                        showToast("Recovery key copied to clipboard");
+                        showToast(context, "Recovery key copied to clipboard");
                         setState(() {
                           _hasTriedToSave = true;
                         });

+ 1 - 1
lib/ui/recovery_page.dart

@@ -40,7 +40,7 @@ class _RecoveryPageState extends State<RecoveryPage> {
             try {
               await Configuration.instance.recover(_recoveryKey.text.trim());
               await dialog.hide();
-              showToast("Recovery successful!");
+              showToast(context, "Recovery successful!");
               Navigator.of(context).pushReplacement(
                 MaterialPageRoute(
                   builder: (BuildContext context) {

+ 1 - 1
lib/ui/sessions_page.dart

@@ -128,7 +128,7 @@ class _SessionsPageState extends State<SessionsPage> {
     _sessions = await UserService.instance
         .getActiveSessions()
         .onError((error, stackTrace) {
-      showToast("Failed to fetch active sessions");
+      showToast(context, "Failed to fetch active sessions");
       throw error;
     });
     _sessions.sessions.sort((first, second) {

+ 2 - 2
lib/ui/set_wallpaper_dialog.dart

@@ -75,11 +75,11 @@ class _SetWallpaperDialogState extends State<SetWallpaperDialog> {
               await WallpaperManagerFlutter().setwallpaperfromFile(
                   await getFile(widget.file), _lockscreenValue);
               await dialog.hide();
-              showToast("Wallpaper set successfully");
+              showToast(context, "Wallpaper set successfully");
             } catch (e, s) {
               await dialog.hide();
               Logger("SetWallpaperDialog").severe(e, s);
-              showToast("Something went wrong");
+              showToast(context, "Something went wrong");
               return;
             }
           },

+ 3 - 3
lib/ui/settings/account_section_widget.dart

@@ -62,7 +62,7 @@ class AccountSectionWidgetState extends State<AccountSectionWidget> {
             AppLock.of(context)
                 .setEnabled(Configuration.instance.shouldShowLockScreen());
             if (!result) {
-              showToast(reason);
+              showToast(context, reason);
               return;
             }
 
@@ -91,7 +91,7 @@ class AccountSectionWidgetState extends State<AccountSectionWidget> {
             AppLock.of(context)
                 .setEnabled(Configuration.instance.shouldShowLockScreen());
             if (!result) {
-              showToast(reason);
+              showToast(context, reason);
               return;
             }
             showDialog(
@@ -116,7 +116,7 @@ class AccountSectionWidgetState extends State<AccountSectionWidget> {
             AppLock.of(context)
                 .setEnabled(Configuration.instance.shouldShowLockScreen());
             if (!result) {
-              showToast(reason);
+              showToast(context, reason);
               return;
             }
             Navigator.of(context).push(

+ 3 - 2
lib/ui/settings/backup_section_widget.dart

@@ -194,7 +194,7 @@ class BackupSectionWidgetState extends State<BackupSectionWidget> {
           ),
           onPressed: () {
             if (Platform.isIOS) {
-              showToast(
+              showToast(context,
                   "Also empty \"Recently Deleted\" from \"Settings\" -> \"Storage\" to claim the freed space");
             }
             Navigator.of(context, rootNavigator: true).pop('dialog');
@@ -251,7 +251,8 @@ class BackupSectionWidgetState extends State<BackupSectionWidget> {
             ),
           ),
           onPressed: () {
-            showToast("Also empty your \"Trash\" to claim the freed up space");
+            showToast(context,
+                "Also empty your \"Trash\" to claim the freed up space");
             Navigator.of(context, rootNavigator: true).pop('dialog');
           },
         ),

+ 0 - 1
lib/ui/settings/danger_section_widget.dart

@@ -76,7 +76,6 @@ class _DangerSectionWidgetState extends State<DangerSectionWidget> {
           style: TextStyle(
             color: Theme.of(context).colorScheme.onSurface,
             height: 1.5,
-            fontFamily: 'Ubuntu',
             fontSize: 16,
           ),
         ),

+ 1 - 1
lib/ui/settings/info_section_widget.dart

@@ -99,7 +99,7 @@ class InfoSectionWidget extends StatelessWidget {
                           barrierColor: Colors.black.withOpacity(0.85),
                         );
                       } else {
-                        showToast("You are on the latest version");
+                        showToast(context, "You are on the latest version");
                       }
                     },
                     child: SettingsTextItem(

+ 2 - 2
lib/ui/settings/security_section_widget.dart

@@ -89,7 +89,7 @@ class _SecuritySectionWidgetState extends State<SecuritySectionWidget> {
                           AppLock.of(context).setEnabled(
                               Configuration.instance.shouldShowLockScreen());
                           if (!result) {
-                            showToast(reason);
+                            showToast(context, reason);
                             return;
                           }
                           if (value) {
@@ -248,7 +248,7 @@ class _SecuritySectionWidgetState extends State<SecuritySectionWidget> {
           AppLock.of(context)
               .setEnabled(Configuration.instance.shouldShowLockScreen());
           if (!result) {
-            showToast(kAuthToViewSessions);
+            showToast(context, kAuthToViewSessions);
             return;
           }
           Navigator.of(context).push(

+ 3 - 3
lib/ui/share_collection_widget.dart

@@ -254,7 +254,7 @@ class _SharingDialogState extends State<SharingDialog> {
           GestureDetector(
             onTap: () async {
               await Clipboard.setData(ClipboardData(text: url));
-              showToast("Link copied to clipboard");
+              showToast(context, "Link copied to clipboard");
             },
             child: Container(
               padding: EdgeInsets.all(16),
@@ -406,7 +406,7 @@ class _SharingDialogState extends State<SharingDialog> {
         await CollectionsService.instance
             .share(widget.collection.id, email, publicKey);
         await dialog.hide();
-        showShortToast("Shared successfully!");
+        showShortToast(context, "Shared successfully!");
         setState(() {
           _sharees.add(User(email: email));
           _showEntryField = false;
@@ -502,7 +502,7 @@ class EmailItemWidget extends StatelessWidget {
               await CollectionsService.instance.unshare(collection.id, email);
               collection.sharees.removeWhere((user) => user.email == email);
               await dialog.hide();
-              showToast("Stopped sharing with " + email + ".");
+              showToast(context, "Stopped sharing with " + email + ".");
               Navigator.of(context).pop();
             } catch (e, s) {
               Logger("EmailItemWidget").severe(e, s);

+ 1 - 1
lib/ui/shared_collections_gallery.dart

@@ -239,7 +239,7 @@ class _SharedCollectionGalleryState extends State<SharedCollectionGallery>
                 Color(0xFF1DB954),
               ],
               onTap: () async {
-                await showToast("Select an album on ente to share",
+                await showToast(context, "Select an album on ente to share",
                     toastLength: Toast.LENGTH_LONG);
                 Bus.instance.fire(
                     TabChangedEvent(1, TabChangedEventSource.collections_page));

+ 1 - 1
lib/ui/two_factor_setup_page.dart

@@ -129,7 +129,7 @@ class _TwoFactorSetupPageState extends State<TwoFactorSetupPage>
     return GestureDetector(
       onTap: () async {
         await Clipboard.setData(ClipboardData(text: widget.secretCode));
-        showToast("Code copied to clipboard");
+        showToast(context, "Code copied to clipboard");
       },
       child: Column(
         mainAxisAlignment: MainAxisAlignment.center,

+ 1 - 1
lib/ui/video_widget.dart

@@ -75,7 +75,7 @@ class _VideoWidgetState extends State<VideoWidget> {
           setState(() {
             _progress = count / total;
             if (_progress == 1) {
-              showShortToast("decrypting video...");
+              showShortToast(context, "Decrypting video...");
             }
           });
         }

+ 3 - 3
lib/ui/zoomable_live_image.dart

@@ -115,7 +115,7 @@ class _ZoomableLiveImageState extends State<ZoomableLiveImage>
     }
     _isLoadingVideoPlayer = true;
     if (_file.isRemoteFile() && !(await isFileCached(_file, liveVideo: true))) {
-      showToast("Downloading...", toastLength: Toast.LENGTH_LONG);
+      showToast(context, "Downloading...", toastLength: Toast.LENGTH_LONG);
     }
 
     var videoFile = await getFile(widget.file, liveVideo: true)
@@ -138,7 +138,7 @@ class _ZoomableLiveImageState extends State<ZoomableLiveImage>
     if (videoFile != null && videoFile.existsSync()) {
       _setVideoPlayerController(file: videoFile);
     } else {
-      showShortToast("download failed");
+      showShortToast(context, "download failed");
     }
     _isLoadingVideoPlayer = false;
   }
@@ -159,7 +159,7 @@ class _ZoomableLiveImageState extends State<ZoomableLiveImage>
     var _preferences = await SharedPreferences.getInstance();
     int promptTillNow = _preferences.getInt(kLivePhotoToastCounterKey) ?? 0;
     if (promptTillNow < kMaxLivePhotoToastCount) {
-      showToast("Press and hold to play video");
+      showToast(context, "Press and hold to play video");
       _preferences.setInt(kLivePhotoToastCounterKey, promptTillNow + 1);
     }
   }

+ 6 - 6
lib/utils/delete_file_util.dart

@@ -119,9 +119,9 @@ Future<void> deleteFilesFromEverywhere(
     Bus.instance.fire(LocalPhotosUpdatedEvent(deletedFiles,
         type: EventType.deletedFromEverywhere));
     if (hasLocalOnlyFiles && Platform.isAndroid) {
-      showShortToast("Files deleted");
+      showShortToast(context, "Files deleted");
     } else {
-      showShortToast("Moved to trash");
+      showShortToast(context, "Moved to trash");
     }
   }
   await dialog.hide();
@@ -134,7 +134,7 @@ Future<void> deleteFilesFromRemoteOnly(
     BuildContext context, List<File> files) async {
   files.removeWhere((element) => element.uploadedFileID == null);
   if (files.isEmpty) {
-    showToast("Selected files are not on ente");
+    showToast(context, "Selected files are not on ente");
     return;
   }
   final dialog = createProgressDialog(context, "Deleting...");
@@ -239,7 +239,7 @@ Future<bool> deleteFromTrash(BuildContext context, List<File> files) async {
   await dialog.show();
   try {
     await TrashSyncService.instance.deleteFromTrash(files);
-    showShortToast("Successfully deleted");
+    showShortToast(context, "Successfully deleted");
     await dialog.hide();
     Bus.instance
         .fire(FilesUpdatedEvent(files, type: EventType.deletedFromEverywhere));
@@ -263,7 +263,7 @@ Future<bool> emptyTrash(BuildContext context) async {
   await dialog.show();
   try {
     await TrashSyncService.instance.emptyTrash();
-    showShortToast("Trash emptied");
+    showShortToast(context, "Trash emptied");
     await dialog.hide();
     return true;
   } catch (e, s) {
@@ -307,7 +307,7 @@ Future<bool> deleteLocalFiles(
     Bus.instance.fire(LocalPhotosUpdatedEvent(deletedFiles));
     return true;
   } else {
-    showToast("Could not free up space");
+    showToast(context, "Could not free up space");
     return false;
   }
 }

+ 13 - 9
lib/utils/magic_util.dart

@@ -22,9 +22,11 @@ Future<void> changeVisibility(
   await dialog.show();
   try {
     await FileMagicService.instance.changeVisibility(files, newVisibility);
-    showShortToast(newVisibility == kVisibilityArchive
-        ? "Successfully hidden"
-        : "Successfully unhidden");
+    showShortToast(
+        context,
+        newVisibility == kVisibilityArchive
+            ? "Successfully hidden"
+            : "Successfully unhidden");
 
     await dialog.hide();
   } catch (e, s) {
@@ -44,9 +46,11 @@ Future<void> changeCollectionVisibility(
     await CollectionsService.instance.updateMagicMetadata(collection, update);
     // Force reload home gallery to pull in the now unarchived files
     Bus.instance.fire(ForceReloadHomeGalleryEvent());
-    showShortToast(newVisibility == kVisibilityArchive
-        ? "Successfully hidden"
-        : "Successfully unhidden");
+    showShortToast(
+        context,
+        newVisibility == kVisibilityArchive
+            ? "Successfully hidden"
+            : "Successfully unhidden");
 
     await dialog.hide();
   } catch (e, s) {
@@ -63,7 +67,7 @@ Future<bool> editTime(
         context, files, kPubMagicKeyEditedTime, editedTime);
     return true;
   } catch (e, s) {
-    showToast('something went wrong');
+    showToast(context, 'something went wrong');
     return false;
   }
 }
@@ -92,7 +96,7 @@ Future<bool> editFilename(
         context, List.of([file]), kPubMagicKeyEditedName, result);
     return true;
   } catch (e, s) {
-    showToast('something went wrong');
+    showToast(context, 'something went wrong');
     return false;
   }
 }
@@ -107,7 +111,7 @@ Future<void> _updatePublicMetadata(
   try {
     Map<String, dynamic> update = {key: value};
     await FileMagicService.instance.updatePublicMagicMetadata(files, update);
-    showShortToast('done');
+    showShortToast(context, 'done');
     await dialog.hide();
     if (_shouldReloadGallery(key)) {
       Bus.instance.fire(ForceReloadHomeGalleryEvent());

+ 13 - 9
lib/utils/toast_util.dart

@@ -3,9 +3,13 @@ import 'dart:io';
 import 'package:flutter/material.dart';
 import 'package:flutter_easyloading/flutter_easyloading.dart';
 import 'package:fluttertoast/fluttertoast.dart';
+import 'package:photos/ente_theme_data.dart';
 
-Future<void> showToast(String message,
-    {toastLength = Toast.LENGTH_LONG}) async {
+Future<void> showToast(
+  BuildContext context,
+  String message, {
+  toastLength = Toast.LENGTH_LONG,
+}) async {
   if (Platform.isAndroid) {
     await Fluttertoast.cancel();
     return Fluttertoast.showToast(
@@ -13,14 +17,14 @@ Future<void> showToast(String message,
         toastLength: toastLength,
         gravity: ToastGravity.BOTTOM,
         timeInSecForIosWeb: 1,
-        backgroundColor: Color.fromRGBO(127, 127, 127, 0.8),
-        textColor: Colors.white,
+        backgroundColor: Theme.of(context).colorScheme.toastBackgroundColor,
+        textColor: Theme.of(context).colorScheme.toastTextColor,
         fontSize: 16.0);
   } else {
     EasyLoading.instance
-      ..backgroundColor = Color.fromRGBO(127, 127, 127, 0.8)
-      ..indicatorColor = Color.fromRGBO(127, 127, 127, 0.8)
-      ..textColor = Colors.white
+      ..backgroundColor = Theme.of(context).colorScheme.toastBackgroundColor
+      ..indicatorColor = Theme.of(context).colorScheme.toastBackgroundColor
+      ..textColor = Theme.of(context).colorScheme.toastTextColor
       ..userInteractions = true
       ..loadingStyle = EasyLoadingStyle.custom;
     return EasyLoading.showToast(
@@ -31,6 +35,6 @@ Future<void> showToast(String message,
   }
 }
 
-Future<void> showShortToast(String message) {
-  return showToast(message, toastLength: Toast.LENGTH_SHORT);
+Future<void> showShortToast(context, String message) {
+  return showToast(context, message, toastLength: Toast.LENGTH_SHORT);
 }

+ 1 - 9
pubspec.yaml

@@ -143,14 +143,6 @@ flutter:
   assets:
     - assets/
   fonts:
-  - family: NunitoSans
-    fonts:
-      - asset: fonts/NunitoSans-Regular.ttf
-      - asset: fonts/NunitoSans-Bold.ttf
-  - family: Ubuntu
-    fonts:
-      - asset: fonts/Ubuntu-Regular.ttf
-      - asset: fonts/Ubuntu-Light.ttf
   - family: Inter
     fonts:
       - asset: fonts/Inter-Regular.ttf
@@ -160,7 +152,7 @@ flutter:
       - asset: fonts/Inter-Bold.ttf
   - family: Montserrat
     fonts:
-      - asset: fonts/Montserrat-Medium.ttf
+      - asset: fonts/Montserrat-Bold.ttf
 
   # The following line ensures that the Material Icons font is
   # included with your application, so that you can use the icons in