瀏覽代碼

Lint fixes

Neeraj Gupta 3 年之前
父節點
當前提交
5bcb53bee4

+ 2 - 2
lib/ente_theme_data.dart

@@ -15,7 +15,6 @@ final lightThemeData = ThemeData(
     secondary: Color.fromARGB(255, 163, 163, 163),
   ),
   accentColor: const Color.fromRGBO(0, 0, 0, 0.6),
-  buttonColor: const Color.fromRGBO(45, 194, 98, 1.0),
   outlinedButtonTheme: buildOutlinedButtonThemeData(
     bgDisabled: Colors.grey.shade500,
     bgEnabled: Colors.black,
@@ -92,7 +91,6 @@ final darkThemeData = ThemeData(
   hintColor: Colors.grey,
   colorScheme: const ColorScheme.dark(primary: Colors.white),
   accentColor: const Color.fromRGBO(45, 194, 98, 0.2),
-  buttonColor: const Color.fromRGBO(45, 194, 98, 1.0),
   buttonTheme: const ButtonThemeData().copyWith(
     buttonColor: const Color.fromRGBO(45, 194, 98, 1.0),
   ),
@@ -242,6 +240,8 @@ extension CustomColorScheme on ColorScheme {
       ? const Color.fromRGBO(240, 240, 240, 1)
       : const Color.fromRGBO(8, 18, 18, 0.4);
 
+  Color get greenAlternative => const Color.fromRGBO(45, 194, 98, 1.0);
+
   Color get dynamicFABBackgroundColor =>
       brightness == Brightness.light ? Colors.black : Colors.grey[850];
 

+ 1 - 1
lib/ui/account/email_entry_page.dart

@@ -91,7 +91,7 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
         child: StepProgressIndicator(
           totalSteps: 4,
           currentStep: 1,
-          selectedColor: Theme.of(context).buttonColor,
+          selectedColor: Theme.of(context).colorScheme.greenAlternative,
           roundedEdges: const Radius.circular(10),
           unselectedColor:
               Theme.of(context).colorScheme.stepProgressUnselectedColor,

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

@@ -52,7 +52,7 @@ class _OTTVerificationPageState extends State<OTTVerificationPage> {
                 child: StepProgressIndicator(
                   totalSteps: 4,
                   currentStep: 2,
-                  selectedColor: Theme.of(context).buttonColor,
+                  selectedColor: Theme.of(context).colorScheme.greenAlternative,
                   roundedEdges: const Radius.circular(10),
                   unselectedColor:
                       Theme.of(context).colorScheme.stepProgressUnselectedColor,
@@ -119,7 +119,9 @@ class _OTTVerificationPageState extends State<OTTVerificationPage> {
                                 TextSpan(
                                   text: widget.email,
                                   style: TextStyle(
-                                    color: Theme.of(context).buttonColor,
+                                    color: Theme.of(context)
+                                        .colorScheme
+                                        .greenAlternative,
                                   ),
                                 )
                               ],

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

@@ -64,7 +64,7 @@ class _RecoveryKeyPageState extends State<RecoveryKeyPage> {
                 child: StepProgressIndicator(
                   totalSteps: 4,
                   currentStep: 3,
-                  selectedColor: Theme.of(context).buttonColor,
+                  selectedColor: Theme.of(context).colorScheme.greenAlternative,
                   roundedEdges: const Radius.circular(10),
                   unselectedColor:
                       Theme.of(context).colorScheme.stepProgressUnselectedColor,

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

@@ -188,7 +188,7 @@ class _SessionsPageState extends State<SessionsPage> {
             "Cancel",
             style: TextStyle(
               color: isLoggingOutFromThisDevice
-                  ? Theme.of(context).buttonColor
+                  ? Theme.of(context).colorScheme.greenAlternative
                   : Theme.of(context).colorScheme.defaultTextColor,
             ),
           ),
@@ -213,7 +213,7 @@ class _SessionsPageState extends State<SessionsPage> {
         "This device",
         style: TextStyle(
           fontWeight: FontWeight.bold,
-          color: Theme.of(context).buttonColor,
+          color: Theme.of(context).colorScheme.greenAlternative,
         ),
       );
     }

+ 2 - 1
lib/ui/account/two_factor_setup_page.dart

@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
 import 'package:flutter/services.dart';
 import 'package:flutter_sodium/flutter_sodium.dart';
 import 'package:photos/core/configuration.dart';
+import 'package:photos/ente_theme_data.dart';
 import 'package:photos/services/user_service.dart';
 import 'package:photos/ui/account/recovery_key_page.dart';
 import 'package:photos/ui/lifecycle_event_handler.dart';
@@ -87,7 +88,7 @@ class _TwoFactorSetupPageState extends State<TwoFactorSetupPage>
               child: Column(
                 children: [
                   TabBar(
-                    labelColor: Theme.of(context).buttonColor,
+                    labelColor: Theme.of(context).colorScheme.greenAlternative,
                     unselectedLabelColor: Colors.grey,
                     tabs: const [
                       Tab(

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

@@ -1,4 +1,5 @@
 import 'package:flutter/material.dart';
+import 'package:photos/ente_theme_data.dart';
 
 enum DialogUserChoice { firstChoice, secondChoice }
 
@@ -53,7 +54,8 @@ Future<DialogUserChoice> showChoiceDialog<T>(
         child: Text(
           secondAction,
           style: TextStyle(
-            color: secondActionColor ?? Theme.of(context).buttonColor,
+            color: secondActionColor ??
+                Theme.of(context).colorScheme.greenAlternative,
           ),
         ),
         onPressed: () {

+ 4 - 2
lib/ui/common/linear_progress_dialog.dart

@@ -1,4 +1,5 @@
 import 'package:flutter/material.dart';
+import 'package:photos/ente_theme_data.dart';
 
 class LinearProgressDialog extends StatefulWidget {
   final String message;
@@ -38,8 +39,9 @@ class LinearProgressDialogState extends State<LinearProgressDialog> {
         ),
         content: LinearProgressIndicator(
           value: _progress,
-          valueColor:
-              AlwaysStoppedAnimation<Color>(Theme.of(context).buttonColor),
+          valueColor: AlwaysStoppedAnimation<Color>(
+            Theme.of(context).colorScheme.greenAlternative,
+          ),
         ),
       ),
     );

+ 1 - 1
lib/ui/common/progress_dialog.dart

@@ -55,7 +55,7 @@ class ProgressDialog {
     _progressDialogType = type ?? ProgressDialogType.normal;
     _barrierDismissible = isDismissible ?? true;
     _showLogs = showLogs ?? false;
-    _customBody = customBody ?? null;
+    _customBody = customBody;
     _direction = textDirection ?? TextDirection.ltr;
     _barrierColor = barrierColor ?? barrierColor;
   }

+ 2 - 1
lib/ui/create_collection_page.dart

@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
 import 'package:logging/logging.dart';
 import 'package:photos/core/configuration.dart';
 import 'package:photos/db/files_db.dart';
+import 'package:photos/ente_theme_data.dart';
 import 'package:photos/models/collection.dart';
 import 'package:photos/models/collection_items.dart';
 import 'package:photos/models/file.dart';
@@ -222,7 +223,7 @@ class _CreateCollectionPageState extends State<CreateCollectionPage> {
           child: Text(
             "Ok",
             style: TextStyle(
-              color: Theme.of(context).buttonColor,
+              color: Theme.of(context).colorScheme.greenAlternative,
             ),
           ),
           onPressed: () async {

+ 1 - 1
lib/ui/home_widget.dart

@@ -131,7 +131,7 @@ class _HomeWidgetState extends State<HomeWidget> {
             child: Text(
               "Ok",
               style: TextStyle(
-                color: Theme.of(context).buttonColor,
+                color: Theme.of(context).colorScheme.greenAlternative,
               ),
             ),
             onPressed: () async {

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

@@ -132,7 +132,7 @@ class DraggableScrollbarState extends State<DraggableScrollbar>
           widget.backgroundColor,
           widget.drawColor,
           widget.heightScrollThumb,
-          widget.labelTextBuilder.call(this.currentFirstIndex),
+          widget.labelTextBuilder.call(currentFirstIndex),
           _labelAnimation,
           _thumbAnimation,
           onDragStart,

+ 2 - 1
lib/ui/memories_widget.dart

@@ -1,4 +1,5 @@
 import 'package:flutter/material.dart';
+import 'package:photos/ente_theme_data.dart';
 import 'package:photos/models/memory.dart';
 import 'package:photos/services/memories_service.dart';
 import 'package:photos/ui/extents_page_view.dart';
@@ -137,7 +138,7 @@ class _MemoryWidgetState extends State<MemoryWidget> {
         border: isSeen
             ? const Border()
             : Border.all(
-                color: Theme.of(context).buttonColor,
+                color: Theme.of(context).colorScheme.greenAlternative,
                 width: isSeen ? 0 : 2,
               ),
         borderRadius: BorderRadius.circular(40),

+ 2 - 1
lib/ui/payment/billing_questions_widget.dart

@@ -3,6 +3,7 @@ import 'dart:convert';
 import 'package:expansion_tile_card/expansion_tile_card.dart';
 import 'package:flutter/material.dart';
 import 'package:photos/core/network.dart';
+import 'package:photos/ente_theme_data.dart';
 import 'package:photos/ui/common/loading_widget.dart';
 
 class BillingQuestionsWidget extends StatelessWidget {
@@ -74,7 +75,7 @@ class FaqWidget extends StatelessWidget {
       child: ExpansionTileCard(
         elevation: 0,
         title: Text(faq.q),
-        expandedTextColor: Theme.of(context).buttonColor,
+        expandedTextColor: Theme.of(context).colorScheme.greenAlternative,
         baseColor: Theme.of(context).cardColor,
         children: [
           Padding(

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

@@ -1,4 +1,5 @@
 import 'package:flutter/material.dart';
+import 'package:photos/ente_theme_data.dart';
 import 'package:photos/models/user_details.dart';
 import 'package:photos/services/user_service.dart';
 import 'package:photos/ui/common/dialogs.dart';
@@ -123,7 +124,7 @@ class ChildSubscriptionWidget extends StatelessWidget {
       'Are you sure that you want to leave the family plan?',
       firstAction: 'No',
       secondAction: 'Yes',
-      firstActionColor: Theme.of(context).buttonColor,
+      firstActionColor: Theme.of(context).colorScheme.greenAlternative,
       secondActionColor: Theme.of(context).colorScheme.onSurface,
     );
     if (choice != DialogUserChoice.secondChoice) {

+ 5 - 2
lib/ui/payment/payment_web_page.dart

@@ -4,6 +4,7 @@ import 'package:flutter/foundation.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter_inappwebview/flutter_inappwebview.dart';
 import 'package:logging/logging.dart';
+import 'package:photos/ente_theme_data.dart';
 import 'package:photos/models/subscription.dart';
 import 'package:photos/services/billing_service.dart';
 import 'package:photos/services/user_service.dart';
@@ -157,7 +158,7 @@ class _PaymentWebPageState extends State<PaymentWebPage> {
             child: Text(
               'No',
               style: TextStyle(
-                color: Theme.of(context).buttonColor,
+                color: Theme.of(context).colorScheme.greenAlternative,
               ),
             ),
             onPressed: () => Navigator.of(context).pop(false),
@@ -248,7 +249,9 @@ class _PaymentWebPageState extends State<PaymentWebPage> {
           TextButton(
             child: Text(
               'Ok',
-              style: TextStyle(color: Theme.of(context).buttonColor),
+              style: TextStyle(
+                color: Theme.of(context).colorScheme.greenAlternative,
+              ),
             ),
             onPressed: () {
               Navigator.of(context).pop('dialog');

+ 2 - 1
lib/ui/payment/stripe_subscription_page.dart

@@ -133,7 +133,8 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
                   child: StepProgressIndicator(
                     totalSteps: 4,
                     currentStep: 4,
-                    selectedColor: Theme.of(context).buttonColor,
+                    selectedColor:
+                        Theme.of(context).colorScheme.greenAlternative,
                     roundedEdges: const Radius.circular(10),
                     unselectedColor: Theme.of(context)
                         .colorScheme

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

@@ -3,6 +3,7 @@ import 'package:logging/logging.dart';
 import 'package:open_file/open_file.dart';
 import 'package:photos/core/configuration.dart';
 import 'package:photos/core/network.dart';
+import 'package:photos/ente_theme_data.dart';
 import 'package:photos/services/update_service.dart';
 
 class AppUpdateDialog extends StatefulWidget {
@@ -129,8 +130,9 @@ class _ApkDownloaderDialogState extends State<ApkDownloaderDialog> {
         ),
         content: LinearProgressIndicator(
           value: _downloadProgress,
-          valueColor:
-              AlwaysStoppedAnimation<Color>(Theme.of(context).buttonColor),
+          valueColor: AlwaysStoppedAnimation<Color>(
+            Theme.of(context).colorScheme.greenAlternative,
+          ),
         ),
       ),
     );
@@ -171,7 +173,7 @@ class _ApkDownloaderDialogState extends State<ApkDownloaderDialog> {
             child: Text(
               "Retry",
               style: TextStyle(
-                color: Theme.of(context).buttonColor,
+                color: Theme.of(context).colorScheme.greenAlternative,
               ),
             ),
             onPressed: () {

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

@@ -3,6 +3,7 @@ import 'dart:io';
 import 'package:expandable/expandable.dart';
 import 'package:flutter/material.dart';
 import 'package:photos/core/configuration.dart';
+import 'package:photos/ente_theme_data.dart';
 import 'package:photos/models/backup_status.dart';
 import 'package:photos/models/duplicate_files.dart';
 import 'package:photos/services/deduplication_service.dart';
@@ -222,7 +223,7 @@ class BackupSectionWidgetState extends State<BackupSectionWidget> {
           child: Text(
             "Rate us",
             style: TextStyle(
-              color: Theme.of(context).buttonColor,
+              color: Theme.of(context).colorScheme.greenAlternative,
             ),
           ),
           onPressed: () {
@@ -284,7 +285,7 @@ class BackupSectionWidgetState extends State<BackupSectionWidget> {
           child: Text(
             "Rate us",
             style: TextStyle(
-              color: Theme.of(context).buttonColor,
+              color: Theme.of(context).colorScheme.greenAlternative,
             ),
           ),
           onPressed: () {

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

@@ -1,5 +1,6 @@
 import 'package:expandable/expandable.dart';
 import 'package:flutter/material.dart';
+import 'package:photos/ente_theme_data.dart';
 import 'package:photos/services/user_service.dart';
 import 'package:photos/ui/account/delete_account_page.dart';
 import 'package:photos/ui/settings/common_settings.dart';
@@ -77,7 +78,7 @@ class _DangerSectionWidgetState extends State<DangerSectionWidget> {
           child: Text(
             "No",
             style: TextStyle(
-              color: Theme.of(context).buttonColor,
+              color: Theme.of(context).colorScheme.greenAlternative,
             ),
           ),
           onPressed: () {

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

@@ -288,7 +288,7 @@ class _SecuritySectionWidgetState extends State<SecuritySectionWidget> {
           child: Text(
             "No",
             style: TextStyle(
-              color: Theme.of(context).buttonColor,
+              color: Theme.of(context).colorScheme.greenAlternative,
             ),
           ),
           onPressed: () {

+ 4 - 6
lib/ui/sharing/manage_links_widget.dart

@@ -346,7 +346,7 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
     return showDialog<String>(
       context: context,
       builder: (context) {
-        bool _passwordVisible = false;
+        bool passwordVisible = false;
         return StatefulBuilder(
           builder: (context, setState) {
             return AlertDialog(
@@ -358,19 +358,17 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
                   contentPadding: const EdgeInsets.all(12),
                   suffixIcon: IconButton(
                     icon: Icon(
-                      _passwordVisible
-                          ? Icons.visibility
-                          : Icons.visibility_off,
+                      passwordVisible ? Icons.visibility : Icons.visibility_off,
                       color: Colors.white.withOpacity(0.5),
                       size: 20,
                     ),
                     onPressed: () {
-                      _passwordVisible = !_passwordVisible;
+                      passwordVisible = !passwordVisible;
                       setState(() {});
                     },
                   ),
                 ),
-                obscureText: !_passwordVisible,
+                obscureText: !passwordVisible,
                 controller: _textFieldController,
                 autofocus: true,
                 autocorrect: false,

+ 7 - 5
lib/ui/sharing/share_collection_widget.dart

@@ -9,6 +9,7 @@ import 'package:logging/logging.dart';
 import 'package:photos/core/configuration.dart';
 import 'package:photos/core/event_bus.dart';
 import 'package:photos/db/public_keys_db.dart';
+import 'package:photos/ente_theme_data.dart';
 import 'package:photos/events/backup_folders_updated_event.dart';
 import 'package:photos/models/collection.dart';
 import 'package:photos/models/public_key.dart';
@@ -230,7 +231,8 @@ class _SharingDialogState extends State<SharingDialog> {
         IconButton(
           icon: Icon(
             Icons.contact_mail_outlined,
-            color: Theme.of(context).buttonColor.withOpacity(0.8),
+            color:
+                Theme.of(context).colorScheme.greenAlternative.withOpacity(0.8),
           ),
           onPressed: () async {
             final emailContact = await FlutterContactPicker.pickEmailContact(
@@ -297,7 +299,7 @@ class _SharingDialogState extends State<SharingDialog> {
                 children: [
                   Icon(
                     Icons.adaptive.share,
-                    color: Theme.of(context).buttonColor,
+                    color: Theme.of(context).colorScheme.greenAlternative,
                   ),
                   const Padding(
                     padding: EdgeInsets.all(4),
@@ -305,7 +307,7 @@ class _SharingDialogState extends State<SharingDialog> {
                   Text(
                     "Share link",
                     style: TextStyle(
-                      color: Theme.of(context).buttonColor,
+                      color: Theme.of(context).colorScheme.greenAlternative,
                     ),
                   ),
                 ],
@@ -384,7 +386,7 @@ class _SharingDialogState extends State<SharingDialog> {
             child: Text(
               "Invite",
               style: TextStyle(
-                color: Theme.of(context).buttonColor,
+                color: Theme.of(context).colorScheme.greenAlternative,
               ),
             ),
             onPressed: () {
@@ -444,7 +446,7 @@ class _SharingDialogState extends State<SharingDialog> {
           child: Text(
             "Subscribe",
             style: TextStyle(
-              color: Theme.of(context).buttonColor,
+              color: Theme.of(context).colorScheme.greenAlternative,
             ),
           ),
           onPressed: () {

+ 2 - 1
lib/ui/status_bar_widget.dart

@@ -2,6 +2,7 @@ import 'dart:async';
 
 import 'package:flutter/material.dart';
 import 'package:photos/core/event_bus.dart';
+import 'package:photos/ente_theme_data.dart';
 import 'package:photos/events/sync_status_update_event.dart';
 import 'package:photos/services/sync_service.dart';
 import 'package:photos/ui/header_error_widget.dart';
@@ -246,7 +247,7 @@ class SyncStatusCompletedWidget extends StatelessWidget {
               children: [
                 Icon(
                   Icons.cloud_done_outlined,
-                  color: Theme.of(context).buttonColor,
+                  color: Theme.of(context).colorScheme.greenAlternative,
                   size: 22,
                 ),
                 const Padding(

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

@@ -3,6 +3,7 @@ import 'dart:async';
 import 'package:chewie/chewie.dart';
 import 'package:chewie/src/material/material_progress_bar.dart';
 import 'package:flutter/material.dart';
+import 'package:photos/ente_theme_data.dart';
 import 'package:photos/utils/date_time_util.dart';
 import 'package:video_player/video_player.dart';
 
@@ -95,11 +96,11 @@ class _VideoControlsState extends State<VideoControls> {
 
   @override
   void didChangeDependencies() {
-    final _oldController = chewieController;
+    final oldController = chewieController;
     chewieController = ChewieController.of(context);
     controller = chewieController.videoPlayerController;
 
-    if (_oldController != chewieController) {
+    if (oldController != chewieController) {
       _dispose();
       _initialize();
     }
@@ -221,7 +222,7 @@ class _VideoControlsState extends State<VideoControls> {
     });
   }
 
-  Future<Null> _initialize() async {
+  Future<void> _initialize() async {
     controller.addListener(_updateState);
 
     _updateState();
@@ -301,7 +302,7 @@ class _VideoControlsState extends State<VideoControls> {
           },
           colors: chewieController.materialProgressColors ??
               ChewieProgressColors(
-                playedColor: Theme.of(context).buttonColor,
+                playedColor: Theme.of(context).colorScheme.greenAlternative,
                 handleColor: Colors.white,
                 bufferedColor: Colors.white,
                 backgroundColor: Theme.of(context).disabledColor,

+ 3 - 3
lib/ui/viewer/file/zoomable_live_image.dart

@@ -161,11 +161,11 @@ class _ZoomableLiveImageState extends State<ZoomableLiveImage>
   }
 
   void _showLivePhotoToast() async {
-    var _preferences = await SharedPreferences.getInstance();
-    int promptTillNow = _preferences.getInt(kLivePhotoToastCounterKey) ?? 0;
+    var preferences = await SharedPreferences.getInstance();
+    int promptTillNow = preferences.getInt(kLivePhotoToastCounterKey) ?? 0;
     if (promptTillNow < kMaxLivePhotoToastCount) {
       showToast(context, "Press and hold to play video");
-      _preferences.setInt(kLivePhotoToastCounterKey, promptTillNow + 1);
+      preferences.setInt(kLivePhotoToastCounterKey, promptTillNow + 1);
     }
   }
 }

+ 3 - 3
lib/utils/dialog_util.dart

@@ -77,9 +77,9 @@ Future<T> showConfettiDialog<T>({
   final pageBuilder = Builder(
     builder: builder,
   );
-  ConfettiController _confettiController =
+  ConfettiController confettiController =
       ConfettiController(duration: const Duration(seconds: 1));
-  _confettiController.play();
+  confettiController.play();
   return showDialog(
     context: context,
     builder: (BuildContext buildContext) {
@@ -89,7 +89,7 @@ Future<T> showConfettiDialog<T>({
           Align(
             alignment: confettiAlignment,
             child: ConfettiWidget(
-              confettiController: _confettiController,
+              confettiController: confettiController,
               blastDirection: pi / 2,
               emissionFrequency: 0,
               numberOfParticles: 100,

+ 1 - 1
lib/utils/email_util.dart

@@ -70,7 +70,7 @@ Future<void> sendLogs(
       child: Text(
         title,
         style: TextStyle(
-          color: Theme.of(context).buttonColor,
+          color: Theme.of(context).colorScheme.greenAlternative,
         ),
       ),
       onPressed: () async {

+ 2 - 2
pubspec.lock

@@ -137,7 +137,7 @@ packages:
     source: hosted
     version: "1.1.0"
   collection:
-    dependency: transitive
+    dependency: "direct main"
     description:
       name: collection
       url: "https://pub.dartlang.org"
@@ -873,7 +873,7 @@ packages:
     source: hosted
     version: "0.2.0"
   path:
-    dependency: transitive
+    dependency: "direct main"
     description:
       name: path
       url: "https://pub.dartlang.org"