Neeraj Gupta 3 anos atrás
pai
commit
d71c5237ec

+ 1 - 0
lib/core/error-reporting/tunneled_transport.dart

@@ -1,4 +1,5 @@
 import 'dart:convert';
+
 import 'package:http/http.dart';
 import 'package:sentry/sentry.dart';
 

+ 1 - 0
lib/ui/account/recovery_key_page.dart

@@ -1,4 +1,5 @@
 import 'dart:io' as io;
+
 import 'package:bip39/bip39.dart' as bip39;
 import 'package:dotted_border/dotted_border.dart';
 import 'package:flutter/material.dart';

+ 30 - 66
lib/ui/collections_gallery_widget.dart

@@ -33,8 +33,7 @@ class CollectionsGalleryWidget extends StatefulWidget {
   const CollectionsGalleryWidget({Key key}) : super(key: key);
 
   @override
-  _CollectionsGalleryWidgetState createState() =>
-      _CollectionsGalleryWidgetState();
+  _CollectionsGalleryWidgetState createState() => _CollectionsGalleryWidgetState();
 }
 
 class _CollectionsGalleryWidgetState extends State<CollectionsGalleryWidget>
@@ -49,13 +48,11 @@ class _CollectionsGalleryWidgetState extends State<CollectionsGalleryWidget>
 
   @override
   void initState() {
-    _localFilesSubscription =
-        Bus.instance.on<LocalPhotosUpdatedEvent>().listen((event) {
+    _localFilesSubscription = Bus.instance.on<LocalPhotosUpdatedEvent>().listen((event) {
       _loadReason = (LocalPhotosUpdatedEvent).toString();
       setState(() {});
     });
-    _collectionUpdatesSubscription =
-        Bus.instance.on<CollectionUpdatedEvent>().listen((event) {
+    _collectionUpdatesSubscription = Bus.instance.on<CollectionUpdatedEvent>().listen((event) {
       _loadReason = (CollectionUpdatedEvent).toString();
       setState(() {});
     });
@@ -63,8 +60,7 @@ class _CollectionsGalleryWidgetState extends State<CollectionsGalleryWidget>
       _loadReason = (UserLoggedOutEvent).toString();
       setState(() {});
     });
-    _backupFoldersUpdatedEvent =
-        Bus.instance.on<BackupFoldersUpdatedEvent>().listen((event) {
+    _backupFoldersUpdatedEvent = Bus.instance.on<BackupFoldersUpdatedEvent>().listen((event) {
       _loadReason = (BackupFoldersUpdatedEvent).toString();
       setState(() {});
     });
@@ -100,13 +96,11 @@ class _CollectionsGalleryWidgetState extends State<CollectionsGalleryWidget>
       folders.add(DeviceFolder(file.deviceFolder, file.deviceFolder, file));
     }
     folders.sort(
-      (first, second) =>
-          second.thumbnail.creationTime.compareTo(first.thumbnail.creationTime),
+      (first, second) => second.thumbnail.creationTime.compareTo(first.thumbnail.creationTime),
     );
 
     final List<CollectionWithThumbnail> collectionsWithThumbnail = [];
-    final latestCollectionFiles =
-        await collectionsService.getLatestCollectionFiles();
+    final latestCollectionFiles = await collectionsService.getLatestCollectionFiles();
     for (final file in latestCollectionFiles) {
       final c = collectionsService.getCollectionByID(file.collectionID);
       if (c.owner.id == userID) {
@@ -119,11 +113,9 @@ class _CollectionsGalleryWidgetState extends State<CollectionsGalleryWidget>
           // alphabetical ASC order
           return first.collection.name.compareTo(second.collection.name);
         } else if (sortKey == AlbumSortKey.newestPhoto) {
-          return second.thumbnail.creationTime
-              .compareTo(first.thumbnail.creationTime);
+          return second.thumbnail.creationTime.compareTo(first.thumbnail.creationTime);
         } else {
-          return second.collection.updationTime
-              .compareTo(first.collection.updationTime);
+          return second.collection.updationTime.compareTo(first.collection.updationTime);
         }
       },
     );
@@ -133,10 +125,7 @@ class _CollectionsGalleryWidgetState extends State<CollectionsGalleryWidget>
   Widget _getCollectionsGalleryWidget(CollectionItems items) {
     const double horizontalPaddingOfGridRow = 16;
     const double crossAxisSpacingOfGrid = 9;
-    final TextStyle trashAndHiddenTextStyle = Theme.of(context)
-        .textTheme
-        .subtitle1
-        .copyWith(
+    final TextStyle trashAndHiddenTextStyle = Theme.of(context).textTheme.subtitle1.copyWith(
           color: Theme.of(context).textTheme.subtitle1.color.withOpacity(0.5),
         );
     Size size = MediaQuery.of(context).size;
@@ -210,8 +199,7 @@ class _CollectionsGalleryWidgetState extends State<CollectionsGalleryWidget>
                         crossAxisCount: albumsCountInOneRow,
                         mainAxisSpacing: 12,
                         crossAxisSpacing: crossAxisSpacingOfGrid,
-                        childAspectRatio:
-                            sideOfThumbnail / (sideOfThumbnail + 24),
+                        childAspectRatio: sideOfThumbnail / (sideOfThumbnail + 24),
                       ), //24 is height of album title
                     ),
                   )
@@ -232,8 +220,7 @@ class _CollectionsGalleryWidgetState extends State<CollectionsGalleryWidget>
                       padding: 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(
@@ -261,9 +248,7 @@ class _CollectionsGalleryWidgetState extends State<CollectionsGalleryWidget>
                                           children: [
                                             TextSpan(
                                               text: "Trash",
-                                              style: Theme.of(context)
-                                                  .textTheme
-                                                  .subtitle1,
+                                              style: Theme.of(context).textTheme.subtitle1,
                                             ),
                                             TextSpan(text: "  \u2022  "),
                                             TextSpan(
@@ -280,9 +265,7 @@ class _CollectionsGalleryWidgetState extends State<CollectionsGalleryWidget>
                                           children: [
                                             TextSpan(
                                               text: "Trash",
-                                              style: Theme.of(context)
-                                                  .textTheme
-                                                  .subtitle1,
+                                              style: Theme.of(context).textTheme.subtitle1,
                                             ),
                                             //need to query in db and bring this value
                                           ],
@@ -318,8 +301,7 @@ class _CollectionsGalleryWidgetState extends State<CollectionsGalleryWidget>
                       padding: 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: Container(
@@ -338,8 +320,7 @@ class _CollectionsGalleryWidgetState extends State<CollectionsGalleryWidget>
                                 ),
                                 Padding(padding: EdgeInsets.all(6)),
                                 FutureBuilder<int>(
-                                  future:
-                                      FilesDB.instance.fileCountWithVisibility(
+                                  future: FilesDB.instance.fileCountWithVisibility(
                                     kVisibilityArchive,
                                     Configuration.instance.getUserID(),
                                   ),
@@ -351,9 +332,7 @@ class _CollectionsGalleryWidgetState extends State<CollectionsGalleryWidget>
                                           children: [
                                             TextSpan(
                                               text: "Hidden",
-                                              style: Theme.of(context)
-                                                  .textTheme
-                                                  .subtitle1,
+                                              style: Theme.of(context).textTheme.subtitle1,
                                             ),
                                             TextSpan(text: "  \u2022  "),
                                             TextSpan(
@@ -370,9 +349,7 @@ class _CollectionsGalleryWidgetState extends State<CollectionsGalleryWidget>
                                           children: [
                                             TextSpan(
                                               text: "Hidden",
-                                              style: Theme.of(context)
-                                                  .textTheme
-                                                  .subtitle1,
+                                              style: Theme.of(context).textTheme.subtitle1,
                                             ),
                                             //need to query in db and bring this value
                                           ],
@@ -511,8 +488,7 @@ class _CollectionsGalleryWidgetState extends State<CollectionsGalleryWidget>
             "long press to select photos and click + to create an album",
             toastLength: Toast.LENGTH_LONG,
           );
-          Bus.instance
-              .fire(TabChangedEvent(0, TabChangedEventSource.collections_page));
+          Bus.instance.fire(TabChangedEvent(0, TabChangedEventSource.collections_page));
         },
       );
     }
@@ -566,12 +542,11 @@ class DeviceFolderIcon extends StatelessWidget {
 
   @override
   Widget build(BuildContext context) {
-    final isBackedUp =
-        Configuration.instance.getPathsToBackUp().contains(folder.path);
+    final isBackedUp = Configuration.instance.getPathsToBackUp().contains(folder.path);
     return GestureDetector(
       child: Padding(
         padding: const EdgeInsets.symmetric(horizontal: 2),
-        child: Container(
+        child: SizedBox(
           height: 140,
           width: 120,
           // padding: const EdgeInsets.all(8.0),
@@ -581,17 +556,14 @@ class DeviceFolderIcon extends StatelessWidget {
                 borderRadius: BorderRadius.circular(4),
                 child: SizedBox(
                   child: Hero(
-                    tag:
-                        "device_folder:" + folder.path + folder.thumbnail.tag(),
+                    tag: "device_folder:" + folder.path + folder.thumbnail.tag(),
                     child: Stack(
                       children: [
                         ThumbnailWidget(
                           folder.thumbnail,
                           shouldShowSyncStatus: false,
                           key: Key(
-                            "device_folder:" +
-                                folder.path +
-                                folder.thumbnail.tag(),
+                            "device_folder:" + folder.path + folder.thumbnail.tag(),
                           ),
                         ),
                         isBackedUp ? Container() : kUnsyncedIconOverlay,
@@ -606,10 +578,7 @@ class DeviceFolderIcon extends StatelessWidget {
                 padding: const EdgeInsets.only(top: 10),
                 child: Text(
                   folder.name,
-                  style: Theme.of(context)
-                      .textTheme
-                      .subtitle1
-                      .copyWith(fontSize: 12),
+                  style: Theme.of(context).textTheme.subtitle1.copyWith(fontSize: 12),
                   overflow: TextOverflow.ellipsis,
                 ),
               ),
@@ -638,12 +607,11 @@ class CollectionItem extends StatelessWidget {
     const double crossAxisSpacingOfGrid = 9;
     Size size = MediaQuery.of(context).size;
     int albumsCountInOneRow = max(size.width ~/ 220.0, 2);
-    double totalWhiteSpaceOfRow = (horizontalPaddingOfGridRow * 2) +
-        (albumsCountInOneRow - 1) * crossAxisSpacingOfGrid;
-    TextStyle albumTitleTextStyle =
-        Theme.of(context).textTheme.subtitle1.copyWith(fontSize: 14);
-    final double sideOfThumbnail = (size.width / albumsCountInOneRow) -
-        (totalWhiteSpaceOfRow / albumsCountInOneRow);
+    double totalWhiteSpaceOfRow =
+        (horizontalPaddingOfGridRow * 2) + (albumsCountInOneRow - 1) * crossAxisSpacingOfGrid;
+    TextStyle albumTitleTextStyle = Theme.of(context).textTheme.subtitle1.copyWith(fontSize: 14);
+    final double sideOfThumbnail =
+        (size.width / albumsCountInOneRow) - (totalWhiteSpaceOfRow / albumsCountInOneRow);
     return GestureDetector(
       child: Column(
         crossAxisAlignment: CrossAxisAlignment.start,
@@ -729,8 +697,7 @@ class SectionTitle extends StatelessWidget {
             alignment: alignment,
             child: Text(
               title,
-              style:
-                  Theme.of(context).textTheme.headline6.copyWith(fontSize: 22),
+              style: Theme.of(context).textTheme.headline6.copyWith(fontSize: 22),
             ),
           ),
         ],
@@ -760,10 +727,7 @@ class EnteSectionTitle extends StatelessWidget {
                 children: [
                   TextSpan(
                     text: "On ",
-                    style: Theme.of(context)
-                        .textTheme
-                        .headline6
-                        .copyWith(fontSize: 22),
+                    style: Theme.of(context).textTheme.headline6.copyWith(fontSize: 22),
                   ),
                   TextSpan(
                     text: "ente",

+ 1 - 3
lib/ui/common/gradientButton.dart

@@ -1,13 +1,11 @@
 import 'package:flutter/material.dart';
-import 'package:flutter/widgets.dart';
 
 class GradientButton extends StatelessWidget {
   final Widget child;
   final List<Color> linearGradientColors;
   final Function onTap;
 
-  GradientButton({Key key, this.child, this.linearGradientColors, this.onTap})
-      : super(key: key);
+  GradientButton({Key key, this.child, this.linearGradientColors, this.onTap}) : super(key: key);
 
   @override
   Widget build(BuildContext context) {

+ 3 - 7
lib/ui/common/progress_dialog.dart

@@ -1,6 +1,4 @@
-import 'package:flutter/cupertino.dart';
 import 'package:flutter/material.dart';
-import 'package:flutter/painting.dart';
 
 enum ProgressDialogType { Normal, Download }
 
@@ -95,8 +93,7 @@ class ProgressDialog {
     _textAlign = textAlign ?? _textAlign;
     _progressWidget = child ?? _progressWidget;
     _dialogPadding = padding ?? _dialogPadding;
-    _progressWidgetAlignment =
-        progressWidgetAlignment ?? _progressWidgetAlignment;
+    _progressWidgetAlignment = progressWidgetAlignment ?? _progressWidgetAlignment;
   }
 
   void update({
@@ -145,7 +142,7 @@ class ProgressDialog {
   Future<bool> show() async {
     try {
       if (!_isShowing) {
-        _dialog = new _Body();
+        _dialog = _Body();
         showDialog<dynamic>(
           context: _context,
           barrierDismissible: _barrierDismissible,
@@ -160,8 +157,7 @@ class ProgressDialog {
                 insetAnimationDuration: Duration(milliseconds: 100),
                 elevation: _dialogElevation,
                 shape: RoundedRectangleBorder(
-                  borderRadius:
-                      BorderRadius.all(Radius.circular(_borderRadius)),
+                  borderRadius: BorderRadius.all(Radius.circular(_borderRadius)),
                 ),
                 child: _dialog,
               ),

+ 1 - 1
lib/ui/huge_listview/place_holder_widget.dart

@@ -8,7 +8,7 @@ class PlaceHolderWidget extends StatelessWidget {
 
   final int count;
 
-  static final _gridViewCache = Map<int, GridView>();
+  static final _gridViewCache = <int, GridView>{};
 
   @override
   Widget build(BuildContext context) {

+ 6 - 6
lib/ui/huge_listview/scroll_bar_thumb.dart

@@ -1,12 +1,12 @@
 import 'package:flutter/material.dart';
 
 class ScrollBarThumb extends StatelessWidget {
-  final backgroundColor;
-  final drawColor;
-  final height;
-  final title;
-  final labelAnimation;
-  final thumbAnimation;
+  final Color backgroundColor;
+  final Color drawColor;
+  final double height;
+  final String title;
+  final Animation labelAnimation;
+  final Animation thumbAnimation;
   final Function(DragStartDetails details) onDragStart;
   final Function(DragUpdateDetails details) onDragUpdate;
   final Function(DragEndDetails details) onDragEnd;

+ 4 - 10
lib/ui/payment/payment_web_page.dart

@@ -1,6 +1,5 @@
 import 'dart:io';
 
-import 'package:flutter/cupertino.dart';
 import 'package:flutter/foundation.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter_inappwebview/flutter_inappwebview.dart';
@@ -16,8 +15,7 @@ class PaymentWebPage extends StatefulWidget {
   final String planId;
   final String actionType;
 
-  const PaymentWebPage({Key key, this.planId, this.actionType})
-      : super(key: key);
+  const PaymentWebPage({Key key, this.planId, this.actionType}) : super(key: key);
 
   @override
   State<StatefulWidget> createState() => _PaymentWebPageState();
@@ -59,14 +57,11 @@ class _PaymentWebPageState extends State<PaymentWebPage> {
         ),
         body: Column(
           children: <Widget>[
-            (progress != 1.0)
-                ? LinearProgressIndicator(value: progress)
-                : Container(),
+            (progress != 1.0) ? LinearProgressIndicator(value: progress) : Container(),
             Expanded(
               child: InAppWebView(
                 initialUrlRequest: URLRequest(url: initPaymentUrl),
-                onProgressChanged:
-                    (InAppWebViewController controller, int progress) {
+                onProgressChanged: (InAppWebViewController controller, int progress) {
                   setState(() {
                     this.progress = progress / 100;
                   });
@@ -99,8 +94,7 @@ class _PaymentWebPageState extends State<PaymentWebPage> {
                     await _dialog.hide();
                   }
                 },
-                onLoadHttpError:
-                    (controller, navigationAction, code, msg) async {
+                onLoadHttpError: (controller, navigationAction, code, msg) async {
                   _logger.info("onHttpError with $code and msg = $msg");
                 },
                 onLoadStop: (controller, navigationAction) async {

+ 9 - 23
lib/ui/payment/stripe_subscription_page.dart

@@ -1,7 +1,6 @@
 import 'dart:async';
 
 import 'package:flutter/material.dart';
-import 'package:flutter/widgets.dart';
 import 'package:logging/logging.dart';
 import 'package:photos/ente_theme_data.dart';
 import 'package:photos/models/billing_plan.dart';
@@ -59,9 +58,7 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
   }
 
   Future<void> _fetchSub() async {
-    return _userService
-        .getUserDetailsV2(memoryCount: false)
-        .then((userDetails) async {
+    return _userService.getUserDetailsV2(memoryCount: false).then((userDetails) async {
       _userDetails = userDetails;
       _currentSubscription = userDetails.subscription;
       _showYearlyPlan = _currentSubscription.isYearlyPlan();
@@ -136,9 +133,7 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
                     currentStep: 4,
                     selectedColor: Theme.of(context).buttonColor,
                     roundedEdges: Radius.circular(10),
-                    unselectedColor: Theme.of(context)
-                        .colorScheme
-                        .stepProgressUnselectedColor,
+                    unselectedColor: Theme.of(context).colorScheme.stepProgressUnselectedColor,
                   ),
                 ),
               )
@@ -254,9 +249,8 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
                         color: Theme.of(context).colorScheme.onSurface,
                         fontFamily: 'Inter-Medium',
                         fontSize: 14,
-                        decoration: _isStripeSubscriber
-                            ? TextDecoration.underline
-                            : TextDecoration.none,
+                        decoration:
+                            _isStripeSubscriber ? TextDecoration.underline : TextDecoration.none,
                       ),
                     ),
                     textAlign: TextAlign.center,
@@ -353,17 +347,13 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
   }
 
   Widget _stripeRenewOrCancelButton() {
-    bool isRenewCancelled =
-        _currentSubscription.attributes?.isCancelled ?? false;
-    String title =
-        isRenewCancelled ? "Renew subscription" : "Cancel subscription";
+    bool isRenewCancelled = _currentSubscription.attributes?.isCancelled ?? false;
+    String title = isRenewCancelled ? "Renew subscription" : "Cancel subscription";
     return TextButton(
       child: Text(
         title,
         style: TextStyle(
-          color: (isRenewCancelled
-                  ? Colors.greenAccent
-                  : Theme.of(context).colorScheme.onSurface)
+          color: (isRenewCancelled ? Colors.greenAccent : Theme.of(context).colorScheme.onSurface)
               .withOpacity(isRenewCancelled ? 1.0 : 0.2),
         ),
       ),
@@ -420,8 +410,7 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
       if (productID == null || productID.isEmpty) {
         continue;
       }
-      final isActive =
-          _hasActiveSubscription && _currentSubscription.productID == productID;
+      final isActive = _hasActiveSubscription && _currentSubscription.productID == productID;
       if (isActive) {
         foundActivePlan = true;
       }
@@ -502,10 +491,7 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
         child: Text(
           title,
           style: TextStyle(
-            color: Theme.of(context)
-                .colorScheme
-                .onSurface
-                .withOpacity(reduceOpacity ? 0.5 : 1.0),
+            color: Theme.of(context).colorScheme.onSurface.withOpacity(reduceOpacity ? 0.5 : 1.0),
           ),
         ),
       );

+ 4 - 4
lib/ui/payment/subscription_common_widgets.dart

@@ -63,10 +63,8 @@ class _SubscriptionHeaderWidgetState extends State<SubscriptionHeaderWidget> {
                 ),
                 TextSpan(
                   text: formatBytes(widget.currentUsage),
-                  style: Theme.of(context)
-                      .textTheme
-                      .subtitle1
-                      .copyWith(fontWeight: FontWeight.bold),
+                  style:
+                      Theme.of(context).textTheme.subtitle1.copyWith(fontWeight: FontWeight.bold),
                 )
               ],
             ),
@@ -107,6 +105,8 @@ class ValidityWidget extends StatelessWidget {
 }
 
 class SubFaqWidget extends StatelessWidget {
+  const SubFaqWidget({Key key}) : super(key: key);
+
   @override
   Widget build(BuildContext context) {
     return Align(

+ 0 - 2
lib/ui/payment/subscription_page.dart

@@ -1,9 +1,7 @@
 import 'dart:async';
 import 'dart:io';
 
-import 'package:flutter/cupertino.dart';
 import 'package:flutter/material.dart';
-import 'package:flutter/widgets.dart';
 import 'package:in_app_purchase/in_app_purchase.dart';
 import 'package:logging/logging.dart';
 import 'package:photos/core/event_bus.dart';

+ 5 - 9
lib/ui/settings/app_update_dialog.dart

@@ -50,7 +50,7 @@ class _AppUpdateDialogState extends State<AppUpdateDialog> {
           children: changelog,
         ),
         Padding(padding: EdgeInsets.all(8)),
-        Container(
+        SizedBox(
           width: double.infinity,
           height: 64,
           child: OutlinedButton(
@@ -78,8 +78,7 @@ class _AppUpdateDialogState extends State<AppUpdateDialog> {
         ),
       ],
     );
-    final shouldForceUpdate =
-        UpdateService.instance.shouldForceUpdate(widget.latestVersionInfo);
+    final shouldForceUpdate = UpdateService.instance.shouldForceUpdate(widget.latestVersionInfo);
     return WillPopScope(
       onWillPop: () async => !shouldForceUpdate,
       child: AlertDialog(
@@ -108,10 +107,8 @@ class _ApkDownloaderDialogState extends State<ApkDownloaderDialog> {
   @override
   void initState() {
     super.initState();
-    _saveUrl = Configuration.instance.getTempDirectory() +
-        "ente-" +
-        widget.versionInfo.name +
-        ".apk";
+    _saveUrl =
+        Configuration.instance.getTempDirectory() + "ente-" + widget.versionInfo.name + ".apk";
     _downloadApk();
   }
 
@@ -129,8 +126,7 @@ class _ApkDownloaderDialogState extends State<ApkDownloaderDialog> {
         ),
         content: LinearProgressIndicator(
           value: _downloadProgress,
-          valueColor:
-              AlwaysStoppedAnimation<Color>(Theme.of(context).buttonColor),
+          valueColor: AlwaysStoppedAnimation<Color>(Theme.of(context).buttonColor),
         ),
       ),
     );

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

@@ -1,5 +1,4 @@
 import 'package:flutter/material.dart';
-import 'package:flutter/widgets.dart';
 import 'package:package_info_plus/package_info_plus.dart';
 import 'package:photos/core/network.dart';
 import 'package:photos/utils/dialog_util.dart';
@@ -30,8 +29,7 @@ class _AppVersionWidgetState extends State<AppVersionWidget> {
         if (now - (_lastTap ?? now) < kConsecutiveTapTimeWindowInMilliseconds) {
           _consecutiveTaps++;
           if (_consecutiveTaps == kTapThresholdForInspector) {
-            final dialog =
-                createProgressDialog(context, "Starting network inspector...");
+            final dialog = createProgressDialog(context, "Starting network inspector...");
             await dialog.show();
             await Future.delayed(
               Duration(milliseconds: kDummyDelayDurationInMilliseconds),

+ 7 - 8
lib/ui/tools/app_lock.dart

@@ -21,6 +21,9 @@ import 'package:flutter/material.dart';
 /// [backgroundLockLatency] determines how much time is allowed to pass when
 /// the app is in the background state before the [lockScreen] widget should be
 /// shown upon returning. It defaults to instantly.
+///
+
+// ignore_for_file: unnecessary_this
 class AppLock extends StatefulWidget {
   final Widget Function(Object) builder;
   final Widget lockScreen;
@@ -39,8 +42,7 @@ class AppLock extends StatefulWidget {
     this.lightTheme,
   }) : super(key: key);
 
-  static _AppLockState of(BuildContext context) =>
-      context.findAncestorStateOfType<_AppLockState>();
+  static _AppLockState of(BuildContext context) => context.findAncestorStateOfType<_AppLockState>();
 
   @override
   _AppLockState createState() => _AppLockState();
@@ -72,8 +74,7 @@ class _AppLockState extends State<AppLock> with WidgetsBindingObserver {
       return;
     }
 
-    if (state == AppLifecycleState.paused &&
-        (!this._isLocked && this._didUnlockForAppLaunch)) {
+    if (state == AppLifecycleState.paused && (!this._isLocked && this._didUnlockForAppLaunch)) {
       this._backgroundLockLatencyTimer =
           Timer(this.widget.backgroundLockLatency, () => this.showLockScreen());
     }
@@ -110,8 +111,7 @@ class _AppLockState extends State<AppLock> with WidgetsBindingObserver {
             );
           case '/unlocked':
             return PageRouteBuilder(
-              pageBuilder: (_, __, ___) =>
-                  this.widget.builder(settings.arguments),
+              pageBuilder: (_, __, ___) => this.widget.builder(settings.arguments),
             );
         }
         return PageRouteBuilder(pageBuilder: (_, __, ___) => this._lockScreen);
@@ -178,8 +178,7 @@ class _AppLockState extends State<AppLock> with WidgetsBindingObserver {
 
   void _didUnlockOnAppLaunch(Object args) {
     this._didUnlockForAppLaunch = true;
-    _navigatorKey.currentState
-        .pushReplacementNamed('/unlocked', arguments: args);
+    _navigatorKey.currentState.pushReplacementNamed('/unlocked', arguments: args);
   }
 
   void _didUnlockOnAppPaused() {

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

@@ -1,5 +1,4 @@
 import 'package:flutter/material.dart';
-import 'package:flutter/widgets.dart';
 
 class CustomAppBar extends PreferredSize {
   final Widget child;

+ 0 - 1
lib/ui/viewer/file/exif_info_dialog.dart

@@ -1,7 +1,6 @@
 import 'dart:ui';
 
 import 'package:flutter/material.dart';
-import 'package:flutter/widgets.dart';
 import 'package:photos/models/file.dart';
 import 'package:photos/ui/common/loading_widget.dart';
 import 'package:photos/utils/exif_util.dart';

+ 0 - 1
lib/ui/viewer/file/file_widget.dart

@@ -1,5 +1,4 @@
 import 'package:flutter/material.dart';
-import 'package:flutter/widgets.dart';
 import 'package:logging/logging.dart';
 import 'package:photos/models/file.dart';
 import 'package:photos/models/file_type.dart';

+ 1 - 3
lib/ui/viewer/file/video_widget.dart

@@ -3,7 +3,6 @@ import 'dart:io' as io;
 import 'package:chewie/chewie.dart';
 import 'package:flutter/cupertino.dart';
 import 'package:flutter/material.dart';
-import 'package:flutter/widgets.dart';
 import 'package:logging/logging.dart';
 import 'package:photos/core/constants.dart';
 import 'package:photos/models/file.dart';
@@ -115,8 +114,7 @@ class _VideoWidgetState extends State<VideoWidget> {
 
   @override
   Widget build(BuildContext context) {
-    final content = _videoPlayerController != null &&
-            _videoPlayerController.value.isInitialized
+    final content = _videoPlayerController != null && _videoPlayerController.value.isInitialized
         ? _getVideoPlayer()
         : _getLoadingWidget();
     final contentWithDetector = GestureDetector(

+ 5 - 13
lib/ui/viewer/file/zoomable_image.dart

@@ -1,4 +1,3 @@
-import 'package:flutter/foundation.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter/widgets.dart';
 import 'package:logging/logging.dart';
@@ -32,8 +31,7 @@ class ZoomableImage extends StatefulWidget {
   _ZoomableImageState createState() => _ZoomableImageState();
 }
 
-class _ZoomableImageState extends State<ZoomableImage>
-    with SingleTickerProviderStateMixin {
+class _ZoomableImageState extends State<ZoomableImage> with SingleTickerProviderStateMixin {
   final Logger _logger = Logger("ZoomableImage");
   File _photo;
   ImageProvider _imageProvider;
@@ -90,8 +88,7 @@ class _ZoomableImageState extends State<ZoomableImage>
     GestureDragUpdateCallback verticalDragCallback = _isZooming
         ? null
         : (d) => {
-              if (!_isZooming && d.delta.dy > kDragSensitivity)
-                {Navigator.of(context).pop()}
+              if (!_isZooming && d.delta.dy > kDragSensitivity) {Navigator.of(context).pop()}
             };
     return GestureDetector(
       child: content,
@@ -137,20 +134,15 @@ class _ZoomableImageState extends State<ZoomableImage>
   }
 
   void _loadLocalImage(BuildContext context) {
-    if (!_loadedSmallThumbnail &&
-        !_loadedLargeThumbnail &&
-        !_loadedFinalImage) {
-      final cachedThumbnail =
-          ThumbnailLruCache.get(_photo, kThumbnailSmallSize);
+    if (!_loadedSmallThumbnail && !_loadedLargeThumbnail && !_loadedFinalImage) {
+      final cachedThumbnail = ThumbnailLruCache.get(_photo, kThumbnailSmallSize);
       if (cachedThumbnail != null) {
         _imageProvider = Image.memory(cachedThumbnail).image;
         _loadedSmallThumbnail = true;
       }
     }
 
-    if (!_loadingLargeThumbnail &&
-        !_loadedLargeThumbnail &&
-        !_loadedFinalImage) {
+    if (!_loadingLargeThumbnail && !_loadedLargeThumbnail && !_loadedFinalImage) {
       _loadingLargeThumbnail = true;
       getThumbnailFromLocal(_photo, size: kThumbnailLargeSize, quality: 100)
           .then((cachedThumbnail) {

+ 4 - 9
lib/ui/viewer/file/zoomable_live_image.dart

@@ -1,9 +1,7 @@
 import 'dart:io' as io;
 
 import 'package:chewie/chewie.dart';
-import 'package:flutter/foundation.dart';
 import 'package:flutter/material.dart';
-import 'package:flutter/widgets.dart';
 import 'package:fluttertoast/fluttertoast.dart';
 import 'package:logging/logging.dart';
 import 'package:photos/core/constants.dart';
@@ -32,8 +30,7 @@ class ZoomableLiveImage extends StatefulWidget {
   _ZoomableLiveImageState createState() => _ZoomableLiveImageState();
 }
 
-class _ZoomableLiveImageState extends State<ZoomableLiveImage>
-    with SingleTickerProviderStateMixin {
+class _ZoomableLiveImageState extends State<ZoomableLiveImage> with SingleTickerProviderStateMixin {
   final Logger _logger = Logger("ZoomableLiveImage");
   File _file;
   bool _showVideo = false;
@@ -125,15 +122,13 @@ class _ZoomableLiveImageState extends State<ZoomableLiveImage>
       showToast(context, "Downloading...", toastLength: Toast.LENGTH_LONG);
     }
 
-    var videoFile = await getFile(widget.file, liveVideo: true)
-        .timeout(Duration(seconds: 15))
-        .onError((e, s) {
+    var videoFile =
+        await getFile(widget.file, liveVideo: true).timeout(Duration(seconds: 15)).onError((e, s) {
       _logger.info("getFile failed ${_file.tag()}", e);
       return null;
     });
 
-    if ((videoFile == null || !videoFile.existsSync()) &&
-        _file.isRemoteFile()) {
+    if ((videoFile == null || !videoFile.existsSync()) && _file.isRemoteFile()) {
       videoFile = await getFileFromServer(widget.file, liveVideo: true)
           .timeout(Duration(seconds: 15))
           .onError((e, s) {

+ 6 - 11
lib/ui/viewer/gallery/gallery.dart

@@ -1,6 +1,5 @@
 import 'dart:async';
 
-import 'package:flutter/cupertino.dart';
 import 'package:flutter/material.dart';
 import 'package:logging/logging.dart';
 import 'package:photos/core/constants.dart';
@@ -18,8 +17,8 @@ import 'package:photos/ui/viewer/gallery/empte_state.dart';
 import 'package:photos/utils/date_time_util.dart';
 import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
 
-typedef GalleryLoader = Future<FileLoadResult>
-    Function(int creationStartTime, int creationEndTime, {int limit, bool asc});
+typedef GalleryLoader = Future<FileLoadResult> Function(int creationStartTime, int creationEndTime,
+    {int limit, bool asc});
 
 class Gallery extends StatefulWidget {
   final GalleryLoader asyncLoader;
@@ -136,8 +135,7 @@ class _GalleryState extends State<Gallery> {
   // Collates files and returns `true` if it resulted in a gallery reload
   bool _onFilesLoaded(List<File> files) {
     final collatedFiles = _collateFiles(files);
-    if (_collatedFiles.length != collatedFiles.length ||
-        _collatedFiles.isEmpty) {
+    if (_collatedFiles.length != collatedFiles.length || _collatedFiles.isEmpty) {
       if (mounted) {
         setState(() {
           _hasLoadedFiles = true;
@@ -228,12 +226,10 @@ class _GalleryState extends State<Gallery> {
           ),
         );
       },
-      thumbBackgroundColor:
-          Theme.of(context).colorScheme.galleryThumbBackgroundColor,
+      thumbBackgroundColor: Theme.of(context).colorScheme.galleryThumbBackgroundColor,
       thumbDrawColor: Theme.of(context).colorScheme.galleryThumbDrawColor,
       firstShown: (int firstIndex) {
-        Bus.instance
-            .fire(GalleryIndexUpdatedEvent(widget.tagPrefix, firstIndex));
+        Bus.instance.fire(GalleryIndexUpdatedEvent(widget.tagPrefix, firstIndex));
       },
     );
   }
@@ -257,8 +253,7 @@ class _GalleryState extends State<Gallery> {
     if (dailyFiles.isNotEmpty) {
       collatedFiles.add(dailyFiles);
     }
-    collatedFiles
-        .sort((a, b) => b[0].creationTime.compareTo(a[0].creationTime));
+    collatedFiles.sort((a, b) => b[0].creationTime.compareTo(a[0].creationTime));
     return collatedFiles;
   }
 

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

@@ -1,6 +1,5 @@
 import 'package:dio/dio.dart';
 import 'package:flutter/material.dart';
-import 'package:flutter/widgets.dart';
 import 'package:flutter_typeahead/flutter_typeahead.dart';
 import 'package:photos/core/configuration.dart';
 import 'package:photos/core/network.dart';

+ 1 - 1
lib/utils/hex.dart

@@ -30,7 +30,7 @@ class HexEncoder extends Converter<List<int>, String> {
     StringBuffer buffer = new StringBuffer();
     for (int part in bytes) {
       if (part & 0xff != part) {
-        throw new FormatException("Non-byte integer detected");
+        throw FormatException("Non-byte integer detected");
       }
       buffer.write('${part < 16 ? '0' : ''}${part.toRadixString(16)}');
     }