Selaa lähdekoodia

Merge branch 'main' into make-dialogs-dismissable

ashilkn 2 vuotta sitten
vanhempi
commit
cb4f82d38b
29 muutettua tiedostoa jossa 95 lisäystä ja 176 poistoa
  1. 3 2
      hooks/pre-commit
  2. 0 1
      lib/models/filters/gallery_items_filter.dart
  3. 4 3
      lib/models/filters/important_items_filter.dart
  4. 3 5
      lib/services/billing_service.dart
  5. 2 4
      lib/ui/account/change_email_dialog.dart
  6. 10 10
      lib/ui/account/sessions_page.dart
  7. 4 6
      lib/ui/account/two_factor_authentication_page.dart
  8. 1 3
      lib/ui/account/two_factor_recovery_page.dart
  9. 6 8
      lib/ui/account/two_factor_setup_page.dart
  10. 3 5
      lib/ui/collections/archived_collections_button_widget.dart
  11. 3 7
      lib/ui/collections/create_new_album_widget.dart
  12. 3 5
      lib/ui/collections/device_folder_icon_widget.dart
  13. 5 7
      lib/ui/collections/trash_button_widget.dart
  14. 4 6
      lib/ui/home/grant_permissions_widget.dart
  15. 2 4
      lib/ui/huge_listview/place_holder_widget.dart
  16. 4 6
      lib/ui/payment/child_subscription_widget.dart
  17. 4 6
      lib/ui/payment/skip_subscription_widget.dart
  18. 1 3
      lib/ui/payment/subscription.dart
  19. 5 7
      lib/ui/settings/about_section_widget.dart
  20. 1 3
      lib/ui/settings/account_section_widget.dart
  21. 4 6
      lib/ui/settings/app_version_widget.dart
  22. 3 5
      lib/ui/settings/debug_section_widget.dart
  23. 1 3
      lib/ui/settings/general_section_widget.dart
  24. 3 4
      lib/ui/settings/security_section_widget.dart
  25. 0 35
      lib/ui/settings/settings_text_item.dart
  26. 2 4
      lib/ui/settings/social_section_widget.dart
  27. 4 4
      lib/ui/settings/support_section_widget.dart
  28. 9 11
      lib/ui/sharing/share_collection_page.dart
  29. 1 3
      lib/ui/viewer/search/result/no_result_widget.dart

+ 3 - 2
hooks/pre-commit

@@ -2,8 +2,9 @@
 # This git hook fails if a user is trying to add a new file which is
 # not null safe.
 
-# Check the contents of each file that is being added or modified
-for file in `git diff --name-only --cached`; do
+# Check the contents of each file that is being added(A) or modified(N) or
+# copied (C)
+for file in `git diff --name-only --diff-filter=ACM --cached`; do
   # Ignore the hooks from any pre-commit check
   if echo "$file" | grep -q 'hooks/'; then
     continue

+ 0 - 1
lib/models/filters/gallery_items_filter.dart

@@ -1,4 +1,3 @@
-// @dart=2.9
 import 'package:photos/models/file.dart';
 
 class GalleryItemsFilter {

+ 4 - 3
lib/models/filters/important_items_filter.dart

@@ -1,5 +1,3 @@
-// @dart=2.9
-
 import 'dart:io';
 
 import 'package:path/path.dart';
@@ -15,7 +13,10 @@ class ImportantItemsFilter implements GalleryItemsFilter {
     if (file.uploadedFileID != null) {
       return true;
     }
-    final String folder = basename(file.deviceFolder);
+    if (file.deviceFolder == null) {
+      return false;
+    }
+    final String folder = basename(file.deviceFolder!);
     if (_importantPaths.isEmpty && Platform.isAndroid) {
       return folder == "Camera" ||
           folder == "Recents" ||

+ 3 - 5
lib/services/billing_service.dart

@@ -1,5 +1,3 @@
-// @dart=2.9
-
 import 'dart:io';
 
 import 'package:dio/dio.dart';
@@ -39,7 +37,7 @@ class BillingService {
 
   bool _isOnSubscriptionPage = false;
 
-  Future<BillingPlans> _future;
+  Future<BillingPlans>? _future;
 
   void init() {
     // if (Platform.isIOS && kDebugMode) {
@@ -75,7 +73,7 @@ class BillingService {
     _future ??= _fetchBillingPlans().then((response) {
       return BillingPlans.fromMap(response.data);
     });
-    return _future;
+    return _future!;
   }
 
   Future<Response<dynamic>> _fetchBillingPlans() {
@@ -99,7 +97,7 @@ class BillingService {
       );
       return Subscription.fromMap(response.data["subscription"]);
     } on DioError catch (e) {
-      if (e.response != null && e.response.statusCode == 409) {
+      if (e.response != null && e.response!.statusCode == 409) {
         throw SubscriptionAlreadyClaimedError();
       } else {
         rethrow;

+ 2 - 4
lib/ui/account/change_email_dialog.dart

@@ -1,19 +1,17 @@
-// @dart=2.9
-
 import 'package:flutter/material.dart';
 import 'package:photos/services/user_service.dart';
 import 'package:photos/utils/dialog_util.dart';
 import 'package:photos/utils/email_util.dart';
 
 class ChangeEmailDialog extends StatefulWidget {
-  const ChangeEmailDialog({Key key}) : super(key: key);
+  const ChangeEmailDialog({Key? key}) : super(key: key);
 
   @override
   State<ChangeEmailDialog> createState() => _ChangeEmailDialogState();
 }
 
 class _ChangeEmailDialogState extends State<ChangeEmailDialog> {
-  String _email;
+  String? _email;
 
   @override
   Widget build(BuildContext context) {

+ 10 - 10
lib/ui/account/sessions_page.dart

@@ -1,5 +1,3 @@
-// @dart=2.9
-
 import 'package:flutter/material.dart';
 import 'package:logging/logging.dart';
 import 'package:photos/core/configuration.dart';
@@ -12,14 +10,14 @@ import 'package:photos/utils/dialog_util.dart';
 import 'package:photos/utils/toast_util.dart';
 
 class SessionsPage extends StatefulWidget {
-  const SessionsPage({Key key}) : super(key: key);
+  const SessionsPage({Key? key}) : super(key: key);
 
   @override
   State<SessionsPage> createState() => _SessionsPageState();
 }
 
 class _SessionsPageState extends State<SessionsPage> {
-  Sessions _sessions;
+  Sessions? _sessions;
   final Logger _logger = Logger("SessionsPageState");
 
   @override
@@ -45,7 +43,7 @@ class _SessionsPageState extends State<SessionsPage> {
     }
     final List<Widget> rows = [];
     rows.add(const Padding(padding: EdgeInsets.all(4)));
-    for (final session in _sessions.sessions) {
+    for (final session in _sessions!.sessions) {
       rows.add(_getSessionWidget(session));
     }
     return SingleChildScrollView(
@@ -133,12 +131,14 @@ class _SessionsPageState extends State<SessionsPage> {
         .getActiveSessions()
         .onError((error, stackTrace) {
       showToast(context, "Failed to fetch active sessions");
-      throw error;
-    });
-    _sessions.sessions.sort((first, second) {
-      return second.lastUsedTime.compareTo(first.lastUsedTime);
+      throw error!;
     });
-    setState(() {});
+    if (_sessions != null) {
+      _sessions!.sessions.sort((first, second) {
+        return second.lastUsedTime.compareTo(first.lastUsedTime);
+      });
+      setState(() {});
+    }
   }
 
   void _showSessionTerminationDialog(Session session) {

+ 4 - 6
lib/ui/account/two_factor_authentication_page.dart

@@ -1,5 +1,3 @@
-// @dart=2.9
-
 import 'package:flutter/material.dart';
 import 'package:flutter/services.dart';
 import 'package:photos/services/user_service.dart';
@@ -9,7 +7,7 @@ import 'package:pinput/pin_put/pin_put.dart';
 class TwoFactorAuthenticationPage extends StatefulWidget {
   final String sessionID;
 
-  const TwoFactorAuthenticationPage(this.sessionID, {Key key})
+  const TwoFactorAuthenticationPage(this.sessionID, {Key? key})
       : super(key: key);
 
   @override
@@ -25,7 +23,7 @@ class _TwoFactorAuthenticationPageState
     borderRadius: BorderRadius.circular(15.0),
   );
   String _code = "";
-  LifecycleEventHandler _lifecycleEventHandler;
+  late LifecycleEventHandler _lifecycleEventHandler;
 
   @override
   void initState() {
@@ -33,8 +31,8 @@ class _TwoFactorAuthenticationPageState
       resumeCallBack: () async {
         if (mounted) {
           final data = await Clipboard.getData(Clipboard.kTextPlain);
-          if (data != null && data.text != null && data.text.length == 6) {
-            _pinController.text = data.text;
+          if (data != null && data.text != null && data.text!.length == 6) {
+            _pinController.text = data.text!;
           }
         }
       },

+ 1 - 3
lib/ui/account/two_factor_recovery_page.dart

@@ -1,5 +1,3 @@
-// @dart=2.9
-
 import 'dart:ui';
 
 import 'package:flutter/material.dart';
@@ -15,7 +13,7 @@ class TwoFactorRecoveryPage extends StatefulWidget {
     this.sessionID,
     this.encryptedSecret,
     this.secretDecryptionNonce, {
-    Key key,
+    Key? key,
   }) : super(key: key);
 
   @override

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

@@ -1,5 +1,3 @@
-// @dart=2.9
-
 import 'dart:async';
 import 'dart:ui';
 
@@ -24,7 +22,7 @@ class TwoFactorSetupPage extends StatefulWidget {
     this.secretCode,
     this.qrCode,
     this.completer, {
-    Key key,
+    Key? key,
   }) : super(key: key);
 
   @override
@@ -33,15 +31,15 @@ class TwoFactorSetupPage extends StatefulWidget {
 
 class _TwoFactorSetupPageState extends State<TwoFactorSetupPage>
     with SingleTickerProviderStateMixin {
-  TabController _tabController;
+  late TabController _tabController;
   final _pinController = TextEditingController();
   final _pinPutDecoration = BoxDecoration(
     border: Border.all(color: const Color.fromRGBO(45, 194, 98, 1.0)),
     borderRadius: BorderRadius.circular(15.0),
   );
   String _code = "";
-  ImageProvider _imageProvider;
-  LifecycleEventHandler _lifecycleEventHandler;
+  late ImageProvider _imageProvider;
+  late LifecycleEventHandler _lifecycleEventHandler;
 
   @override
   void initState() {
@@ -55,8 +53,8 @@ class _TwoFactorSetupPageState extends State<TwoFactorSetupPage>
       resumeCallBack: () async {
         if (mounted) {
           final data = await Clipboard.getData(Clipboard.kTextPlain);
-          if (data != null && data.text != null && data.text.length == 6) {
-            _pinController.text = data.text;
+          if (data != null && data.text != null && data.text!.length == 6) {
+            _pinController.text = data.text!;
           }
         }
       },

+ 3 - 5
lib/ui/collections/archived_collections_button_widget.dart

@@ -1,5 +1,3 @@
-// @dart=2.9
-
 import 'package:flutter/material.dart';
 import 'package:photos/core/configuration.dart';
 import 'package:photos/db/files_db.dart';
@@ -12,7 +10,7 @@ class ArchivedCollectionsButtonWidget extends StatelessWidget {
 
   const ArchivedCollectionsButtonWidget(
     this.textStyle, {
-    Key key,
+    Key? key,
   }) : super(key: key);
 
   @override
@@ -26,7 +24,7 @@ class ArchivedCollectionsButtonWidget extends StatelessWidget {
         padding: const EdgeInsets.all(0),
         side: BorderSide(
           width: 0.5,
-          color: Theme.of(context).iconTheme.color.withOpacity(0.24),
+          color: Theme.of(context).iconTheme.color!.withOpacity(0.24),
         ),
       ),
       child: SizedBox(
@@ -50,7 +48,7 @@ class ArchivedCollectionsButtonWidget extends StatelessWidget {
                       Configuration.instance.getUserID(),
                     ),
                     builder: (context, snapshot) {
-                      if (snapshot.hasData && snapshot.data > 0) {
+                      if (snapshot.hasData && snapshot.data! > 0) {
                         return RichText(
                           text: TextSpan(
                             style: textStyle,

+ 3 - 7
lib/ui/collections/create_new_album_widget.dart

@@ -1,5 +1,3 @@
-// @dart=2.9
-
 import 'package:flutter/material.dart';
 import 'package:fluttertoast/fluttertoast.dart';
 import 'package:photos/core/event_bus.dart';
@@ -7,9 +5,7 @@ import 'package:photos/events/tab_changed_event.dart';
 import 'package:photos/utils/toast_util.dart';
 
 class CreateNewAlbumWidget extends StatelessWidget {
-  const CreateNewAlbumWidget({
-    Key key,
-  }) : super(key: key);
+  const CreateNewAlbumWidget({Key? key}) : super(key: key);
 
   @override
   Widget build(BuildContext context) {
@@ -23,14 +19,14 @@ class CreateNewAlbumWidget extends StatelessWidget {
               blurRadius: 2,
               spreadRadius: 0,
               offset: const Offset(0, 0),
-              color: Theme.of(context).iconTheme.color.withOpacity(0.3),
+              color: Theme.of(context).iconTheme.color!.withOpacity(0.3),
             )
           ],
           borderRadius: BorderRadius.circular(4),
         ),
         child: Icon(
           Icons.add,
-          color: Theme.of(context).iconTheme.color.withOpacity(0.25),
+          color: Theme.of(context).iconTheme.color!.withOpacity(0.25),
         ),
       ),
       onTap: () async {

+ 3 - 5
lib/ui/collections/device_folder_icon_widget.dart

@@ -1,5 +1,3 @@
-// @dart=2.9
-
 import 'package:flutter/material.dart';
 import 'package:photos/ente_theme_data.dart';
 import 'package:photos/models/device_collection.dart';
@@ -12,7 +10,7 @@ class DeviceFolderIcon extends StatelessWidget {
   final DeviceCollection deviceCollection;
   const DeviceFolderIcon(
     this.deviceCollection, {
-    Key key,
+    Key? key,
   }) : super(key: key);
 
   @override
@@ -35,7 +33,7 @@ class DeviceFolderIcon extends StatelessWidget {
                   child: Hero(
                     tag: "device_folder:" +
                         deviceCollection.name +
-                        deviceCollection.thumbnail.tag,
+                        deviceCollection.thumbnail!.tag,
                     child: Stack(
                       children: [
                         ThumbnailWidget(
@@ -44,7 +42,7 @@ class DeviceFolderIcon extends StatelessWidget {
                           key: Key(
                             "device_folder:" +
                                 deviceCollection.name +
-                                deviceCollection.thumbnail.tag,
+                                deviceCollection.thumbnail!.tag,
                           ),
                         ),
                         isBackedUp ? Container() : const UnSyncedIcon(),

+ 5 - 7
lib/ui/collections/trash_button_widget.dart

@@ -1,5 +1,3 @@
-// @dart=2.9
-
 import 'dart:async';
 
 import 'package:flutter/material.dart';
@@ -12,7 +10,7 @@ import 'package:photos/utils/navigation_util.dart';
 class TrashButtonWidget extends StatefulWidget {
   const TrashButtonWidget(
     this.textStyle, {
-    Key key,
+    Key? key,
   }) : super(key: key);
 
   final TextStyle textStyle;
@@ -22,7 +20,7 @@ class TrashButtonWidget extends StatefulWidget {
 }
 
 class _TrashButtonWidgetState extends State<TrashButtonWidget> {
-  StreamSubscription<TrashUpdatedEvent> _trashUpdatedEventSubscription;
+  late StreamSubscription<TrashUpdatedEvent> _trashUpdatedEventSubscription;
 
   @override
   void initState() {
@@ -37,7 +35,7 @@ class _TrashButtonWidgetState extends State<TrashButtonWidget> {
 
   @override
   void dispose() {
-    _trashUpdatedEventSubscription?.cancel();
+    _trashUpdatedEventSubscription.cancel();
     super.dispose();
   }
 
@@ -52,7 +50,7 @@ class _TrashButtonWidgetState extends State<TrashButtonWidget> {
         padding: const EdgeInsets.all(0),
         side: BorderSide(
           width: 0.5,
-          color: Theme.of(context).iconTheme.color.withOpacity(0.24),
+          color: Theme.of(context).iconTheme.color!.withOpacity(0.24),
         ),
       ),
       child: SizedBox(
@@ -73,7 +71,7 @@ class _TrashButtonWidgetState extends State<TrashButtonWidget> {
                   FutureBuilder<int>(
                     future: TrashDB.instance.count(),
                     builder: (context, snapshot) {
-                      if (snapshot.hasData && snapshot.data > 0) {
+                      if (snapshot.hasData && snapshot.data! > 0) {
                         return RichText(
                           text: TextSpan(
                             style: widget.textStyle,

+ 4 - 6
lib/ui/home/grant_permissions_widget.dart

@@ -1,5 +1,3 @@
-// @dart=2.9
-
 import 'dart:io';
 
 import 'package:flutter/material.dart';
@@ -7,7 +5,7 @@ import 'package:photo_manager/photo_manager.dart';
 import 'package:photos/services/sync_service.dart';
 
 class GrantPermissionsWidget extends StatelessWidget {
-  const GrantPermissionsWidget({Key key}) : super(key: key);
+  const GrantPermissionsWidget({Key? key}) : super(key: key);
   @override
   Widget build(BuildContext context) {
     final isLightMode =
@@ -55,7 +53,7 @@ class GrantPermissionsWidget extends StatelessWidget {
                   text: TextSpan(
                     style: Theme.of(context)
                         .textTheme
-                        .headline5
+                        .headline5!
                         .copyWith(fontWeight: FontWeight.w700),
                     children: [
                       const TextSpan(text: 'ente '),
@@ -63,7 +61,7 @@ class GrantPermissionsWidget extends StatelessWidget {
                         text: "needs permission to ",
                         style: Theme.of(context)
                             .textTheme
-                            .headline5
+                            .headline5!
                             .copyWith(fontWeight: FontWeight.w400),
                       ),
                       const TextSpan(text: 'preserve your photos'),
@@ -109,7 +107,7 @@ class GrantPermissionsWidget extends StatelessWidget {
                   TextButton(
                     child: Text(
                       "OK",
-                      style: Theme.of(context).textTheme.subtitle1.copyWith(
+                      style: Theme.of(context).textTheme.subtitle1!.copyWith(
                             fontSize: 14,
                             fontWeight: FontWeight.w700,
                           ),

+ 2 - 4
lib/ui/huge_listview/place_holder_widget.dart

@@ -1,12 +1,10 @@
-// @dart=2.9
-
 import 'package:flutter/material.dart';
 
 class PlaceHolderWidget extends StatelessWidget {
   const PlaceHolderWidget(
     this.count,
     this.columns, {
-    Key key,
+    Key? key,
   }) : super(key: key);
 
   final int count, columns;
@@ -33,7 +31,7 @@ class PlaceHolderWidget extends StatelessWidget {
         ),
       );
     }
-    return _gridViewCache[key];
+    return _gridViewCache[key]!;
   }
 
   String _getCacheKey(int totalCount, int columns) {

+ 4 - 6
lib/ui/payment/child_subscription_widget.dart

@@ -1,5 +1,3 @@
-// @dart=2.9
-
 import 'package:flutter/material.dart';
 import 'package:photos/ente_theme_data.dart';
 import 'package:photos/models/user_details.dart';
@@ -10,15 +8,15 @@ import 'package:photos/utils/dialog_util.dart';
 
 class ChildSubscriptionWidget extends StatelessWidget {
   const ChildSubscriptionWidget({
-    Key key,
-    @required this.userDetails,
+    Key? key,
+    required this.userDetails,
   }) : super(key: key);
 
   final UserDetails userDetails;
 
   @override
   Widget build(BuildContext context) {
-    final String familyAdmin = userDetails.familyData.members
+    final String familyAdmin = userDetails.familyData!.members!
         .firstWhere((element) => element.isAdmin)
         .email;
     return Padding(
@@ -102,7 +100,7 @@ class ChildSubscriptionWidget extends StatelessWidget {
                     ),
                     TextSpan(
                       text: "support@ente.io",
-                      style: Theme.of(context).textTheme.bodyText2.copyWith(
+                      style: Theme.of(context).textTheme.bodyText2?.copyWith(
                             color: const Color.fromRGBO(29, 185, 84, 1),
                           ),
                     ),

+ 4 - 6
lib/ui/payment/skip_subscription_widget.dart

@@ -1,5 +1,3 @@
-// @dart=2.9
-
 import 'package:flutter/material.dart';
 import 'package:photos/core/event_bus.dart';
 import 'package:photos/events/subscription_purchased_event.dart';
@@ -10,8 +8,8 @@ import 'package:photos/ui/home_widget.dart';
 
 class SkipSubscriptionWidget extends StatelessWidget {
   const SkipSubscriptionWidget({
-    Key key,
-    @required this.freePlan,
+    Key? key,
+    required this.freePlan,
   }) : super(key: key);
 
   final FreePlan freePlan;
@@ -24,10 +22,10 @@ class SkipSubscriptionWidget extends StatelessWidget {
       margin: const EdgeInsets.fromLTRB(0, 30, 0, 0),
       padding: const EdgeInsets.fromLTRB(20, 0, 20, 0),
       child: OutlinedButton(
-        style: Theme.of(context).outlinedButtonTheme.style.copyWith(
+        style: Theme.of(context).outlinedButtonTheme.style?.copyWith(
           textStyle: MaterialStateProperty.resolveWith<TextStyle>(
             (Set<MaterialState> states) {
-              return Theme.of(context).textTheme.subtitle1;
+              return Theme.of(context).textTheme.subtitle1!;
             },
           ),
         ),

+ 1 - 3
lib/ui/payment/subscription.dart

@@ -1,5 +1,3 @@
-// @dart=2.9
-
 import 'package:flutter/cupertino.dart';
 import 'package:photos/core/configuration.dart';
 import 'package:photos/services/feature_flag_service.dart';
@@ -24,5 +22,5 @@ StatefulWidget getSubscriptionPage({bool isOnBoarding = false}) {
 // users who might have paid via playStore. This method should be removed once
 // we have better handling for active play/app store subscription & stripe plans.
 bool _isUserCreatedPostStripeSupport() {
-  return Configuration.instance.getUserID() > 1580559962386460;
+  return Configuration.instance.getUserID()! > 1580559962386460;
 }

+ 5 - 7
lib/ui/settings/about_section_widget.dart

@@ -1,5 +1,3 @@
-// @dart=2.9
-
 import 'package:flutter/material.dart';
 import 'package:photos/services/update_service.dart';
 import 'package:photos/theme/ente_theme.dart';
@@ -14,7 +12,7 @@ import 'package:photos/utils/toast_util.dart';
 import 'package:url_launcher/url_launcher.dart';
 
 class AboutSectionWidget extends StatelessWidget {
-  const AboutSectionWidget({Key key}) : super(key: key);
+  const AboutSectionWidget({Key? key}) : super(key: key);
 
   @override
   Widget build(BuildContext context) {
@@ -96,12 +94,12 @@ class AboutSectionWidget extends StatelessWidget {
 class AboutMenuItemWidget extends StatelessWidget {
   final String title;
   final String url;
-  final String webPageTitle;
+  final String? webPageTitle;
   const AboutMenuItemWidget({
-    @required this.title,
-    @required this.url,
+    required this.title,
+    required this.url,
     this.webPageTitle,
-    Key key,
+    Key? key,
   }) : super(key: key);
 
   @override

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

@@ -1,5 +1,3 @@
-// @dart=2.9
-
 import 'dart:async';
 
 import 'package:flutter/material.dart';
@@ -20,7 +18,7 @@ import 'package:photos/ui/settings/common_settings.dart';
 import 'package:photos/utils/navigation_util.dart';
 
 class AccountSectionWidget extends StatelessWidget {
-  const AccountSectionWidget({Key key}) : super(key: key);
+  const AccountSectionWidget({Key? key}) : super(key: key);
 
   @override
   Widget build(BuildContext context) {

+ 4 - 6
lib/ui/settings/app_version_widget.dart

@@ -1,11 +1,9 @@
-// @dart=2.9
-
 import 'package:flutter/material.dart';
 import 'package:package_info_plus/package_info_plus.dart';
 
 class AppVersionWidget extends StatefulWidget {
   const AppVersionWidget({
-    Key key,
+    Key? key,
   }) : super(key: key);
 
   @override
@@ -16,7 +14,7 @@ class _AppVersionWidgetState extends State<AppVersionWidget> {
   static const kTapThresholdForInspector = 5;
   static const kConsecutiveTapTimeWindowInMilliseconds = 2000;
 
-  int _lastTap;
+  int? _lastTap;
   int _consecutiveTaps = 0;
 
   @override
@@ -35,14 +33,14 @@ class _AppVersionWidgetState extends State<AppVersionWidget> {
         }
         _lastTap = now;
       },
-      child: FutureBuilder(
+      child: FutureBuilder<String>(
         future: _getAppVersion(),
         builder: (context, snapshot) {
           if (snapshot.hasData) {
             return Padding(
               padding: const EdgeInsets.all(20),
               child: Text(
-                "Version: " + snapshot.data,
+                "Version: " + snapshot.data!,
                 style: Theme.of(context).textTheme.caption,
               ),
             );

+ 3 - 5
lib/ui/settings/debug_section_widget.dart

@@ -1,5 +1,3 @@
-// @dart=2.9
-
 import 'package:flutter/material.dart';
 import 'package:flutter_sodium/flutter_sodium.dart';
 import 'package:photos/core/configuration.dart';
@@ -15,7 +13,7 @@ import 'package:photos/ui/settings/common_settings.dart';
 import 'package:photos/utils/toast_util.dart';
 
 class DebugSectionWidget extends StatelessWidget {
-  const DebugSectionWidget({Key key}) : super(key: key);
+  const DebugSectionWidget({Key? key}) : super(key: key);
 
   @override
   Widget build(BuildContext context) {
@@ -75,7 +73,7 @@ class DebugSectionWidget extends StatelessWidget {
   }
 
   void _showKeyAttributesDialog(BuildContext context) {
-    final keyAttributes = Configuration.instance.getKeyAttributes();
+    final keyAttributes = Configuration.instance.getKeyAttributes()!;
     final AlertDialog alert = AlertDialog(
       title: const Text("key attributes"),
       content: SingleChildScrollView(
@@ -85,7 +83,7 @@ class DebugSectionWidget extends StatelessWidget {
               "Key",
               style: TextStyle(fontWeight: FontWeight.bold),
             ),
-            Text(Sodium.bin2base64(Configuration.instance.getKey())),
+            Text(Sodium.bin2base64(Configuration.instance.getKey()!)),
             const Padding(padding: EdgeInsets.all(12)),
             const Text(
               "Encrypted Key",

+ 1 - 3
lib/ui/settings/general_section_widget.dart

@@ -1,5 +1,3 @@
-// @dart=2.9
-
 import 'package:flutter/material.dart';
 import 'package:photos/services/billing_service.dart';
 import 'package:photos/services/user_service.dart';
@@ -14,7 +12,7 @@ import 'package:photos/utils/dialog_util.dart';
 import 'package:photos/utils/navigation_util.dart';
 
 class GeneralSectionWidget extends StatelessWidget {
-  const GeneralSectionWidget({Key key}) : super(key: key);
+  const GeneralSectionWidget({Key? key}) : super(key: key);
 
   @override
   Widget build(BuildContext context) {

+ 3 - 4
lib/ui/settings/security_section_widget.dart

@@ -1,5 +1,3 @@
-// @dart=2.9
-
 import 'dart:async';
 import 'dart:io';
 
@@ -20,7 +18,7 @@ import 'package:photos/ui/components/toggle_switch_widget.dart';
 import 'package:photos/ui/settings/common_settings.dart';
 
 class SecuritySectionWidget extends StatefulWidget {
-  const SecuritySectionWidget({Key key}) : super(key: key);
+  const SecuritySectionWidget({Key? key}) : super(key: key);
 
   @override
   State<SecuritySectionWidget> createState() => _SecuritySectionWidgetState();
@@ -29,7 +27,8 @@ class SecuritySectionWidget extends StatefulWidget {
 class _SecuritySectionWidgetState extends State<SecuritySectionWidget> {
   final _config = Configuration.instance;
 
-  StreamSubscription<TwoFactorStatusChangeEvent> _twoFactorStatusChangeEvent;
+  late StreamSubscription<TwoFactorStatusChangeEvent>
+      _twoFactorStatusChangeEvent;
 
   @override
   void initState() {

+ 0 - 35
lib/ui/settings/settings_text_item.dart

@@ -1,35 +0,0 @@
-// @dart=2.9
-
-import 'dart:io';
-
-import 'package:flutter/material.dart';
-
-class SettingsTextItem extends StatelessWidget {
-  final String text;
-  final IconData icon;
-  const SettingsTextItem({
-    Key key,
-    @required this.text,
-    @required this.icon,
-  }) : super(key: key);
-
-  @override
-  Widget build(BuildContext context) {
-    return Column(
-      children: [
-        Padding(padding: EdgeInsets.all(Platform.isIOS ? 4 : 6)),
-        Row(
-          mainAxisAlignment: MainAxisAlignment.spaceBetween,
-          children: [
-            Align(
-              alignment: Alignment.centerLeft,
-              child: Text(text, style: Theme.of(context).textTheme.subtitle1),
-            ),
-            Icon(icon),
-          ],
-        ),
-        Padding(padding: EdgeInsets.all(Platform.isIOS ? 4 : 6)),
-      ],
-    );
-  }
-}

+ 2 - 4
lib/ui/settings/social_section_widget.dart

@@ -1,5 +1,3 @@
-// @dart=2.9
-
 import 'package:flutter/material.dart';
 import 'package:photos/services/update_service.dart';
 import 'package:photos/theme/ente_theme.dart';
@@ -10,7 +8,7 @@ import 'package:photos/ui/settings/common_settings.dart';
 import 'package:url_launcher/url_launcher_string.dart';
 
 class SocialSectionWidget extends StatelessWidget {
-  const SocialSectionWidget({Key key}) : super(key: key);
+  const SocialSectionWidget({Key? key}) : super(key: key);
 
   @override
   Widget build(BuildContext context) {
@@ -60,7 +58,7 @@ class SocialSectionWidget extends StatelessWidget {
 class SocialsMenuItemWidget extends StatelessWidget {
   final String text;
   final String urlSring;
-  const SocialsMenuItemWidget(this.text, this.urlSring, {Key key})
+  const SocialsMenuItemWidget(this.text, this.urlSring, {Key? key})
       : super(key: key);
 
   @override

+ 4 - 4
lib/ui/settings/support_section_widget.dart

@@ -1,5 +1,3 @@
-// @dart=2.9
-
 import 'dart:io';
 
 import 'package:flutter/material.dart';
@@ -15,7 +13,7 @@ import 'package:photos/ui/settings/common_settings.dart';
 import 'package:photos/utils/email_util.dart';
 
 class SupportSectionWidget extends StatelessWidget {
-  const SupportSectionWidget({Key key}) : super(key: key);
+  const SupportSectionWidget({Key? key}) : super(key: key);
 
   @override
   Widget build(BuildContext context) {
@@ -63,7 +61,9 @@ class SupportSectionWidget extends StatelessWidget {
                   final endpoint = Configuration.instance.getHttpEndpoint() +
                       "/users/roadmap";
                   final url = Configuration.instance.isLoggedIn()
-                      ? endpoint + "?token=" + Configuration.instance.getToken()
+                      ? endpoint +
+                          "?token=" +
+                          Configuration.instance.getToken()!
                       : roadmapURL;
                   return WebPage("Suggest features", url);
                 },

+ 9 - 11
lib/ui/sharing/share_collection_page.dart

@@ -1,5 +1,3 @@
-// @dart=2.9
-
 import 'package:collection/collection.dart';
 import 'package:fast_base58/fast_base58.dart';
 import 'package:flutter/material.dart';
@@ -25,14 +23,14 @@ import 'package:photos/utils/toast_util.dart';
 class ShareCollectionPage extends StatefulWidget {
   final Collection collection;
 
-  const ShareCollectionPage(this.collection, {Key key}) : super(key: key);
+  const ShareCollectionPage(this.collection, {Key? key}) : super(key: key);
 
   @override
   State<ShareCollectionPage> createState() => _ShareCollectionPageState();
 }
 
 class _ShareCollectionPageState extends State<ShareCollectionPage> {
-  List<User> _sharees;
+  late List<User?> _sharees;
   final Logger _logger = Logger("SharingDialogState");
   final CollectionActions collectionActions =
       CollectionActions(CollectionsService.instance);
@@ -132,7 +130,7 @@ class _ShareCollectionPageState extends State<ShareCollectionPage> {
           CollectionsService.instance.getCollectionKey(widget.collection.id),
         );
         final String url =
-            "${widget.collection.publicURLs.first.url}#$collectionKey";
+            "${widget.collection.publicURLs!.first!.url}#$collectionKey";
         children.addAll(
           [
             MenuItemWidget(
@@ -235,8 +233,8 @@ class _ShareCollectionPageState extends State<ShareCollectionPage> {
     return Scaffold(
       appBar: AppBar(
         title: Text(
-          widget.collection.name,
-          style: Theme.of(context).textTheme.headline5.copyWith(fontSize: 16),
+          widget.collection.name ?? "Unnamed",
+          style: Theme.of(context).textTheme.headline5?.copyWith(fontSize: 16),
         ),
         elevation: 0,
         centerTitle: false,
@@ -260,12 +258,12 @@ class _ShareCollectionPageState extends State<ShareCollectionPage> {
 
 class EmailItemWidget extends StatelessWidget {
   final Collection collection;
-  final Function onTap;
+  final Function? onTap;
 
   const EmailItemWidget(
     this.collection, {
     this.onTap,
-    Key key,
+    Key? key,
   }) : super(key: key);
 
   @override
@@ -291,7 +289,7 @@ class EmailItemWidget extends StatelessWidget {
             trailingIcon: Icons.chevron_right,
             onTap: () async {
               if (onTap != null) {
-                onTap();
+                onTap!();
               }
             },
             isBottomBorderRadiusRemoved: true,
@@ -317,7 +315,7 @@ class EmailItemWidget extends StatelessWidget {
             trailingIcon: Icons.chevron_right,
             onTap: () async {
               if (onTap != null) {
-                onTap();
+                onTap!();
               }
             },
             isBottomBorderRadiusRemoved: true,

+ 1 - 3
lib/ui/viewer/search/result/no_result_widget.dart

@@ -1,10 +1,8 @@
-// @dart=2.9
-
 import 'package:flutter/material.dart';
 import 'package:photos/ente_theme_data.dart';
 
 class NoResultWidget extends StatelessWidget {
-  const NoResultWidget({Key key}) : super(key: key);
+  const NoResultWidget({Key? key}) : super(key: key);
 
   @override
   Widget build(BuildContext context) {