From 2b71aba27848981252d8859800bc726b0ce61378 Mon Sep 17 00:00:00 2001 From: dab246 Date: Fri, 24 Feb 2023 12:12:54 +0700 Subject: [PATCH] TF-1487 Apply linter rule --- analysis_options.yaml | 19 +--- contact/analysis_options.yaml | 16 +++- core/analysis_options.yaml | 19 +--- core/lib/core.dart | 3 - .../extensions/color_extension.dart | 11 ++- .../extensions/url_extension.dart | 2 +- core/lib/presentation/state/app_state.dart | 5 +- core/lib/presentation/utils/app_toast.dart | 2 +- core/lib/presentation/utils/theme_utils.dart | 4 +- .../background/background_widget_builder.dart | 2 +- .../views/button/button_builder.dart | 2 +- .../views/button/icon_button_web.dart | 17 ++-- .../dialog/confirmation_dialog_builder.dart | 2 +- .../scrolling_floating_button_animated.dart | 22 ++--- .../popup_menu/popup_menu_item_widget.dart | 9 +- .../quick_search/quick_search_input_form.dart | 22 ++--- .../views/tab_bar/custom_tab_indicator.dart | 61 ------------ core/lib/utils/app_logger.dart | 8 +- core/lib/utils/benchmark.dart | 2 +- core/lib/utils/build_utils.dart | 11 ++- core/lib/utils/fps_manager.dart | 6 +- fcm/analysis_options.yaml | 16 +++- forward/analysis_options.yaml | 16 +++- lib/features/base/base_controller.dart | 14 +-- .../mixin/message_dialog_action_mixin.dart | 12 +-- .../base/mixin/popup_menu_widget_mixin.dart | 3 +- .../reloadable/reloadable_controller.dart | 12 +-- .../base/widget/drop_down_button_widget.dart | 12 +-- .../base/widget/popup_item_widget.dart | 3 +- .../caching/config/hive_cache_config.dart | 2 +- .../caching/hive_cache_version_client.dart | 8 +- .../caching/utils/caching_constants.dart | 2 +- .../cleanup_datasource_impl.dart | 16 +--- .../composer_datasource_impl.dart | 4 +- .../contact_datasource_impl.dart | 4 +- .../presentation/composer_controller.dart | 19 ++-- .../rich_text_mobile_tablet_controller.dart | 5 +- .../mixin/rich_text_button_mixin.dart | 36 +++---- .../widgets/toolbar_rich_text_builder.dart | 7 +- .../widgets/app_bar_contact_widget.dart | 11 ++- .../widgets/contact_input_tag_item.dart | 2 +- .../destination_picker_controller.dart | 6 +- .../presentation/destination_picker_view.dart | 5 +- .../top_bar_destination_picker_builder.dart | 65 +------------ .../email_datasource_impl.dart | 52 +++------- .../datasource_impl/html_datasource_impl.dart | 8 +- .../datasource_impl/mdn_datasource_impl.dart | 4 +- .../email/presentation/email_view.dart | 20 ++-- .../widgets/app_bar_mail_widget_builder.dart | 8 +- .../widgets/attachment_file_tile_builder.dart | 2 +- .../identity_creator_controller.dart | 2 +- .../presentation/identity_creator_view.dart | 22 +++-- .../authentication_oidc_datasource_impl.dart | 52 +++------- .../hive_account_datasource_impl.dart | 12 +-- .../login_url_datasource_impl.dart | 8 +- .../login_username_datasource_impl.dart | 8 +- .../oidc_configuration_extensions.dart | 4 +- .../login/presentation/login_view.dart | 6 +- .../widgets/login_text_input_builder.dart | 2 - .../mailbox_cache_datasource_impl.dart | 8 +- .../mailbox_datasource_impl.dart | 36 ++----- .../state_datasource_impl.dart | 8 +- .../refresh_all_mailbox_interactor.dart | 4 +- .../presentation/mailbox_controller.dart | 96 +++++++++---------- .../mailbox/presentation/mailbox_view.dart | 10 +- .../presentation/mailbox_view_web.dart | 11 ++- .../mixin/mailbox_widget_mixin.dart | 4 +- .../presentation/model/mailbox_node.dart | 12 +-- .../mailbox_button_new_folder_builder.dart | 7 +- .../widgets/mailbox_folder_tile_builder.dart | 6 +- .../user_information_widget_builder.dart | 5 +- .../composite_name_validator.dart | 4 +- .../duplicate_name_validator.dart | 6 +- .../verification/email_address_validator.dart | 4 +- .../verification/empty_name_validator.dart | 4 +- .../special_character_validator.dart | 4 +- .../presentation/mailbox_creator_view.dart | 2 +- .../search_datasource_impl.dart | 8 +- ...eference_spam_report_data_source_impl.dart | 24 ++--- .../spam_report_datasource_impl.dart | 8 +- ...re_preference_spam_report_data_source.dart | 18 ++-- .../data/network/spam_report_api.dart | 6 +- .../get_unread_spam_mailbox_interactor.dart | 16 ++-- .../advanced_filter_controller.dart | 4 +- .../mailbox_dashboard_controller.dart | 10 +- .../controller/spam_report_controller.dart | 8 +- .../mailbox_dashboard_view_web.dart | 28 +++--- .../mixin/filter_email_popup_menu_mixin.dart | 4 +- .../advanced_search_filter_bottom_sheet.dart | 6 +- ...vanced_search_filter_form_bottom_view.dart | 12 +-- .../drop_down_button_filter_widget.dart | 4 +- .../icon_open_advanced_search_widget.dart | 6 +- .../download/download_task_item_widget.dart | 4 +- .../spam_report_banner_web_widget.dart | 18 ++-- .../widgets/top_bar_thread_selection.dart | 8 +- .../forwarding_data_source_impl.dart | 16 +--- .../identity_data_source_impl.dart | 16 +--- .../manage_account_datasource_impl.dart | 4 +- .../rule_filter_datasource_impl.dart | 16 +--- .../vacation_data_source_impl.dart | 8 +- .../email_rules/email_rules_controller.dart | 5 +- .../presentation/forward/forward_view.dart | 2 +- .../widgets/email_forward_item_widget.dart | 6 +- .../widgets/list_email_forward_widget.dart | 4 +- .../mailbox_visibility_controller.dart | 34 +++---- ...ailbox_visibility_folder_tile_builder.dart | 12 +-- .../manage_account_dashboard_view.dart | 2 +- .../menu/settings/settings_view.dart | 2 +- .../setting_first_level_tile_builder.dart | 5 +- .../vacation/vacation_controller.dart | 6 +- .../presentation/vacation/vacation_view.dart | 3 +- .../cache_fcm_datasource_impl.dart | 16 +--- .../datasource_impl/fcm_datasource_impl.dart | 12 +-- .../data/local/fcm_cache_manager.dart | 6 +- .../data/model/fcm_subscription.dart | 2 +- .../data/repository/fcm_repository_impl.dart | 4 +- ...get_fcm_subscription_local_interactor.dart | 4 +- .../quotas_data_source_impl.dart | 4 +- .../rules_filter_creator_controller.dart | 2 +- .../widgets/rule_filter_button_field.dart | 4 +- .../presentation/search_email_controller.dart | 45 ++++----- .../email/presentation/search_email_view.dart | 27 +++--- .../widgets/app_bar_selection_mode.dart | 17 ++-- .../search_mailbox_controller.dart | 28 +++--- .../presentation/search_mailbox_view.dart | 6 +- .../session_datasource_impl.dart | 4 +- .../local_thread_datasource_impl.dart | 8 +- .../thread_datasource_impl.dart | 16 +--- .../data/network/thread_isolate_worker.dart | 10 +- .../mixin/email_action_controller.dart | 5 +- .../presentation/thread_controller.dart | 91 +++++++++--------- .../thread/presentation/thread_view.dart | 39 ++++---- .../app_bar_thread_widget_builder.dart | 19 ++-- .../widgets/search_app_bar_widget.dart | 5 +- .../widgets/spam_report_banner_widget.dart | 16 ++-- .../attachment_upload_datasource_impl.dart | 4 +- lib/l10n/intl_messages.arb | 14 ++- .../bindings/network/network_bindings.dart | 30 +++--- .../network/network_isolate_binding.dart | 4 +- .../exceptions/cache_exception_thrower.dart | 2 +- lib/main/exceptions/exception_thrower.dart | 2 +- .../exceptions/remote_exception_thrower.dart | 2 +- model/analysis_options.yaml | 19 +--- model/lib/contact/device_contact.dart | 3 - model/lib/email/attachment.dart | 6 +- model/lib/email/email_content.dart | 6 +- model/lib/email/email_property.dart | 2 +- model/lib/extensions/session_extension.dart | 4 +- model/lib/oidc/oidc_configuration.dart | 2 +- model/lib/upload/file_info.dart | 2 - model/pubspec.lock | 4 +- model/pubspec.yaml | 5 + pubspec.lock | 10 +- pubspec.yaml | 11 +++ rule_filter/analysis_options.yaml | 16 +++- 155 files changed, 798 insertions(+), 1039 deletions(-) delete mode 100644 core/lib/presentation/views/tab_bar/custom_tab_indicator.dart diff --git a/analysis_options.yaml b/analysis_options.yaml index 61b6c4de1..195df9775 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -10,20 +10,7 @@ include: package:flutter_lints/flutter.yaml linter: - # The lint rules applied to this project can be customized in the - # section below to disable rules from the `package:flutter_lints/flutter.yaml` - # included above or to enable additional rules. A list of all available lints - # and their documentation is published at - # https://dart-lang.github.io/linter/lints/index.html. - # - # Instead of disabling a lint rule for the entire project in the - # section below, it can also be suppressed for a single line of code - # or a specific dart file by using the `// ignore: name_of_lint` and - # `// ignore_for_file: name_of_lint` syntax on the line or in the file - # producing the lint. rules: - # avoid_print: false # Uncomment to disable the `avoid_print` rule - # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule - -# Additional information about this file can be found at -# https://dart.dev/guides/language/analysis-options + constant_identifier_names: false + non_constant_identifier_names: false + unnecessary_string_escapes: false diff --git a/contact/analysis_options.yaml b/contact/analysis_options.yaml index a5744c1cf..0f32754d3 100644 --- a/contact/analysis_options.yaml +++ b/contact/analysis_options.yaml @@ -1,4 +1,16 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. include: package:flutter_lints/flutter.yaml -# Additional information about this file can be found at -# https://dart.dev/guides/language/analysis-options +linter: + rules: + constant_identifier_names: false + non_constant_identifier_names: false + unnecessary_string_escapes: false \ No newline at end of file diff --git a/core/analysis_options.yaml b/core/analysis_options.yaml index 61b6c4de1..0f32754d3 100644 --- a/core/analysis_options.yaml +++ b/core/analysis_options.yaml @@ -10,20 +10,7 @@ include: package:flutter_lints/flutter.yaml linter: - # The lint rules applied to this project can be customized in the - # section below to disable rules from the `package:flutter_lints/flutter.yaml` - # included above or to enable additional rules. A list of all available lints - # and their documentation is published at - # https://dart-lang.github.io/linter/lints/index.html. - # - # Instead of disabling a lint rule for the entire project in the - # section below, it can also be suppressed for a single line of code - # or a specific dart file by using the `// ignore: name_of_lint` and - # `// ignore_for_file: name_of_lint` syntax on the line or in the file - # producing the lint. rules: - # avoid_print: false # Uncomment to disable the `avoid_print` rule - # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule - -# Additional information about this file can be found at -# https://dart.dev/guides/language/analysis-options + constant_identifier_names: false + non_constant_identifier_names: false + unnecessary_string_escapes: false \ No newline at end of file diff --git a/core/lib/core.dart b/core/lib/core.dart index 6020093dd..3a9943ed7 100644 --- a/core/lib/core.dart +++ b/core/lib/core.dart @@ -73,7 +73,6 @@ export 'presentation/views/bottom_popup/confirmation_dialog_action_sheet_builder export 'presentation/views/modal_sheets/edit_text_modal_sheet_builder.dart'; export 'presentation/views/search/search_bar_view.dart'; export 'presentation/views/popup_menu/popup_menu_item_widget.dart'; -export 'presentation/views/tab_bar/custom_tab_indicator.dart'; export 'presentation/views/quick_search/quick_search_input_form.dart'; export 'presentation/views/toast/toast_position.dart'; export 'presentation/views/toast/tmail_toast.dart'; @@ -95,8 +94,6 @@ export 'data/network/dio_client.dart'; export 'data/network/download/download_client.dart'; export 'data/network/download/download_manager.dart'; export 'data/network/download/downloaded_response.dart'; -export 'data/network/download/download_client.dart'; -export 'domain/exceptions/web_session_exception.dart'; // State export 'presentation/state/success.dart'; diff --git a/core/lib/presentation/extensions/color_extension.dart b/core/lib/presentation/extensions/color_extension.dart index 578ed5af6..8fd1d1f7c 100644 --- a/core/lib/presentation/extensions/color_extension.dart +++ b/core/lib/presentation/extensions/color_extension.dart @@ -1,5 +1,3 @@ -import 'dart:ui' show Color; - import 'package:flutter/material.dart'; extension AppColor on Color { @@ -197,3 +195,12 @@ extension AppColor on Color { .toUpperCase()}'; } +extension ColorNullableExtension on Color? { + ColorFilter? asFilter({BlendMode? blendMode}) { + if (this == null) { + return null; + } else { + return ColorFilter.mode(this!, blendMode ?? BlendMode.srcIn); + } + } +} diff --git a/core/lib/presentation/extensions/url_extension.dart b/core/lib/presentation/extensions/url_extension.dart index 8f6a9059f..f1b2ebbc3 100644 --- a/core/lib/presentation/extensions/url_extension.dart +++ b/core/lib/presentation/extensions/url_extension.dart @@ -11,7 +11,7 @@ extension URLExtension on String { } else if (startsWith(prefixUrlHttp)) { return kReleaseMode ? replaceAll(prefixUrlHttp, prefixUrlHttps) : this; } else { - return '$prefixUrlHttps${this}'; + return '$prefixUrlHttps$this'; } } return ''; diff --git a/core/lib/presentation/state/app_state.dart b/core/lib/presentation/state/app_state.dart index 37f9b1006..96a36a845 100644 --- a/core/lib/presentation/state/app_state.dart +++ b/core/lib/presentation/state/app_state.dart @@ -1,7 +1,8 @@ -import 'package:core/core.dart'; +import 'package:core/presentation/state/failure.dart'; +import 'package:core/presentation/state/success.dart'; import 'package:dartz/dartz.dart'; -import 'package:meta/meta.dart'; import 'package:equatable/equatable.dart'; +import 'package:flutter/material.dart'; @immutable abstract class AppState with EquatableMixin { diff --git a/core/lib/presentation/utils/app_toast.dart b/core/lib/presentation/utils/app_toast.dart index 15f230c72..148eaca42 100644 --- a/core/lib/presentation/utils/app_toast.dart +++ b/core/lib/presentation/utils/app_toast.dart @@ -171,7 +171,7 @@ class AppToast { width: 24, height: 24, fit: BoxFit.fill, - color: iconColor), + colorFilter: iconColor.asFilter()), if (icon != null) const SizedBox(width: 10.0), Expanded(child: Text( diff --git a/core/lib/presentation/utils/theme_utils.dart b/core/lib/presentation/utils/theme_utils.dart index 843d1d14a..f02385c6e 100644 --- a/core/lib/presentation/utils/theme_utils.dart +++ b/core/lib/presentation/utils/theme_utils.dart @@ -21,8 +21,8 @@ class ThemeUtils { static TextTheme get _textTheme { return const TextTheme( - bodyText1: TextStyle(color: AppColor.baseTextColor), - bodyText2: TextStyle(color: AppColor.baseTextColor), + bodyMedium: TextStyle(color: AppColor.baseTextColor), + bodySmall: TextStyle(color: AppColor.baseTextColor), ); } diff --git a/core/lib/presentation/views/background/background_widget_builder.dart b/core/lib/presentation/views/background/background_widget_builder.dart index 47bd84fb8..3812a836f 100644 --- a/core/lib/presentation/views/background/background_widget_builder.dart +++ b/core/lib/presentation/views/background/background_widget_builder.dart @@ -43,6 +43,7 @@ class BackgroundWidgetBuilder extends StatelessWidget { return Container( color: Colors.transparent, padding: const EdgeInsets.symmetric(horizontal: 12), + height: MediaQuery.of(context).size.height, child: Column( mainAxisAlignment: responsiveUtils.isLandscapeMobile(context) ? MainAxisAlignment.start @@ -83,7 +84,6 @@ class BackgroundWidgetBuilder extends StatelessWidget { ) ], ), - height: MediaQuery.of(context).size.height, ); } } \ No newline at end of file diff --git a/core/lib/presentation/views/button/button_builder.dart b/core/lib/presentation/views/button/button_builder.dart index 0dde01af3..357c10d81 100644 --- a/core/lib/presentation/views/button/button_builder.dart +++ b/core/lib/presentation/views/button/button_builder.dart @@ -161,7 +161,7 @@ class ButtonBuilder { width: _size ?? 24, height: _size ?? 24, fit: BoxFit.fill, - color: _iconColor)); + colorFilter: _iconColor.asFilter())); Widget _buildText() { return Text( diff --git a/core/lib/presentation/views/button/icon_button_web.dart b/core/lib/presentation/views/button/icon_button_web.dart index 826844468..9b846ca4d 100644 --- a/core/lib/presentation/views/button/icon_button_web.dart +++ b/core/lib/presentation/views/button/icon_button_web.dart @@ -6,7 +6,7 @@ import 'package:flutter_svg/flutter_svg.dart'; typedef IconWebCallback = void Function(); typedef IconWebHasPositionCallback = void Function(RelativeRect); typedef OnTapIconButtonCallbackAction = void Function(); -typedef OnTapDownIconButtonCallbackAction = void Function(TapDownDetails TapDetails); +typedef OnTapDownIconButtonCallbackAction = void Function(TapDownDetails tapDetails); Widget buildIconWeb({ required Widget icon, @@ -51,7 +51,7 @@ Widget buildSVGIconButton({ width: iconSize, height: iconSize, fit: BoxFit.fill, - color: iconColor, + colorFilter: iconColor.asFilter(), ), ); @@ -107,15 +107,20 @@ Widget buildTextCircleButton(String text, { shape: const CircleBorder(), color: Colors.transparent, child: TextButton( - child: Text( - text, - style: textStyle ?? const TextStyle(fontWeight: FontWeight.normal, fontSize: 15, color: AppColor.lineItemListColor)), style: ButtonStyle( overlayColor: MaterialStateProperty.resolveWith((Set states) => AppColor.colorFocusButton), shape: MaterialStateProperty.all(const CircleBorder()), padding: MaterialStateProperty.resolveWith((Set states) => EdgeInsets.zero), elevation: MaterialStateProperty.resolveWith((Set states) => 0)), - onPressed: () => onTap?.call() + onPressed: () => onTap?.call(), + child: Text( + text, + style: textStyle ?? const TextStyle( + fontWeight: FontWeight.normal, + fontSize: 15, + color: AppColor.lineItemListColor + ) + ) ) ); } diff --git a/core/lib/presentation/views/dialog/confirmation_dialog_builder.dart b/core/lib/presentation/views/dialog/confirmation_dialog_builder.dart index e35ff3698..2d96c5db6 100644 --- a/core/lib/presentation/views/dialog/confirmation_dialog_builder.dart +++ b/core/lib/presentation/views/dialog/confirmation_dialog_builder.dart @@ -166,7 +166,7 @@ class ConfirmDialogBuilder { height: _heightDialog, decoration: const BoxDecoration( color: Colors.white, - borderRadius: const BorderRadius.all(Radius.circular(16))), + borderRadius: BorderRadius.all(Radius.circular(16))), margin: _margin, child: Wrap(children: [ if (_onCloseButtonAction != null) diff --git a/core/lib/presentation/views/floating_button/scrolling_floating_button_animated.dart b/core/lib/presentation/views/floating_button/scrolling_floating_button_animated.dart index a9c1aac25..a343389d5 100644 --- a/core/lib/presentation/views/floating_button/scrolling_floating_button_animated.dart +++ b/core/lib/presentation/views/floating_button/scrolling_floating_button_animated.dart @@ -57,7 +57,7 @@ class ScrollingFloatingButtonAnimated extends StatefulWidget { : super(key: key); @override - _ScrollingFloatingButtonAnimatedState createState() => + State createState() => _ScrollingFloatingButtonAnimatedState(); } @@ -93,10 +93,10 @@ class _ScrollingFloatingButtonAnimatedState /// Function to add listener for scroll void _handleScroll() { - ScrollController _scrollController = widget.scrollController!; - _scrollController.addListener(() { - if (_scrollController.position.pixels > widget.limitIndicator! && - _scrollController.position.userScrollDirection == + ScrollController scrollController = widget.scrollController!; + scrollController.addListener(() { + if (scrollController.position.pixels > widget.limitIndicator! && + scrollController.position.userScrollDirection == ScrollDirection.reverse) { if (widget.animateIcon!) _animationController.forward(); if (mounted) { @@ -104,8 +104,8 @@ class _ScrollingFloatingButtonAnimatedState _onTop = false; }); } - } else if (_scrollController.position.pixels <= widget.limitIndicator! && - _scrollController.position.userScrollDirection == + } else if (scrollController.position.pixels <= widget.limitIndicator! && + scrollController.position.userScrollDirection == ScrollDirection.forward) { if (widget.animateIcon!) _animationController.reverse(); if (mounted) { @@ -145,14 +145,14 @@ class _ScrollingFloatingButtonAnimatedState Container( padding: EdgeInsets.only(left: 16, right: _onTop ? 10 : 16), child: AnimatedBuilder( - child: widget.icon!, animation: _animationController, - builder: (BuildContext context, Widget? _widget) { + builder: (BuildContext context, Widget? widget) { return Transform.rotate( angle: (_animationController.value * 3 * math.pi) / 180, - child: _widget!, + child: widget!, ); - }), + }, + child: widget.icon!), ), ...(_onTop ? [ diff --git a/core/lib/presentation/views/popup_menu/popup_menu_item_widget.dart b/core/lib/presentation/views/popup_menu/popup_menu_item_widget.dart index b9c94aecb..e59c0f90d 100644 --- a/core/lib/presentation/views/popup_menu/popup_menu_item_widget.dart +++ b/core/lib/presentation/views/popup_menu/popup_menu_item_widget.dart @@ -1,4 +1,5 @@ +import 'package:core/core.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; @@ -28,7 +29,13 @@ class PopupMenuItemWidget extends StatelessWidget { padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 16), child: SizedBox( child: Row(children: [ - SvgPicture.asset(icon, width: 20, height: 20, fit: BoxFit.fill, color: iconColor), + SvgPicture.asset( + icon, + width: 20, + height: 20, + fit: BoxFit.fill, + colorFilter: iconColor.asFilter() + ), const SizedBox(width: 12), Expanded(child: Text(name, style: const TextStyle(fontSize: 15, color: Colors.black, fontWeight: FontWeight.w500))), diff --git a/core/lib/presentation/views/quick_search/quick_search_input_form.dart b/core/lib/presentation/views/quick_search/quick_search_input_form.dart index e32d42097..aa2c83dab 100644 --- a/core/lib/presentation/views/quick_search/quick_search_input_form.dart +++ b/core/lib/presentation/views/quick_search/quick_search_input_form.dart @@ -156,7 +156,7 @@ class QuickSearchInputForm extends FormField { }); @override - _TypeAheadFormFieldState createState() => _TypeAheadFormFieldState(); + FormFieldState createState() => _TypeAheadFormFieldState(); } class _TypeAheadFormFieldState extends FormFieldState { @@ -567,7 +567,7 @@ class TypeAheadFieldQuickSearch extends StatefulWidget { super(key: key); @override - _TypeAheadFieldQuickSearchState createState() => _TypeAheadFieldQuickSearchState(); + State> createState() => _TypeAheadFieldQuickSearchState(); } class _TypeAheadFieldQuickSearchState extends State> @@ -678,13 +678,9 @@ class _TypeAheadFieldQuickSearchState extends State extends State<_SuggestionsList> return Padding( padding: const EdgeInsets.only(right: 8, bottom: kIsWeb ? 8 : 0), child: InkWell( - child: widget.actionButtonBuilder!(context, action), borderRadius: const BorderRadius.all(Radius.circular(10)), onTap: () { if (widget.buttonActionCallback != null) { @@ -1184,6 +1179,7 @@ class _SuggestionsListState extends State<_SuggestionsList> invalidateSuggestions(); } }, + child: widget.actionButtonBuilder!(context, action), ), ); } else { @@ -1257,7 +1253,6 @@ class _SuggestionsListState extends State<_SuggestionsList> return Padding( padding: const EdgeInsets.only(right: 8, bottom: kIsWeb ? 8 : 0), child: InkWell( - child: widget.actionButtonBuilder!(context, action), borderRadius: const BorderRadius.all(Radius.circular(10)), onTap: () { if (widget.buttonActionCallback != null) { @@ -1265,6 +1260,7 @@ class _SuggestionsListState extends State<_SuggestionsList> invalidateSuggestions(); } }, + child: widget.actionButtonBuilder!(context, action), ), ); } else { @@ -1680,7 +1676,7 @@ class _SuggestionsBox { if (isOpened) return; assert(_overlayEntry != null); resize(); - Overlay.of(context)!.insert(_overlayEntry!); + Overlay.of(context).insert(_overlayEntry!); isOpened = true; } @@ -1726,7 +1722,7 @@ class _SuggestionsBox { await Future.delayed(const Duration(milliseconds: 170)); timer += 170; - if (widgetMounted && + if (widgetMounted && context.mounted && (MediaQuery.of(context).viewInsets != initial || _findRootMediaQuery() != initialRootMediaQuery)) { return true; diff --git a/core/lib/presentation/views/tab_bar/custom_tab_indicator.dart b/core/lib/presentation/views/tab_bar/custom_tab_indicator.dart deleted file mode 100644 index 54ebb7479..000000000 --- a/core/lib/presentation/views/tab_bar/custom_tab_indicator.dart +++ /dev/null @@ -1,61 +0,0 @@ -import 'package:flutter/widgets.dart'; - -enum CustomIndicatorSize { - tiny, - normal, - full, -} - -class CustomIndicator extends Decoration { - final double indicatorHeight; - final Color indicatorColor; - final CustomIndicatorSize indicatorSize; - - const CustomIndicator({ - required this.indicatorHeight, - required this.indicatorColor, - required this.indicatorSize - }); - - @override - _CustomPainter createBoxPainter([VoidCallback? onChanged]) { - return _CustomPainter(this, onChanged); - } -} - -class _CustomPainter extends BoxPainter { - final CustomIndicator decoration; - - _CustomPainter(this.decoration, VoidCallback? onChanged) : super(onChanged); - - @override - void paint(Canvas canvas, Offset offset, ImageConfiguration configuration) { - assert(configuration.size != null); - - Rect? rect; - if (decoration.indicatorSize == CustomIndicatorSize.full) { - rect = Offset(offset.dx, - (configuration.size!.height - decoration.indicatorHeight)) & - Size(configuration.size!.width, decoration.indicatorHeight); - } else if (decoration.indicatorSize == CustomIndicatorSize.normal) { - rect = Offset(offset.dx + 6, - (configuration.size!.height - decoration.indicatorHeight)) & - Size(configuration.size!.width - 12, decoration.indicatorHeight); - } else if (decoration.indicatorSize == CustomIndicatorSize.tiny) { - rect = Offset(offset.dx + configuration.size!.width / 2 - 8, - (configuration.size!.height - decoration.indicatorHeight)) & - Size(16, decoration.indicatorHeight); - } - - if (rect != null) { - final Paint paint = Paint(); - paint.color = decoration.indicatorColor; - paint.style = PaintingStyle.fill; - canvas.drawRRect( - RRect.fromRectAndCorners(rect, - topRight: const Radius.circular(8), - topLeft: const Radius.circular(8)), - paint); - } - } -} diff --git a/core/lib/utils/app_logger.dart b/core/lib/utils/app_logger.dart index 6c5bfbfc6..201e21e7c 100644 --- a/core/lib/utils/app_logger.dart +++ b/core/lib/utils/app_logger.dart @@ -3,17 +3,17 @@ import 'dart:async'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -_Dispatcher logHistory = _Dispatcher(""); +final logHistory = _Dispatcher(""); void log(String? value) { String v = value ?? ""; - logHistory.value = v + "\n" + logHistory.value; - if (kReleaseMode == false) { + logHistory.value = "$v\n${logHistory.value}"; + if (kDebugMode) { print(v); } } -void logError(String? value) => log("[ERROR] " + (value ?? "")); +void logError(String? value) => log("[ERROR] ${value ?? ""}"); // Take from: https://flutter.dev/docs/testing/errors void initLogger(VoidCallback runApp) { diff --git a/core/lib/utils/benchmark.dart b/core/lib/utils/benchmark.dart index 4af69cbab..e3939856f 100644 --- a/core/lib/utils/benchmark.dart +++ b/core/lib/utils/benchmark.dart @@ -33,4 +33,4 @@ class _Benchmark { } } -final _Benchmark bench = _Benchmark(); \ No newline at end of file +final bench = _Benchmark(); \ No newline at end of file diff --git a/core/lib/utils/build_utils.dart b/core/lib/utils/build_utils.dart index be54cc5e4..212ff6d2a 100644 --- a/core/lib/utils/build_utils.dart +++ b/core/lib/utils/build_utils.dart @@ -1,11 +1,12 @@ -import 'package:flutter/foundation.dart' as Foundation; + +import 'package:flutter/foundation.dart'; abstract class BuildUtils { - static const bool isDebugMode = Foundation.kDebugMode; + static const bool isDebugMode = kDebugMode; - static const bool isReleaseMode = Foundation.kReleaseMode; + static const bool isReleaseMode = kReleaseMode; - static const bool isWeb = Foundation.kIsWeb; + static const bool isWeb = kIsWeb; - static const bool isProfileMode = Foundation.kProfileMode; + static const bool isProfileMode = kProfileMode; } \ No newline at end of file diff --git a/core/lib/utils/fps_manager.dart b/core/lib/utils/fps_manager.dart index 36e1cb420..295ddefea 100644 --- a/core/lib/utils/fps_manager.dart +++ b/core/lib/utils/fps_manager.dart @@ -34,8 +34,8 @@ class FpsManager { final List _fpsCallbacks = []; /// Temporarily save 120 frames - static const int _queue_capacity = 120; - final ListQueue framesQueue = ListQueue(_queue_capacity); + static const int queueCapacity = 120; + final ListQueue framesQueue = ListQueue(queueCapacity); void addFpsCallback(FpsCallback callback) { _fpsCallbacks.add(callback); @@ -69,7 +69,7 @@ class FpsManager { for (FrameTiming timing in timings) { framesQueue.addFirst(timing); } - while (framesQueue.length > _queue_capacity) { + while (framesQueue.length > queueCapacity) { framesQueue.removeLast(); } diff --git a/fcm/analysis_options.yaml b/fcm/analysis_options.yaml index a5744c1cf..0f32754d3 100644 --- a/fcm/analysis_options.yaml +++ b/fcm/analysis_options.yaml @@ -1,4 +1,16 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. include: package:flutter_lints/flutter.yaml -# Additional information about this file can be found at -# https://dart.dev/guides/language/analysis-options +linter: + rules: + constant_identifier_names: false + non_constant_identifier_names: false + unnecessary_string_escapes: false \ No newline at end of file diff --git a/forward/analysis_options.yaml b/forward/analysis_options.yaml index a5744c1cf..0f32754d3 100644 --- a/forward/analysis_options.yaml +++ b/forward/analysis_options.yaml @@ -1,4 +1,16 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. include: package:flutter_lints/flutter.yaml -# Additional information about this file can be found at -# https://dart.dev/guides/language/analysis-options +linter: + rules: + constant_identifier_names: false + non_constant_identifier_names: false + unnecessary_string_escapes: false \ No newline at end of file diff --git a/lib/features/base/base_controller.dart b/lib/features/base/base_controller.dart index 44eca34d6..2b3b0d31e 100644 --- a/lib/features/base/base_controller.dart +++ b/lib/features/base/base_controller.dart @@ -78,9 +78,9 @@ abstract class BaseController extends GetxController return; } - final _appToast = Get.find(); - final _imagePaths = Get.find(); - final _responsiveUtils = Get.find(); + final appToast = Get.find(); + final imagePaths = Get.find(); + final responsiveUtils = Get.find(); String messageError = ''; if (error is MethodLevelErrors) { @@ -92,19 +92,19 @@ abstract class BaseController extends GetxController } if (messageError.isNotEmpty && currentContext != null && currentOverlayContext != null) { - _appToast.showBottomToast( + appToast.showBottomToast( currentOverlayContext!, messageError, leadingIcon: SvgPicture.asset( - _imagePaths.icNotConnection, + imagePaths.icNotConnection, width: 24, height: 24, - color: Colors.white, + colorFilter: Colors.white.asFilter(), fit: BoxFit.fill), backgroundColor: AppColor.toastErrorBackgroundColor, textColor: Colors.white, textActionColor: Colors.white, - maxWidth: _responsiveUtils.getMaxWidthToast(currentContext!)); + maxWidth: responsiveUtils.getMaxWidthToast(currentContext!)); } } diff --git a/lib/features/base/mixin/message_dialog_action_mixin.dart b/lib/features/base/mixin/message_dialog_action_mixin.dart index 77b07040f..643b1dc2d 100644 --- a/lib/features/base/mixin/message_dialog_action_mixin.dart +++ b/lib/features/base/mixin/message_dialog_action_mixin.dart @@ -26,10 +26,10 @@ mixin MessageDialogActionMixin { Color? cancelButtonColor, } ) { - final _responsiveUtils = Get.find(); - final _imagePaths = Get.find(); + final responsiveUtils = Get.find(); + final imagePaths = Get.find(); - if (_responsiveUtils.isMobile(context)) { + if (responsiveUtils.isMobile(context)) { if (showAsBottomSheet) { showModalBottomSheet( context: context, @@ -38,13 +38,13 @@ mixin MessageDialogActionMixin { backgroundColor: Colors.transparent, enableDrag: true, builder: (BuildContext context) => PointerInterceptor( - child: (ConfirmDialogBuilder(_imagePaths, showAsBottomSheet: true) + child: (ConfirmDialogBuilder(imagePaths, showAsBottomSheet: true) ..key(const Key('confirm_dialog_action')) ..title(title ?? '') ..content(message) ..addIcon(icon) ..margin(const EdgeInsets.symmetric(vertical: 42, horizontal: 16)) - ..widthDialog(_responsiveUtils.getSizeScreenWidth(context)) + ..widthDialog(responsiveUtils.getSizeScreenWidth(context)) ..colorConfirmButton(actionButtonColor ?? AppColor.colorTextButton) ..colorCancelButton(cancelButtonColor ?? AppColor.colorCancelButton) ..paddingTitle(icon != null ? const EdgeInsets.only(top: 24) : EdgeInsets.zero) @@ -76,7 +76,7 @@ mixin MessageDialogActionMixin { showDialog( context: context, barrierColor: AppColor.colorDefaultCupertinoActionSheet, - builder: (BuildContext context) => PointerInterceptor(child: (ConfirmDialogBuilder(_imagePaths) + builder: (BuildContext context) => PointerInterceptor(child: (ConfirmDialogBuilder(imagePaths) ..key(const Key('confirm_dialog_action')) ..title(title ?? '') ..content(message) diff --git a/lib/features/base/mixin/popup_menu_widget_mixin.dart b/lib/features/base/mixin/popup_menu_widget_mixin.dart index a6f08d157..507f92c7e 100644 --- a/lib/features/base/mixin/popup_menu_widget_mixin.dart +++ b/lib/features/base/mixin/popup_menu_widget_mixin.dart @@ -1,4 +1,5 @@ +import 'package:core/core.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; @@ -24,7 +25,7 @@ mixin PopupMenuWidgetMixin { width: iconSize ?? 20, height: iconSize ?? 20, fit: BoxFit.fill, - color: colorIcon + colorFilter: colorIcon.asFilter() ), const SizedBox(width: 12), Expanded(child: Text( diff --git a/lib/features/base/reloadable/reloadable_controller.dart b/lib/features/base/reloadable/reloadable_controller.dart index 8c76b03b8..f576ff200 100644 --- a/lib/features/base/reloadable/reloadable_controller.dart +++ b/lib/features/base/reloadable/reloadable_controller.dart @@ -98,8 +98,8 @@ abstract class ReloadableController extends BaseController { } else if (success is GetStoredTokenOidcSuccess) { _handleGetStoredTokenOIDCSuccess(success); } else if (success is GetFCMSubscriptionLocalSuccess) { - final _subscriptionId = success.fcmSubscription.subscriptionId; - _destroySubscriptionAction(_subscriptionId); + final subscriptionId = success.fcmSubscription.subscriptionId; + _destroySubscriptionAction(subscriptionId); } else if (success is DestroySubscriptionSuccess) { _checkAuthenticationTypeWhenLogout(); } @@ -249,18 +249,18 @@ abstract class ReloadableController extends BaseController { } bool fcmEnabled(Session? session, AccountId? accountId) { - bool _fcmEnabled = false; + bool fcmEnabled = false; try { requireCapability(session!, accountId!, [FirebaseCapability.fcmIdentifier]); if (AppConfig.fcmAvailable) { - _fcmEnabled = true; + fcmEnabled = true; } else { - _fcmEnabled = false; + fcmEnabled = false; } } catch (e) { logError('BaseController::fcmEnabled(): exception: $e'); } - return _fcmEnabled; + return fcmEnabled; } void logout(Session? session, AccountId? accountId) { diff --git a/lib/features/base/widget/drop_down_button_widget.dart b/lib/features/base/widget/drop_down_button_widget.dart index 176d3e1ea..a98ce6186 100644 --- a/lib/features/base/widget/drop_down_button_widget.dart +++ b/lib/features/base/widget/drop_down_button_widget.dart @@ -3,12 +3,12 @@ import 'package:core/presentation/extensions/color_extension.dart'; import 'package:core/presentation/resources/image_paths.dart'; import 'package:core/presentation/utils/style_utils.dart'; import 'package:dropdown_button2/dropdown_button2.dart'; -import 'package:enough_html_editor/enough_html_editor.dart' as enough_html_editor; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:get/get.dart'; import 'package:jmap_dart_client/jmap/identities/identity.dart'; import 'package:pointer_interceptor/pointer_interceptor.dart'; +import 'package:rich_text_composer/rich_text_composer.dart' as rich_text_composer; import 'package:rule_filter/rule_filter/rule_condition.dart' as rule_condition; import 'package:tmail_ui_user/features/composer/presentation/model/font_name_type.dart'; import 'package:tmail_ui_user/features/manage_account/presentation/language_and_region/extensions/locale_extension.dart'; @@ -54,7 +54,7 @@ class DropDownButtonWidget extends StatelessWidget { @override Widget build(BuildContext context) { - final _imagePaths = Get.find(); + final imagePaths = Get.find(); return DropdownButtonHideUnderline( child: PointerInterceptor( @@ -91,7 +91,7 @@ class DropDownButtonWidget extends StatelessWidget { overflow: CommonTextStyle.defaultTextOverFlow, )), if (supportSelectionIcon && item == itemSelected) - SvgPicture.asset(_imagePaths.icChecked, + SvgPicture.asset(imagePaths.icChecked, width: sizeIconChecked, height: sizeIconChecked, fit: BoxFit.fill) @@ -125,13 +125,13 @@ class DropDownButtonWidget extends StatelessWidget { softWrap: CommonTextStyle.defaultSoftWrap, overflow: CommonTextStyle.defaultTextOverFlow, )), - iconArrowDown ?? SvgPicture.asset(_imagePaths.icDropDown) + iconArrowDown ?? SvgPicture.asset(imagePaths.icDropDown) ]), ), ) : null, onChanged: onChanged, - icon: iconArrowDown ?? SvgPicture.asset(_imagePaths.icDropDown), + icon: iconArrowDown ?? SvgPicture.asset(imagePaths.icDropDown), buttonPadding: const EdgeInsets.symmetric(horizontal: 12), buttonDecoration: BoxDecoration( borderRadius: BorderRadius.circular(radiusButton), @@ -173,7 +173,7 @@ class DropDownButtonWidget extends StatelessWidget { if (item is FontNameType) { return item.fontFamily; } - if (item is enough_html_editor.SafeFont) { + if (item is rich_text_composer.SafeFont) { return item.name; } if (item is rule_condition.Field) { diff --git a/lib/features/base/widget/popup_item_widget.dart b/lib/features/base/widget/popup_item_widget.dart index c16d87dd7..3407236ca 100644 --- a/lib/features/base/widget/popup_item_widget.dart +++ b/lib/features/base/widget/popup_item_widget.dart @@ -1,4 +1,5 @@ +import 'package:core/core.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:pointer_interceptor/pointer_interceptor.dart'; @@ -40,7 +41,7 @@ class PopupItemWidget extends StatelessWidget { width: iconSize ?? 20, height: iconSize ?? 20, fit: BoxFit.fill, - color: colorIcon + colorFilter: colorIcon.asFilter() ), const SizedBox(width: 12), Expanded(child: Text( diff --git a/lib/features/caching/config/hive_cache_config.dart b/lib/features/caching/config/hive_cache_config.dart index e9e2e9670..1bacbf05d 100644 --- a/lib/features/caching/config/hive_cache_config.dart +++ b/lib/features/caching/config/hive_cache_config.dart @@ -133,7 +133,7 @@ class HiveCacheConfig { ); registerCacheAdapter( FCMSubscriptionCacheAdapter(), - CachingConstants.FCM_SUBSCRIPTION_HIVE_CACHE_INDENTITY + CachingConstants.FCM_SUBSCRIPTION_HIVE_CACHE_IDENTITY ); } diff --git a/lib/features/caching/hive_cache_version_client.dart b/lib/features/caching/hive_cache_version_client.dart index fa2cdb534..6ae63c667 100644 --- a/lib/features/caching/hive_cache_version_client.dart +++ b/lib/features/caching/hive_cache_version_client.dart @@ -17,17 +17,13 @@ class HiveCacheVersionClient extends CacheVersionClient { return Future.sync(() { final latestVersion = _sharedPreferences.getInt(versionKey); return latestVersion; - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future storeVersion(int newVersion) { return Future.sync(() async { return await _sharedPreferences.setInt(versionKey, newVersion); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } } \ No newline at end of file diff --git a/lib/features/caching/utils/caching_constants.dart b/lib/features/caching/utils/caching_constants.dart index 9235ddcc6..c550213d0 100644 --- a/lib/features/caching/utils/caching_constants.dart +++ b/lib/features/caching/utils/caching_constants.dart @@ -13,5 +13,5 @@ class CachingConstants { static const int AUTHENTICATION_INFO_HIVE_CACHE_IDENTIFY = 11; static const int RECENT_LOGIN_URL_HIVE_CACHE_IDENTITY = 12; static const int RECENT_LOGIN_USERNAME_HIVE_CACHE_IDENTITY = 13; - static const int FCM_SUBSCRIPTION_HIVE_CACHE_INDENTITY = 14; + static const int FCM_SUBSCRIPTION_HIVE_CACHE_IDENTITY = 14; } \ No newline at end of file diff --git a/lib/features/cleanup/data/datasource_impl/cleanup_datasource_impl.dart b/lib/features/cleanup/data/datasource_impl/cleanup_datasource_impl.dart index 19a6ebcfc..73117d5f0 100644 --- a/lib/features/cleanup/data/datasource_impl/cleanup_datasource_impl.dart +++ b/lib/features/cleanup/data/datasource_impl/cleanup_datasource_impl.dart @@ -30,35 +30,27 @@ class CleanupDataSourceImpl extends CleanupDataSource { Future cleanEmailCache(EmailCleanupRule cleanupRule) { return Future.sync(() async { return await emailCacheManager.clean(cleanupRule); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future cleanRecentSearchCache(RecentSearchCleanupRule cleanupRule) { return Future.sync(() async { return await recentSearchCacheManager.clean(cleanupRule); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future cleanRecentLoginUrlCache(RecentLoginUrlCleanupRule cleanupRule) { return Future.sync(() async { return await recentLoginUrlCacheManager.clean(cleanupRule); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future cleanRecentLoginUsernameCache(RecentLoginUsernameCleanupRule cleanupRule) { return Future.sync(() async { return await recentLoginUsernameCacheManager.clean(cleanupRule); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } } \ No newline at end of file diff --git a/lib/features/composer/data/datasource_impl/composer_datasource_impl.dart b/lib/features/composer/data/datasource_impl/composer_datasource_impl.dart index b85641518..2575533da 100644 --- a/lib/features/composer/data/datasource_impl/composer_datasource_impl.dart +++ b/lib/features/composer/data/datasource_impl/composer_datasource_impl.dart @@ -30,8 +30,6 @@ class ComposerDataSourceImpl extends ComposerDataSource { bytesData: fileInfo.bytes, maxWidth: maxWidth, compress: compress); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } } \ No newline at end of file diff --git a/lib/features/composer/data/datasource_impl/contact_datasource_impl.dart b/lib/features/composer/data/datasource_impl/contact_datasource_impl.dart index 1034076c1..be1945044 100644 --- a/lib/features/composer/data/datasource_impl/contact_datasource_impl.dart +++ b/lib/features/composer/data/datasource_impl/contact_datasource_impl.dart @@ -25,9 +25,7 @@ class ContactDataSourceImpl extends ContactDataSource { return []; } } - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } List _toDeviceContact(contact_service.Contact contact) { diff --git a/lib/features/composer/presentation/composer_controller.dart b/lib/features/composer/presentation/composer_controller.dart index ffc3ac15d..9c9bd91c9 100644 --- a/lib/features/composer/presentation/composer_controller.dart +++ b/lib/features/composer/presentation/composer_controller.dart @@ -291,13 +291,11 @@ class ComposerController extends BaseController { void _listenWorker() { uploadInlineImageWorker = ever(uploadController.uploadInlineViewState, (state) { log('ComposerController::_listenWorker(): $state'); - if (state is Either) { - state.fold((failure) => null, (success) { - if (success is SuccessAttachmentUploadState) { - _handleUploadInlineSuccess(success); - } - }); - } + state.fold((failure) => null, (success) { + if (success is SuccessAttachmentUploadState) { + _handleUploadInlineSuccess(success); + } + }); }); } @@ -916,7 +914,10 @@ class ComposerController extends BaseController { ) async { final newEmailBody = await _getEmailBodyText(context, changedEmail: true); log('ComposerController::_isEmailChanged(): newEmailBody: $newEmailBody'); - var oldEmailBody = getContentEmail(context) ?? ''; + var oldEmailBody = ''; + if (context.mounted) { + oldEmailBody = getContentEmail(context) ?? ''; + } log('ComposerController::_isEmailChanged(): getContentEmail: $oldEmailBody'); if (arguments.emailActionType != EmailActionType.compose && oldEmailBody.isNotEmpty) { @@ -974,7 +975,7 @@ class ComposerController extends BaseController { if (arguments != null && userProfile != null && accountId != null) { final isChanged = await _isEmailChanged(context, arguments); - if (isChanged) { + if (isChanged && context.mounted) { final newEmail = await _generateEmail( context, userProfile, diff --git a/lib/features/composer/presentation/controller/rich_text_mobile_tablet_controller.dart b/lib/features/composer/presentation/controller/rich_text_mobile_tablet_controller.dart index 7e321968a..642bf991b 100644 --- a/lib/features/composer/presentation/controller/rich_text_mobile_tablet_controller.dart +++ b/lib/features/composer/presentation/controller/rich_text_mobile_tablet_controller.dart @@ -1,5 +1,6 @@ -import 'package:core/core.dart'; -import 'package:enough_html_editor/enough_html_editor.dart'; + +import 'package:core/utils/app_logger.dart'; +import 'package:rich_text_composer/rich_text_composer.dart'; import 'package:tmail_ui_user/features/composer/presentation/controller/base_rich_text_controller.dart'; import 'package:tmail_ui_user/features/composer/presentation/model/header_style_type.dart'; import 'package:tmail_ui_user/features/composer/presentation/model/image_source.dart'; diff --git a/lib/features/composer/presentation/mixin/rich_text_button_mixin.dart b/lib/features/composer/presentation/mixin/rich_text_button_mixin.dart index 97531131c..484c277cf 100644 --- a/lib/features/composer/presentation/mixin/rich_text_button_mixin.dart +++ b/lib/features/composer/presentation/mixin/rich_text_button_mixin.dart @@ -96,9 +96,9 @@ mixin RichTextButtonMixin { return buildIconWeb( icon: SvgPicture.asset( path, - color: isSelected == true - ? Colors.black.withOpacity(opacity) - : AppColor.colorDefaultRichTextButton.withOpacity(opacity), + colorFilter: isSelected == true + ? Colors.black.withOpacity(opacity).asFilter() + : AppColor.colorDefaultRichTextButton.withOpacity(opacity).asFilter(), fit: BoxFit.fill), iconPadding: const EdgeInsets.all(4), colorFocus: Colors.white, @@ -120,12 +120,14 @@ mixin RichTextButtonMixin { return tooltip?.isNotEmpty == true ? Tooltip( - child: SvgPicture.asset(path, - color: newColor?.withOpacity(opacity), - fit: BoxFit.fill), - message: tooltip) - : SvgPicture.asset(path, - color: newColor?.withOpacity(opacity), + message: tooltip, + child: SvgPicture.asset( + path, + colorFilter: newColor?.withOpacity(opacity).asFilter(), + fit: BoxFit.fill)) + : SvgPicture.asset( + path, + colorFilter: newColor?.withOpacity(opacity).asFilter(), fit: BoxFit.fill); } @@ -138,9 +140,10 @@ mixin RichTextButtonMixin { ? AppColor.colorDefaultRichTextButton : color; - return SvgPicture.asset(path, - color: newColor?.withOpacity(opacity), - fit: BoxFit.fill); + return SvgPicture.asset( + path, + colorFilter: newColor?.withOpacity(opacity).asFilter(), + fit: BoxFit.fill); } Widget buildIconColorBackgroundTextWithoutTooltip({ @@ -166,10 +169,10 @@ mixin RichTextButtonMixin { ? AppColor.colorDefaultRichTextButton : colorSelected; return Tooltip( + message: tooltip, child: Icon(iconData, color: (newColor ?? AppColor.colorDefaultRichTextButton).withOpacity(opacity), size: 20), - message: tooltip, ); } @@ -223,9 +226,10 @@ mixin RichTextButtonMixin { DropDownMenuHeaderStyleWidget( icon: buildWrapIconStyleText( isSelected: richTextController.isMenuHeaderStyleOpen, - icon: SvgPicture.asset(RichTextStyleType.headerStyle.getIcon(_imagePaths), - color: AppColor.colorDefaultRichTextButton, - fit: BoxFit.fill), + icon: SvgPicture.asset( + RichTextStyleType.headerStyle.getIcon(_imagePaths), + colorFilter: AppColor.colorDefaultRichTextButton.asFilter(), + fit: BoxFit.fill), padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 5), tooltip: RichTextStyleType.headerStyle.getTooltipButton(context) ), diff --git a/lib/features/composer/presentation/widgets/toolbar_rich_text_builder.dart b/lib/features/composer/presentation/widgets/toolbar_rich_text_builder.dart index f55eb20c6..f6ff4c944 100644 --- a/lib/features/composer/presentation/widgets/toolbar_rich_text_builder.dart +++ b/lib/features/composer/presentation/widgets/toolbar_rich_text_builder.dart @@ -47,9 +47,10 @@ class ToolbarRichTextWebBuilder extends StatelessWidget with RichTextButtonMixin child: DropDownMenuHeaderStyleWidget( icon: buildWrapIconStyleText( isSelected: richTextWebController.isMenuHeaderStyleOpen, - icon: SvgPicture.asset(RichTextStyleType.headerStyle.getIcon(_imagePaths), - color: AppColor.colorDefaultRichTextButton.withOpacity(opacity), - fit: BoxFit.fill), + icon: SvgPicture.asset( + RichTextStyleType.headerStyle.getIcon(_imagePaths), + colorFilter: AppColor.colorDefaultRichTextButton.withOpacity(opacity).asFilter(), + fit: BoxFit.fill), padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 5), tooltip: RichTextStyleType.headerStyle.getTooltipButton(context) ), diff --git a/lib/features/contact/presentation/widgets/app_bar_contact_widget.dart b/lib/features/contact/presentation/widgets/app_bar_contact_widget.dart index 0a8b832ea..b823e84fc 100644 --- a/lib/features/contact/presentation/widgets/app_bar_contact_widget.dart +++ b/lib/features/contact/presentation/widgets/app_bar_contact_widget.dart @@ -24,11 +24,12 @@ class AppBarContactWidget extends StatelessWidget { Positioned( left: 0, child: buildIconWeb( - icon: SvgPicture.asset(_imagePaths.icCloseComposer, - color: AppColor.colorCloseButton, - width: 24, - height: 24, - fit: BoxFit.fill), + icon: SvgPicture.asset( + _imagePaths.icCloseComposer, + colorFilter: AppColor.colorCloseButton.asFilter(), + width: 24, + height: 24, + fit: BoxFit.fill), minSize: 25, iconSize: 25, iconPadding: const EdgeInsets.all(5), diff --git a/lib/features/contact/presentation/widgets/contact_input_tag_item.dart b/lib/features/contact/presentation/widgets/contact_input_tag_item.dart index a7ec96f0f..1729019f2 100644 --- a/lib/features/contact/presentation/widgets/contact_input_tag_item.dart +++ b/lib/features/contact/presentation/widgets/contact_input_tag_item.dart @@ -59,7 +59,7 @@ class ContactInputTagItem extends StatelessWidget { imagePaths.icClose, width: 20, height: 20, - color: AppColor.colorDeleteContactIcon, + colorFilter: AppColor.colorDeleteContactIcon.asFilter(), fit: BoxFit.fill) : null, labelStyle: const TextStyle(color: Colors.black, fontSize: 14, fontWeight: FontWeight.normal), diff --git a/lib/features/destination_picker/presentation/destination_picker_controller.dart b/lib/features/destination_picker/presentation/destination_picker_controller.dart index ced73608c..8ffcdc08c 100644 --- a/lib/features/destination_picker/presentation/destination_picker_controller.dart +++ b/lib/features/destination_picker/presentation/destination_picker_controller.dart @@ -325,7 +325,7 @@ class DestinationPickerController extends BaseMailboxController { _imagePaths.icNotConnection, width: 24, height: 24, - color: Colors.white, + colorFilter: Colors.white.asFilter(), fit: BoxFit.fill), backgroundColor: AppColor.toastErrorBackgroundColor, textColor: Colors.white, @@ -371,7 +371,7 @@ class DestinationPickerController extends BaseMailboxController { _imagePaths.icNotConnection, width: 24, height: 24, - color: Colors.white, + colorFilter: Colors.white.asFilter(), fit: BoxFit.fill), backgroundColor: AppColor.toastErrorBackgroundColor, textColor: Colors.white, @@ -416,7 +416,7 @@ class DestinationPickerController extends BaseMailboxController { _imagePaths.icNotConnection, width: 24, height: 24, - color: Colors.white, + colorFilter: Colors.white.asFilter(), fit: BoxFit.fill), backgroundColor: AppColor.toastErrorBackgroundColor, textColor: Colors.white, diff --git a/lib/features/destination_picker/presentation/destination_picker_view.dart b/lib/features/destination_picker/presentation/destination_picker_view.dart index bd507e4a0..2a0ceece6 100644 --- a/lib/features/destination_picker/presentation/destination_picker_view.dart +++ b/lib/features/destination_picker/presentation/destination_picker_view.dart @@ -536,7 +536,10 @@ class DestinationPickerView extends GetWidget child: Row( children: [ Padding(padding: const EdgeInsets.only(left: 5), child: buildIconWeb( - icon: SvgPicture.asset(_imagePaths.icBack, color: AppColor.colorTextButton, fit: BoxFit.fill), + icon: SvgPicture.asset( + _imagePaths.icBack, + colorFilter: AppColor.colorTextButton.asFilter(), + fit: BoxFit.fill), onTap: () => controller.disableSearch(context))), Expanded(child: (SearchAppBarWidget( _imagePaths, diff --git a/lib/features/destination_picker/presentation/widgets/top_bar_destination_picker_builder.dart b/lib/features/destination_picker/presentation/widgets/top_bar_destination_picker_builder.dart index 5bda8da73..ebaaa5306 100644 --- a/lib/features/destination_picker/presentation/widgets/top_bar_destination_picker_builder.dart +++ b/lib/features/destination_picker/presentation/widgets/top_bar_destination_picker_builder.dart @@ -94,7 +94,7 @@ class TopBarDestinationPickerBuilder extends StatelessWidget { _imagePaths.icBack, width: 14, height: 14, - color: AppColor.primaryColor, + colorFilter: AppColor.primaryColor.asFilter(), fit: BoxFit.fill), const SizedBox(width: 5), Text( @@ -117,67 +117,4 @@ class TopBarDestinationPickerBuilder extends StatelessWidget { ), ); } - - Widget _buildIconCreateButton(BuildContext context) { - return buildIconWeb( - iconSize: 24, - colorSelected: Colors.white, - splashRadius: 15, - iconPadding: const EdgeInsets.all(3), - icon: SvgPicture.asset( - _imagePaths.icCreateNewFolder, - color: mailboxIdDestination != null - ? AppColor.colorTextButton - : AppColor.colorDisableMailboxCreateButton, - fit: BoxFit.fill), - tooltip: AppLocalizations.of(context).create, - onTap: onOpenCreateNewMailboxScreenAction - ); - } - - Widget _buildDoneButton(BuildContext context) { - return Material( - color: Colors.transparent, - child: InkWell( - customBorder: const RoundedRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(8))), - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 8, - horizontal: 8), - child: Text( - AppLocalizations.of(context).done, - style: TextStyle( - fontSize: 15, - color: mailboxIdDestination != null - ? AppColor.colorTextButton - : AppColor.colorDisableMailboxCreateButton))), - onTap: onSelectedMailboxDestinationAction - ) - ); - } - - Widget _buildSaveButton(BuildContext context) { - return Material( - color: Colors.transparent, - child: InkWell( - customBorder: const RoundedRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(8))), - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 8, - horizontal: 8), - child: Text( - AppLocalizations.of(context).save, - style: TextStyle( - fontSize: 15, - color: isCreateMailboxValidated - ? AppColor.colorTextButton - : AppColor.colorDisableMailboxCreateButton) - ) - ), - onTap: isCreateMailboxValidated ? onCreateNewMailboxAction : null - ) - ); - } } \ No newline at end of file diff --git a/lib/features/email/data/datasource_impl/email_datasource_impl.dart b/lib/features/email/data/datasource_impl/email_datasource_impl.dart index 0339c4770..b42b6ae9a 100644 --- a/lib/features/email/data/datasource_impl/email_datasource_impl.dart +++ b/lib/features/email/data/datasource_impl/email_datasource_impl.dart @@ -27,27 +27,21 @@ class EmailDataSourceImpl extends EmailDataSource { Future getEmailContent(AccountId accountId, EmailId emailId) { return Future.sync(() async { return await emailAPI.getEmailContent(accountId, emailId); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future sendEmail(AccountId accountId, EmailRequest emailRequest, {CreateNewMailboxRequest? mailboxRequest}) { return Future.sync(() async { return await emailAPI.sendEmail(accountId, emailRequest, mailboxRequest: mailboxRequest); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future> markAsRead(AccountId accountId, List emails, ReadActions readActions) { return Future.sync(() async { return await emailAPI.markAsRead(accountId, emails, readActions); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override @@ -59,9 +53,7 @@ class EmailDataSourceImpl extends EmailDataSource { ) { return Future.sync(() async { return await emailAPI.downloadAttachments(attachments, accountId, baseDownloadUrl, accountRequest); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override @@ -74,54 +66,42 @@ class EmailDataSourceImpl extends EmailDataSource { ) { return Future.sync(() async { return await emailAPI.exportAttachment(attachment, accountId, baseDownloadUrl, accountRequest, cancelToken); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future> moveToMailbox(AccountId accountId, MoveToMailboxRequest moveRequest) { return Future.sync(() async { return await emailAPI.moveToMailbox(accountId, moveRequest); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future> markAsStar(AccountId accountId, List emails, MarkStarAction markStarAction) { return Future.sync(() async { return await emailAPI.markAsStar(accountId, emails, markStarAction); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future saveEmailAsDrafts(AccountId accountId, Email email) { return Future.sync(() async { return await emailAPI.saveEmailAsDrafts(accountId, email); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future removeEmailDrafts(AccountId accountId, EmailId emailId) { return Future.sync(() async { return await emailAPI.removeEmailDrafts(accountId, emailId); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future updateEmailDrafts(AccountId accountId, Email newEmail, EmailId oldEmailId) { return Future.sync(() async { return await emailAPI.updateEmailDrafts(accountId, newEmail, oldEmailId); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override @@ -141,26 +121,20 @@ class EmailDataSourceImpl extends EmailDataSource { baseDownloadUrl, accountRequest, onReceiveController); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future> deleteMultipleEmailsPermanently(AccountId accountId, List emailIds) { return Future.sync(() async { return await emailAPI.deleteMultipleEmailsPermanently(accountId, emailIds); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future deleteEmailPermanently(AccountId accountId, EmailId emailId) { return Future.sync(() async { return await emailAPI.deleteEmailPermanently(accountId, emailId); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } } \ No newline at end of file diff --git a/lib/features/email/data/datasource_impl/html_datasource_impl.dart b/lib/features/email/data/datasource_impl/html_datasource_impl.dart index 11b557cbe..4ae646578 100644 --- a/lib/features/email/data/datasource_impl/html_datasource_impl.dart +++ b/lib/features/email/data/datasource_impl/html_datasource_impl.dart @@ -19,17 +19,13 @@ class HtmlDataSourceImpl extends HtmlDataSource { ) { return Future.sync(() async { return await _htmlAnalyzer.transformEmailContent(emailContent, mapUrlDownloadCID, _dioClient); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future addTooltipWhenHoverOnLink(EmailContent emailContent) { return Future.sync(() async { return await _htmlAnalyzer.addTooltipWhenHoverOnLink(emailContent); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } } \ No newline at end of file diff --git a/lib/features/email/data/datasource_impl/mdn_datasource_impl.dart b/lib/features/email/data/datasource_impl/mdn_datasource_impl.dart index efe664086..fc23d9d4a 100644 --- a/lib/features/email/data/datasource_impl/mdn_datasource_impl.dart +++ b/lib/features/email/data/datasource_impl/mdn_datasource_impl.dart @@ -18,8 +18,6 @@ class MdnDataSourceImpl extends MdnDataSource { Future sendReceiptToSender(AccountId accountId, SendReceiptToSenderRequest request) { return Future.sync(() async { return await _mdnAPI.sendReceiptToSender(accountId, request); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } } \ No newline at end of file diff --git a/lib/features/email/presentation/email_view.dart b/lib/features/email/presentation/email_view.dart index 90769534e..b3f506220 100644 --- a/lib/features/email/presentation/email_view.dart +++ b/lib/features/email/presentation/email_view.dart @@ -192,9 +192,9 @@ class EmailView extends GetWidget { buildIconWeb( icon: SvgPicture.asset( imagePaths.icNewer, - color: controller.emailSupervisorController.nextEmailActivated - ? AppColor.primaryColor - : AppColor.colorAttachmentIcon, + colorFilter: controller.emailSupervisorController.nextEmailActivated + ? AppColor.primaryColor.asFilter() + : AppColor.colorAttachmentIcon.asFilter(), width: IconUtils.defaultIconSize, height: IconUtils.defaultIconSize, fit: BoxFit.fill), @@ -205,9 +205,9 @@ class EmailView extends GetWidget { imagePaths.icOlder, width: IconUtils.defaultIconSize, height: IconUtils.defaultIconSize, - color: controller.emailSupervisorController.previousEmailActivated - ? AppColor.primaryColor - : AppColor.colorAttachmentIcon, + colorFilter: controller.emailSupervisorController.previousEmailActivated + ? AppColor.primaryColor.asFilter() + : AppColor.colorAttachmentIcon.asFilter(), fit: BoxFit.fill), tooltip: AppLocalizations.of(context).older, onTap: controller.emailSupervisorController.backToPreviousEmail), @@ -341,7 +341,7 @@ class EmailView extends GetWidget { SvgPicture.asset(imagePaths.icAttachment, width: 20, height: 20, - color: AppColor.colorAttachmentIcon, + colorFilter: AppColor.colorAttachmentIcon.asFilter(), fit: BoxFit.fill), const SizedBox(width: 5), Expanded(child: Text( @@ -472,7 +472,7 @@ class EmailView extends GetWidget { width: 24, height: 24, fit: BoxFit.fill, - color: AppColor.colorTextButton + colorFilter: AppColor.colorTextButton.asFilter() ), AppLocalizations.of(context).mark_as_unread, email, @@ -500,7 +500,7 @@ class EmailView extends GetWidget { width: 24, height: 24, fit: BoxFit.fill, - color: AppColor.colorTextButton + colorFilter: AppColor.colorTextButton.asFilter() ), currentMailbox?.isSpam == true ? AppLocalizations.of(context).remove_from_spam @@ -528,7 +528,7 @@ class EmailView extends GetWidget { width: 24, height: 24, fit: BoxFit.fill, - color: AppColor.colorTextButton), + colorFilter: AppColor.colorTextButton.asFilter()), AppLocalizations.of(context).quickCreatingRule, email, iconLeftPadding: responsiveUtils.isMobile(context) diff --git a/lib/features/email/presentation/widgets/app_bar_mail_widget_builder.dart b/lib/features/email/presentation/widgets/app_bar_mail_widget_builder.dart index 3587cc63b..0bef5d1c9 100644 --- a/lib/features/email/presentation/widgets/app_bar_mail_widget_builder.dart +++ b/lib/features/email/presentation/widgets/app_bar_mail_widget_builder.dart @@ -62,7 +62,7 @@ class AppBarMailWidgetBuilder extends StatelessWidget { _imagePaths.icBack, width: 14, height: 14, - color: AppColor.colorTextButton, + colorFilter: AppColor.colorTextButton.asFilter(), fit: BoxFit.fill), if (!isSearchIsRunning) Container( @@ -134,9 +134,9 @@ class AppBarMailWidgetBuilder extends StatelessWidget { buildIconWeb( icon: SvgPicture.asset( _imagePaths.icDeleteComposer, - color: mailboxContain?.isTrash == false - ? AppColor.colorTextButton - : AppColor.colorDeletePermanentlyButton, + colorFilter: mailboxContain?.isTrash == false + ? AppColor.colorTextButton.asFilter() + : AppColor.colorDeletePermanentlyButton.asFilter(), width: BuildUtils.isWeb ? 18 : 20, height: BuildUtils.isWeb ? 18 : 20, fit: BoxFit.fill), diff --git a/lib/features/email/presentation/widgets/attachment_file_tile_builder.dart b/lib/features/email/presentation/widgets/attachment_file_tile_builder.dart index 40fd78531..cd5953597 100644 --- a/lib/features/email/presentation/widgets/attachment_file_tile_builder.dart +++ b/lib/features/email/presentation/widgets/attachment_file_tile_builder.dart @@ -89,7 +89,7 @@ class AttachmentFileTileBuilder extends StatelessWidget{ imagePaths.icDownloadAttachment, width: 24, height: 24, - color: AppColor.primaryColor, + colorFilter: AppColor.primaryColor.asFilter(), fit: BoxFit.fill), onTap: () => onDownloadAttachmentFileActionClick?.call(_attachment) ), diff --git a/lib/features/identity_creator/presentation/identity_creator_controller.dart b/lib/features/identity_creator/presentation/identity_creator_controller.dart index 144444d55..d47c9fac5 100644 --- a/lib/features/identity_creator/presentation/identity_creator_controller.dart +++ b/lib/features/identity_creator/presentation/identity_creator_controller.dart @@ -15,7 +15,7 @@ import 'package:jmap_dart_client/jmap/core/unsigned_int.dart'; import 'package:jmap_dart_client/jmap/identities/identity.dart'; import 'package:jmap_dart_client/jmap/mail/email/email_address.dart'; import 'package:model/model.dart'; -import 'package:rich_text_composer/richtext_controller.dart'; +import 'package:rich_text_composer/rich_text_composer.dart'; import 'package:tmail_ui_user/features/base/base_controller.dart'; import 'package:tmail_ui_user/features/composer/presentation/controller/rich_text_web_controller.dart'; import 'package:tmail_ui_user/features/identity_creator/presentation/model/identity_creator_arguments.dart'; diff --git a/lib/features/identity_creator/presentation/identity_creator_view.dart b/lib/features/identity_creator/presentation/identity_creator_view.dart index 6dddfd516..cb6de4b2a 100644 --- a/lib/features/identity_creator/presentation/identity_creator_view.dart +++ b/lib/features/identity_creator/presentation/identity_creator_view.dart @@ -1,15 +1,13 @@ import 'dart:math'; import 'package:core/core.dart'; -import 'package:enough_html_editor/enough_html_editor.dart' as html_editor_mobile; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:get/get.dart'; import 'package:html_editor_enhanced/html_editor.dart' as html_editor_browser; -import 'package:html_editor_enhanced/html_editor.dart'; import 'package:jmap_dart_client/jmap/mail/email/email_address.dart'; import 'package:pointer_interceptor/pointer_interceptor.dart'; -import 'package:rich_text_composer/views/keyboard_richtext.dart'; +import 'package:rich_text_composer/rich_text_composer.dart'; import 'package:rich_text_composer/views/widgets/rich_text_keyboard_toolbar.dart'; import 'package:tmail_ui_user/features/composer/presentation/widgets/toolbar_rich_text_builder.dart'; import 'package:tmail_ui_user/features/identity_creator/presentation/identity_creator_controller.dart'; @@ -374,7 +372,11 @@ class IdentityCreatorView extends GetWidget { Positioned(top: 2, right: 8, child: buildIconWeb( iconSize: 24, - icon: SvgPicture.asset(_imagePaths.icComposerClose, fit: BoxFit.fill, color: AppColor.colorDeleteContactIcon), + icon: SvgPicture.asset( + _imagePaths.icComposerClose, + fit: BoxFit.fill, + colorFilter: AppColor.colorDeleteContactIcon.asFilter() + ), tooltip: AppLocalizations.of(context).close, onTap: () => controller.closeView(context))) ] @@ -405,16 +407,16 @@ class IdentityCreatorView extends GetWidget { child: html_editor_browser.HtmlEditor( key: const Key('identity_create_editor_web'), controller: controller.richTextWebController.editorController, - htmlEditorOptions: const HtmlEditorOptions( + htmlEditorOptions: const html_editor_browser.HtmlEditorOptions( hint: '', darkMode: false, customBodyCssStyle: bodyCssStyleForEditor), blockQuotedContent: initContent, - htmlToolbarOptions: const HtmlToolbarOptions( - toolbarType: ToolbarType.hide, + htmlToolbarOptions: const html_editor_browser.HtmlToolbarOptions( + toolbarType: html_editor_browser.ToolbarType.hide, defaultToolbarButtons: []), - otherOptions: const OtherOptions(height: 150), - callbacks: Callbacks(onBeforeCommand: (currentHtml) { + otherOptions: const html_editor_browser.OtherOptions(height: 150), + callbacks: html_editor_browser.Callbacks(onBeforeCommand: (currentHtml) { log('IdentityCreatorView::_buildHtmlEditorWeb(): onBeforeCommand : $currentHtml'); controller.updateContentHtmlEditor(currentHtml); }, onChangeContent: (changed) { @@ -445,7 +447,7 @@ class IdentityCreatorView extends GetWidget { Widget _buildHtmlEditor(BuildContext context, {String? initialContent}) { return Padding( padding: const EdgeInsets.all(16), - child: html_editor_mobile.HtmlEditor( + child: HtmlEditor( key: controller.htmlKey, minHeight: controller.htmlEditorMinHeight, addDefaultSelectionMenuItems: false, diff --git a/lib/features/login/data/datasource_impl/authentication_oidc_datasource_impl.dart b/lib/features/login/data/datasource_impl/authentication_oidc_datasource_impl.dart index 93b3a6825..583fccc72 100644 --- a/lib/features/login/data/datasource_impl/authentication_oidc_datasource_impl.dart +++ b/lib/features/login/data/datasource_impl/authentication_oidc_datasource_impl.dart @@ -27,63 +27,49 @@ class AuthenticationOIDCDataSourceImpl extends AuthenticationOIDCDataSource { return Future.sync(() async { final oidcResponse = await _oidcHttpClient.checkOIDCIsAvailable(oidcRequest); return oidcResponse!; - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future getOIDCConfiguration(OIDCResponse oidcResponse) { return Future.sync(() async { return await _oidcHttpClient.getOIDCConfiguration(oidcResponse); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future getTokenOIDC(String clientId, String redirectUrl, String discoveryUrl, List scopes) { return Future.sync(() async { return await _authenticationClient.getTokenOIDC(clientId, redirectUrl, discoveryUrl, scopes); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future getStoredTokenOIDC(String tokenIdHash) { return Future.sync(() async { return await _tokenOidcCacheManager.getTokenOidc(tokenIdHash); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future persistTokenOIDC(TokenOIDC tokenOidc) { return Future.sync(() async { return await _tokenOidcCacheManager.persistOneTokenOidc(tokenOidc); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future getStoredOidcConfiguration() { return Future.sync(() async { return await _oidcConfigurationCacheManager.getOidcConfiguration(); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future persistAuthorityOidc(String authority) { return Future.sync(() async { return await _oidcConfigurationCacheManager.persistAuthorityOidc(authority); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override @@ -101,27 +87,21 @@ class AuthenticationOIDCDataSourceImpl extends AuthenticationOIDCDataSource { discoveryUrl, scopes, refreshToken); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future logout(TokenId tokenId, OIDCConfiguration config) { return Future.sync(() async { return await _authenticationClient.logoutOidc(tokenId, config); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future deleteAuthorityOidc() { return Future.sync(() async { return await _oidcConfigurationCacheManager.deleteAuthorityOidc(); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override @@ -137,26 +117,20 @@ class AuthenticationOIDCDataSourceImpl extends AuthenticationOIDCDataSource { redirectUrl, discoveryUrl, scopes); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future getAuthenticationInfo() { return Future.sync(() async { return await _authenticationClient.getAuthenticationInfo(); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future deleteTokenOIDC() { return Future.sync(() async { return await _tokenOidcCacheManager.deleteTokenOidc(); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } } \ No newline at end of file diff --git a/lib/features/login/data/datasource_impl/hive_account_datasource_impl.dart b/lib/features/login/data/datasource_impl/hive_account_datasource_impl.dart index e18ab99e0..2cfb06ab9 100644 --- a/lib/features/login/data/datasource_impl/hive_account_datasource_impl.dart +++ b/lib/features/login/data/datasource_impl/hive_account_datasource_impl.dart @@ -14,26 +14,20 @@ class HiveAccountDatasourceImpl extends AccountDatasource { Future getCurrentAccount() { return Future.sync(() async { return await _accountCacheManager.getSelectedAccount(); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future setCurrentAccount(Account newCurrentAccount) { return Future.sync(() async { return await _accountCacheManager.setSelectedAccount(newCurrentAccount); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future deleteCurrentAccount(String accountId) { return Future.sync(() async { return await _accountCacheManager.deleteSelectedAccount(accountId); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } } \ No newline at end of file diff --git a/lib/features/login/data/datasource_impl/login_url_datasource_impl.dart b/lib/features/login/data/datasource_impl/login_url_datasource_impl.dart index b30bb9d20..f6282c770 100644 --- a/lib/features/login/data/datasource_impl/login_url_datasource_impl.dart +++ b/lib/features/login/data/datasource_impl/login_url_datasource_impl.dart @@ -24,9 +24,7 @@ class LoginUrlDataSourceImpl implements LoginUrlDataSource { recentLoginUrl.url, recentLoginUrl.toRecentLoginUrlCache()); } - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override @@ -46,9 +44,7 @@ class LoginUrlDataSourceImpl implements LoginUrlDataSource { : listRecentUrl; return newListRecentSUrl; - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } bool _filterRecentUrlCache(RecentLoginUrlCache recentLoginUrlCache, String? pattern) { diff --git a/lib/features/login/data/datasource_impl/login_username_datasource_impl.dart b/lib/features/login/data/datasource_impl/login_username_datasource_impl.dart index d549b3e2f..f4f6e1d8c 100644 --- a/lib/features/login/data/datasource_impl/login_username_datasource_impl.dart +++ b/lib/features/login/data/datasource_impl/login_username_datasource_impl.dart @@ -28,9 +28,7 @@ class LoginUsernameDataSourceImpl implements LoginUsernameDataSource { return listValidRecentUsername.length > newLimit ? listValidRecentUsername.sublist(0, newLimit) : listValidRecentUsername; - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override @@ -44,9 +42,7 @@ class LoginUsernameDataSourceImpl implements LoginUsernameDataSource { await _recentLoginUsernameCacheClient.insertItem(recentLoginUsername.username, recentLoginUsername.toRecentLoginUsernameCache()); } - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } bool _filterRecentLoginUsernameCache( diff --git a/lib/features/login/domain/extensions/oidc_configuration_extensions.dart b/lib/features/login/domain/extensions/oidc_configuration_extensions.dart index c262e799c..099865da4 100644 --- a/lib/features/login/domain/extensions/oidc_configuration_extensions.dart +++ b/lib/features/login/domain/extensions/oidc_configuration_extensions.dart @@ -10,7 +10,7 @@ extension OidcConfigurationExtensions on OIDCConfiguration { if (AppConfig.domainRedirectUrl.endsWith('/')) { return AppConfig.domainRedirectUrl + loginRedirectOidcWeb; } else { - return AppConfig.domainRedirectUrl + '/' + loginRedirectOidcWeb; + return '${AppConfig.domainRedirectUrl}/$loginRedirectOidcWeb'; } } else { return redirectOidcMobile; @@ -22,7 +22,7 @@ extension OidcConfigurationExtensions on OIDCConfiguration { if (AppConfig.domainRedirectUrl.endsWith('/')) { return AppConfig.domainRedirectUrl + logoutRedirectOidcWeb; } else { - return AppConfig.domainRedirectUrl + '/' + logoutRedirectOidcWeb; + return '${AppConfig.domainRedirectUrl}/$logoutRedirectOidcWeb'; } } else { return redirectOidcMobile; diff --git a/lib/features/login/presentation/login_view.dart b/lib/features/login/presentation/login_view.dart index 3107738d5..2ee868ae5 100644 --- a/lib/features/login/presentation/login_view.dart +++ b/lib/features/login/presentation/login_view.dart @@ -30,8 +30,8 @@ class LoginView extends BaseLoginView { child: _supportScrollForm(context) ? Stack(children: [ Center(child: SingleChildScrollView( - child: _buildCenterForm(context), - scrollDirection: Axis.vertical)), + scrollDirection: Axis.vertical, + child: _buildCenterForm(context))), Obx(() { if (loginController.loginFormType.value == LoginFormType.credentialForm || loginController.loginFormType.value == LoginFormType.ssoForm) { @@ -128,7 +128,7 @@ class LoginView extends BaseLoginView { icon: SvgPicture.asset( imagePaths.icBack, alignment: Alignment.center, - color: AppColor.primaryColor + colorFilter: AppColor.primaryColor.asFilter() ) ), ); diff --git a/lib/features/login/presentation/widgets/login_text_input_builder.dart b/lib/features/login/presentation/widgets/login_text_input_builder.dart index 514e12465..d35bf9622 100644 --- a/lib/features/login/presentation/widgets/login_text_input_builder.dart +++ b/lib/features/login/presentation/widgets/login_text_input_builder.dart @@ -13,7 +13,6 @@ class LoginTextInputBuilder { Key? _key; String? _title; String? _hintText; - String? _labelText; String? _prefixText; SetErrorString? _setErrorString; String? _errorText; @@ -44,7 +43,6 @@ class LoginTextInputBuilder { } void labelText(String? labelText) { - _labelText = labelText; } void prefixText(String? prefixText) { diff --git a/lib/features/mailbox/data/datasource_impl/mailbox_cache_datasource_impl.dart b/lib/features/mailbox/data/datasource_impl/mailbox_cache_datasource_impl.dart index 791d03bd0..eb4a036f0 100644 --- a/lib/features/mailbox/data/datasource_impl/mailbox_cache_datasource_impl.dart +++ b/lib/features/mailbox/data/datasource_impl/mailbox_cache_datasource_impl.dart @@ -43,9 +43,7 @@ class MailboxCacheDataSourceImpl extends MailboxDataSource { Future update({List? updated, List? created, List? destroyed}) { return Future.sync(() async { return await _mailboxCacheManager.update(updated: updated, created: created, destroyed: destroyed); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override @@ -53,9 +51,7 @@ class MailboxCacheDataSourceImpl extends MailboxDataSource { return Future.sync(() async { final listMailboxes = await _mailboxCacheManager.getAllMailbox(); return listMailboxes; - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override diff --git a/lib/features/mailbox/data/datasource_impl/mailbox_datasource_impl.dart b/lib/features/mailbox/data/datasource_impl/mailbox_datasource_impl.dart index 3b3ca0fca..f99ac8a69 100644 --- a/lib/features/mailbox/data/datasource_impl/mailbox_datasource_impl.dart +++ b/lib/features/mailbox/data/datasource_impl/mailbox_datasource_impl.dart @@ -35,18 +35,14 @@ class MailboxDataSourceImpl extends MailboxDataSource { Future getAllMailbox(Session session, AccountId accountId, {Properties? properties}) { return Future.sync(() async { return await mailboxAPI.getAllMailbox(session, accountId, properties: properties); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future getChanges(Session session, AccountId accountId, State sinceState) { return Future.sync(() async { return await mailboxAPI.getChanges(session, accountId, sinceState); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override @@ -63,36 +59,28 @@ class MailboxDataSourceImpl extends MailboxDataSource { Future createNewMailbox(AccountId accountId, CreateNewMailboxRequest newMailboxRequest) { return Future.sync(() async { return await mailboxAPI.createNewMailbox(accountId, newMailboxRequest); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future> deleteMultipleMailbox(Session session, AccountId accountId, List mailboxIds) { return Future.sync(() async { return await mailboxAPI.deleteMultipleMailbox(session, accountId, mailboxIds); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future renameMailbox(AccountId accountId, RenameMailboxRequest request) { return Future.sync(() async { return await mailboxAPI.renameMailbox(accountId, request); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future moveMailbox(AccountId accountId, MoveMailboxRequest request) { return Future.sync(() async { return await mailboxAPI.moveMailbox(accountId, request); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override @@ -107,26 +95,20 @@ class MailboxDataSourceImpl extends MailboxDataSource { mailboxId, totalEmailUnread, onProgressController); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future subscribeMailbox(AccountId accountId, SubscribeMailboxRequest request) { return Future.sync(() async { return await mailboxAPI.subscribeMailbox(accountId, request); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future> subscribeMultipleMailbox(AccountId accountId, SubscribeMultipleMailboxRequest subscribeRequest) { return Future.sync(() async { return await mailboxAPI.subscribeMultipleMailbox(accountId, subscribeRequest); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } } \ No newline at end of file diff --git a/lib/features/mailbox/data/datasource_impl/state_datasource_impl.dart b/lib/features/mailbox/data/datasource_impl/state_datasource_impl.dart index 8a496a569..ee82aaab6 100644 --- a/lib/features/mailbox/data/datasource_impl/state_datasource_impl.dart +++ b/lib/features/mailbox/data/datasource_impl/state_datasource_impl.dart @@ -19,9 +19,7 @@ class StateDataSourceImpl extends StateDataSource { return Future.sync(() async { final stateCache = await _stateCacheClient.getItem(stateType.value); return stateCache?.toState(); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override @@ -33,8 +31,6 @@ class StateDataSourceImpl extends StateDataSource { } else { return await _stateCacheClient.insertItem(stateCache.type.value, stateCache); } - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } } \ No newline at end of file diff --git a/lib/features/mailbox/domain/usecases/refresh_all_mailbox_interactor.dart b/lib/features/mailbox/domain/usecases/refresh_all_mailbox_interactor.dart index 4eb288474..5dce8e266 100644 --- a/lib/features/mailbox/domain/usecases/refresh_all_mailbox_interactor.dart +++ b/lib/features/mailbox/domain/usecases/refresh_all_mailbox_interactor.dart @@ -2,7 +2,7 @@ import 'package:core/core.dart'; import 'package:dartz/dartz.dart'; import 'package:jmap_dart_client/jmap/account_id.dart'; import 'package:jmap_dart_client/jmap/core/session/session.dart'; -import 'package:jmap_dart_client/jmap/core/state.dart' as jmapState; +import 'package:jmap_dart_client/jmap/core/state.dart' as jmap_state; import 'package:model/model.dart'; import 'package:tmail_ui_user/features/mailbox/domain/model/mailbox_response.dart'; import 'package:tmail_ui_user/features/mailbox/domain/repository/mailbox_repository.dart'; @@ -13,7 +13,7 @@ class RefreshAllMailboxInteractor { RefreshAllMailboxInteractor(this._mailboxRepository); - Stream> execute(Session session, AccountId accountId, jmapState.State currentState) async* { + Stream> execute(Session session, AccountId accountId, jmap_state.State currentState) async* { try { yield Right(RefreshingState()); diff --git a/lib/features/mailbox/presentation/mailbox_controller.dart b/lib/features/mailbox/presentation/mailbox_controller.dart index 193b52080..95402e4e0 100644 --- a/lib/features/mailbox/presentation/mailbox_controller.dart +++ b/lib/features/mailbox/presentation/mailbox_controller.dart @@ -207,43 +207,41 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM ); ever(mailboxDashBoardController.viewState, (state) { - if (state is Either) { - state.fold((failure) => null, (success) { - if (success is MarkAsMultipleEmailReadAllSuccess) { - _refreshMailboxChanges(currentMailboxState: success.currentMailboxState); - } else if (success is MarkAsMultipleEmailReadHasSomeEmailFailure) { - _refreshMailboxChanges(currentMailboxState: success.currentMailboxState); - } else if (success is MoveMultipleEmailToMailboxAllSuccess) { - _refreshMailboxChanges(currentMailboxState: success.currentMailboxState); - } else if (success is MoveMultipleEmailToMailboxHasSomeEmailFailure) { - _refreshMailboxChanges(currentMailboxState: success.currentMailboxState); - } else if (success is DeleteMultipleEmailsPermanentlyAllSuccess) { - _refreshMailboxChanges(currentMailboxState: success.currentMailboxState); - } else if (success is DeleteMultipleEmailsPermanentlyHasSomeEmailFailure) { - _refreshMailboxChanges(currentMailboxState: success.currentMailboxState); - } else if (success is EmptyTrashFolderSuccess) { - _refreshMailboxChanges(currentMailboxState: success.currentMailboxState); - } else if (success is MarkAsEmailReadSuccess) { - _refreshMailboxChanges(currentMailboxState: success.currentMailboxState); - } else if (success is MoveToMailboxSuccess) { - _refreshMailboxChanges(currentMailboxState: success.currentMailboxState); - } else if (success is DeleteEmailPermanentlySuccess) { - _refreshMailboxChanges(currentMailboxState: success.currentMailboxState); - } else if (success is SaveEmailAsDraftsSuccess) { - _refreshMailboxChanges(currentMailboxState: success.currentMailboxState); - } else if (success is RemoveEmailDraftsSuccess) { - _refreshMailboxChanges(currentMailboxState: success.currentMailboxState); - } else if (success is SendEmailSuccess) { - _refreshMailboxChanges(currentMailboxState: success.currentMailboxState); - } else if (success is MarkAsMailboxReadAllSuccess) { - _refreshMailboxChanges(currentMailboxState: success.currentMailboxState); - } else if (success is MarkAsMailboxReadHasSomeEmailFailure) { - _refreshMailboxChanges(currentMailboxState: success.currentMailboxState); - } else if (success is UpdateEmailDraftsSuccess) { - _refreshMailboxChanges(currentMailboxState: success.currentMailboxState); - } - }); - } + state.fold((failure) => null, (success) { + if (success is MarkAsMultipleEmailReadAllSuccess) { + _refreshMailboxChanges(currentMailboxState: success.currentMailboxState); + } else if (success is MarkAsMultipleEmailReadHasSomeEmailFailure) { + _refreshMailboxChanges(currentMailboxState: success.currentMailboxState); + } else if (success is MoveMultipleEmailToMailboxAllSuccess) { + _refreshMailboxChanges(currentMailboxState: success.currentMailboxState); + } else if (success is MoveMultipleEmailToMailboxHasSomeEmailFailure) { + _refreshMailboxChanges(currentMailboxState: success.currentMailboxState); + } else if (success is DeleteMultipleEmailsPermanentlyAllSuccess) { + _refreshMailboxChanges(currentMailboxState: success.currentMailboxState); + } else if (success is DeleteMultipleEmailsPermanentlyHasSomeEmailFailure) { + _refreshMailboxChanges(currentMailboxState: success.currentMailboxState); + } else if (success is EmptyTrashFolderSuccess) { + _refreshMailboxChanges(currentMailboxState: success.currentMailboxState); + } else if (success is MarkAsEmailReadSuccess) { + _refreshMailboxChanges(currentMailboxState: success.currentMailboxState); + } else if (success is MoveToMailboxSuccess) { + _refreshMailboxChanges(currentMailboxState: success.currentMailboxState); + } else if (success is DeleteEmailPermanentlySuccess) { + _refreshMailboxChanges(currentMailboxState: success.currentMailboxState); + } else if (success is SaveEmailAsDraftsSuccess) { + _refreshMailboxChanges(currentMailboxState: success.currentMailboxState); + } else if (success is RemoveEmailDraftsSuccess) { + _refreshMailboxChanges(currentMailboxState: success.currentMailboxState); + } else if (success is SendEmailSuccess) { + _refreshMailboxChanges(currentMailboxState: success.currentMailboxState); + } else if (success is MarkAsMailboxReadAllSuccess) { + _refreshMailboxChanges(currentMailboxState: success.currentMailboxState); + } else if (success is MarkAsMailboxReadHasSomeEmailFailure) { + _refreshMailboxChanges(currentMailboxState: success.currentMailboxState); + } else if (success is UpdateEmailDraftsSuccess) { + _refreshMailboxChanges(currentMailboxState: success.currentMailboxState); + } + }); }); ever(mailboxDashBoardController.dashBoardAction, (action) { @@ -518,7 +516,7 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM _imagePaths.icFolderMailbox, width: 24, height: 24, - color: Colors.white, + colorFilter: Colors.white.asFilter(), fit: BoxFit.fill), backgroundColor: AppColor.toastSuccessBackgroundColor, textColor: Colors.white, @@ -544,7 +542,7 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM _imagePaths.icNotConnection, width: 24, height: 24, - color: Colors.white, + colorFilter: Colors.white.asFilter(), fit: BoxFit.fill), backgroundColor: AppColor.toastErrorBackgroundColor, textColor: Colors.white, @@ -828,7 +826,7 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM _imagePaths.icFolderMailbox, width: 24, height: 24, - color: Colors.white, + colorFilter: Colors.white.asFilter(), fit: BoxFit.fill), backgroundColor: AppColor.toastSuccessBackgroundColor, textColor: Colors.white, @@ -1029,9 +1027,9 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM } void _unsubscribeMailboxAction(MailboxId mailboxId) { - final _accountId = mailboxDashBoardController.accountId.value; + final accountId = mailboxDashBoardController.accountId.value; - if (_accountId != null) { + if (accountId != null) { final subscribeRequest = generateSubscribeRequest( mailboxId, MailboxSubscribeState.disabled, @@ -1039,9 +1037,9 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM ); if (subscribeRequest is SubscribeMultipleMailboxRequest) { - consumeState(_subscribeMultipleMailboxInteractor.execute(_accountId, subscribeRequest)); + consumeState(_subscribeMultipleMailboxInteractor.execute(accountId, subscribeRequest)); } else if (subscribeRequest is SubscribeMailboxRequest) { - consumeState(_subscribeMailboxInteractor.execute(_accountId, subscribeRequest)); + consumeState(_subscribeMailboxInteractor.execute(accountId, subscribeRequest)); } } } @@ -1120,7 +1118,7 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM _imagePaths.icFolderMailbox, width: 24, height: 24, - color: Colors.white, + colorFilter: Colors.white.asFilter(), fit: BoxFit.fill ), backgroundColor: AppColor.toastSuccessBackgroundColor, @@ -1136,9 +1134,9 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM MailboxId mailboxIdSubscribed, {List? listDescendantMailboxIds} ) { - final _accountId = mailboxDashBoardController.accountId.value; + final accountId = mailboxDashBoardController.accountId.value; - if (_accountId != null) { + if (accountId != null) { SubscribeRequest? subscribeRequest; if (listDescendantMailboxIds != null) { @@ -1157,9 +1155,9 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM } if (subscribeRequest is SubscribeMultipleMailboxRequest) { - consumeState(_subscribeMultipleMailboxInteractor.execute(_accountId, subscribeRequest)); + consumeState(_subscribeMultipleMailboxInteractor.execute(accountId, subscribeRequest)); } else if (subscribeRequest is SubscribeMailboxRequest) { - consumeState(_subscribeMailboxInteractor.execute(_accountId, subscribeRequest)); + consumeState(_subscribeMailboxInteractor.execute(accountId, subscribeRequest)); } } } diff --git a/lib/features/mailbox/presentation/mailbox_view.dart b/lib/features/mailbox/presentation/mailbox_view.dart index 53e157630..67f5225c4 100644 --- a/lib/features/mailbox/presentation/mailbox_view.dart +++ b/lib/features/mailbox/presentation/mailbox_view.dart @@ -221,7 +221,7 @@ class MailboxView extends GetWidget iconPadding: EdgeInsets.zero, icon: SvgPicture.asset( _imagePaths.icSearchBar, - color: AppColor.colorTextButton, + colorFilter: AppColor.colorTextButton.asFilter(), fit: BoxFit.fill ), tooltip: AppLocalizations.of(context).searchForMailboxes, @@ -232,7 +232,10 @@ class MailboxView extends GetWidget iconSize: 20, iconPadding: EdgeInsets.zero, splashRadius: 15, - icon: SvgPicture.asset(_imagePaths.icAddNewFolder, color: AppColor.colorTextButton, fit: BoxFit.fill), + icon: SvgPicture.asset( + _imagePaths.icAddNewFolder, + colorFilter: AppColor.colorTextButton.asFilter(), + fit: BoxFit.fill), tooltip: AppLocalizations.of(context).new_mailbox, onTap: () => controller.goToCreateNewMailboxView(context)), ], @@ -283,7 +286,8 @@ class MailboxView extends GetWidget categories.getExpandMode(controller.mailboxCategoriesExpandMode.value) == ExpandMode.EXPAND ? _imagePaths.icExpandFolder : _imagePaths.icCollapseFolder, - color: AppColor.primaryColor, fit: BoxFit.fill), + colorFilter: AppColor.primaryColor.asFilter(), + fit: BoxFit.fill), tooltip: AppLocalizations.of(context).collapse, onTap: () => controller.toggleMailboxCategories(categories)), Expanded(child: Text(categories.getTitle(context), diff --git a/lib/features/mailbox/presentation/mailbox_view_web.dart b/lib/features/mailbox/presentation/mailbox_view_web.dart index 2a4430532..da0cc45a3 100644 --- a/lib/features/mailbox/presentation/mailbox_view_web.dart +++ b/lib/features/mailbox/presentation/mailbox_view_web.dart @@ -151,7 +151,7 @@ class MailboxView extends GetWidget iconPadding: EdgeInsets.zero, icon: SvgPicture.asset( _imagePaths.icSearchBar, - color: AppColor.colorTextButton, + colorFilter: AppColor.colorTextButton.asFilter(), fit: BoxFit.fill ), onTap: () => controller.openSearchViewAction(context) @@ -161,7 +161,10 @@ class MailboxView extends GetWidget iconSize: 20, iconPadding: EdgeInsets.zero, splashRadius: 15, - icon: SvgPicture.asset(_imagePaths.icAddNewFolder, color: AppColor.colorTextButton, fit: BoxFit.fill), + icon: SvgPicture.asset( + _imagePaths.icAddNewFolder, + colorFilter: AppColor.colorTextButton.asFilter(), + fit: BoxFit.fill), tooltip: AppLocalizations.of(context).new_mailbox, onTap: () => controller.goToCreateNewMailboxView(context)), ], @@ -396,7 +399,7 @@ class MailboxView extends GetWidget iconSize: 28, icon: SvgPicture.asset( _imagePaths.icAppDashboard, - color: AppColor.primaryColor, + colorFilter: AppColor.primaryColor.asFilter(), fit: BoxFit.fill ), tooltip: AppLocalizations.of(context).appGridTittle), @@ -423,7 +426,7 @@ class MailboxView extends GetWidget controller.mailboxDashBoardController.appGridDashboardController.appDashboardExpandMode.value == ExpandMode.COLLAPSE ? _imagePaths.icCollapseFolder : _imagePaths.icExpandFolder, - color: AppColor.primaryColor, + colorFilter: AppColor.primaryColor.asFilter(), fit: BoxFit.fill )), tooltip: AppLocalizations.of(context).appGridTittle, diff --git a/lib/features/mailbox/presentation/mixin/mailbox_widget_mixin.dart b/lib/features/mailbox/presentation/mixin/mailbox_widget_mixin.dart index 0dd7982a7..4bc2bf4ee 100644 --- a/lib/features/mailbox/presentation/mixin/mailbox_widget_mixin.dart +++ b/lib/features/mailbox/presentation/mixin/mailbox_widget_mixin.dart @@ -145,7 +145,7 @@ mixin MailboxWidgetMixin { Key('${contextMenuItem.action.name}_action'), SvgPicture.asset( contextMenuItem.action.getContextMenuIcon(imagePaths), - color: contextMenuItem.action.getColorContextMenuIcon(), + colorFilter: contextMenuItem.action.getColorContextMenuIcon().asFilter(), width: 24, height: 24 ), @@ -298,7 +298,7 @@ mixin MailboxWidgetMixin { expandMode == ExpandMode.EXPAND ? imagePaths.icExpandFolder : imagePaths.icCollapseFolder, - color: AppColor.primaryColor, + colorFilter: AppColor.primaryColor.asFilter(), fit: BoxFit.fill ), tooltip: expandMode == ExpandMode.EXPAND diff --git a/lib/features/mailbox/presentation/model/mailbox_node.dart b/lib/features/mailbox/presentation/model/mailbox_node.dart index d454e4e24..4e59f4254 100644 --- a/lib/features/mailbox/presentation/model/mailbox_node.dart +++ b/lib/features/mailbox/presentation/model/mailbox_node.dart @@ -53,8 +53,8 @@ class MailboxNode with EquatableMixin{ } List? updateNode(MailboxId mailboxId, MailboxNode newNode, {MailboxNode? parent}) { - List? _children = parent == null ? childrenItems : parent.childrenItems; - return _children?.map((MailboxNode child) { + List? children = parent == null ? childrenItems : parent.childrenItems; + return children?.map((MailboxNode child) { if (child.item.id == mailboxId) { return newNode; } else { @@ -91,8 +91,8 @@ class MailboxNode with EquatableMixin{ } List? toggleSelectNode(MailboxNode selectedMailboxMode, {MailboxNode? parent}) { - List? _children = parent == null ? childrenItems : parent.childrenItems; - return _children?.map((MailboxNode child) { + List? children = parent == null ? childrenItems : parent.childrenItems; + return children?.map((MailboxNode child) { if (child.item.id == selectedMailboxMode.item.id) { return child.toggleSelectMailboxNode(); } else { @@ -105,8 +105,8 @@ class MailboxNode with EquatableMixin{ } List? toSelectedNode({required SelectMode selectMode, ExpandMode? newExpandMode, MailboxNode? parent}) { - List? _children = parent == null ? childrenItems : parent.childrenItems; - return _children?.map((MailboxNode child) { + List? children = parent == null ? childrenItems : parent.childrenItems; + return children?.map((MailboxNode child) { if (child.hasChildren()) { return child.copyWith( children: toSelectedNode(selectMode: selectMode, newExpandMode: newExpandMode, parent: child), diff --git a/lib/features/mailbox/presentation/widgets/mailbox_button_new_folder_builder.dart b/lib/features/mailbox/presentation/widgets/mailbox_button_new_folder_builder.dart index 5cdbd4a41..f769d4aa1 100644 --- a/lib/features/mailbox/presentation/widgets/mailbox_button_new_folder_builder.dart +++ b/lib/features/mailbox/presentation/widgets/mailbox_button_new_folder_builder.dart @@ -49,7 +49,12 @@ class MailboxNewFolderTileBuilder { leading: Padding( padding: const EdgeInsets.only(left: 34), child: _icon != null - ? SvgPicture.asset(_icon!, width: 24, height: 24, color: AppColor.mailboxIconColor, fit: BoxFit.fill) + ? SvgPicture.asset( + _icon!, + width: 24, + height: 24, + colorFilter: AppColor.mailboxIconColor.asFilter(), + fit: BoxFit.fill) : const SizedBox.shrink()), title: Padding( padding: const EdgeInsets.only(left: 8), diff --git a/lib/features/mailbox/presentation/widgets/mailbox_folder_tile_builder.dart b/lib/features/mailbox/presentation/widgets/mailbox_folder_tile_builder.dart index 75d4e47dd..d212a8cbb 100644 --- a/lib/features/mailbox/presentation/widgets/mailbox_folder_tile_builder.dart +++ b/lib/features/mailbox/presentation/widgets/mailbox_folder_tile_builder.dart @@ -195,9 +195,9 @@ class MailBoxFolderTileBuilder { _mailboxNode.expandMode == ExpandMode.EXPAND ? _imagePaths.icExpandFolder : _imagePaths.icCollapseFolder, - color: _mailboxNode.item.allowedToDisplay - ? AppColor.primaryColor - : AppColor.colorIconUnSubscribedMailbox, + colorFilter: _mailboxNode.item.allowedToDisplay + ? AppColor.primaryColor.asFilter() + : AppColor.colorIconUnSubscribedMailbox.asFilter(), fit: BoxFit.fill ), minSize: 12, diff --git a/lib/features/mailbox/presentation/widgets/user_information_widget_builder.dart b/lib/features/mailbox/presentation/widgets/user_information_widget_builder.dart index d15fc8482..3d1fc19cf 100644 --- a/lib/features/mailbox/presentation/widgets/user_information_widget_builder.dart +++ b/lib/features/mailbox/presentation/widgets/user_information_widget_builder.dart @@ -82,7 +82,10 @@ class UserInformationWidgetBuilder extends StatelessWidget { Transform( transform: Matrix4.translationValues(14.0, 0.0, 0.0), child: IconButton( - icon: SvgPicture.asset(_imagePaths.icCollapseFolder, fit: BoxFit.fill, color: AppColor.colorCollapseMailbox), + icon: SvgPicture.asset( + _imagePaths.icCollapseFolder, + fit: BoxFit.fill, + colorFilter: AppColor.colorCollapseMailbox.asFilter()), onPressed: () => {})) ]), ); diff --git a/lib/features/mailbox_creator/domain/model/verification/composite_name_validator.dart b/lib/features/mailbox_creator/domain/model/verification/composite_name_validator.dart index eb7e678b4..34690b2c1 100644 --- a/lib/features/mailbox_creator/domain/model/verification/composite_name_validator.dart +++ b/lib/features/mailbox_creator/domain/model/verification/composite_name_validator.dart @@ -13,9 +13,9 @@ class CompositeNameValidator extends Validator { CompositeNameValidator(this._listValidator); @override - Either validate(NewNameRequest newNameRequest) { + Either validate(NewNameRequest value) { return _listValidator.isNotEmpty - ? _listValidator.getValidatorNameViewState(newNameRequest) + ? _listValidator.getValidatorNameViewState(value) : Right(VerifyNameViewState()); } } \ No newline at end of file diff --git a/lib/features/mailbox_creator/domain/model/verification/duplicate_name_validator.dart b/lib/features/mailbox_creator/domain/model/verification/duplicate_name_validator.dart index 5c48b3340..517b44a0d 100644 --- a/lib/features/mailbox_creator/domain/model/verification/duplicate_name_validator.dart +++ b/lib/features/mailbox_creator/domain/model/verification/duplicate_name_validator.dart @@ -11,11 +11,11 @@ class DuplicateNameValidator extends Validator { DuplicateNameValidator(this._listName); @override - Either validate(NewNameRequest newNameRequest) { - if (newNameRequest.value != null) { + Either validate(NewNameRequest value) { + if (value.value != null) { final nameExist = _listName .map((nameItem) => nameItem.toLowerCase()) - .contains(newNameRequest.value!.toLowerCase()); + .contains(value.value!.toLowerCase()); if (nameExist) { return Left(VerifyNameFailure(const DuplicatedNameException())); } else { diff --git a/lib/features/mailbox_creator/domain/model/verification/email_address_validator.dart b/lib/features/mailbox_creator/domain/model/verification/email_address_validator.dart index 2785e23b3..b44d9561c 100644 --- a/lib/features/mailbox_creator/domain/model/verification/email_address_validator.dart +++ b/lib/features/mailbox_creator/domain/model/verification/email_address_validator.dart @@ -10,8 +10,8 @@ import 'package:tmail_ui_user/features/mailbox_creator/domain/state/verify_name_ class EmailAddressValidator extends Validator { @override - Either validate(NewNameRequest newNameRequest) { - if (newNameRequest.value != null && GetUtils.isEmail(newNameRequest.value!)) { + Either validate(NewNameRequest value) { + if (value.value != null && GetUtils.isEmail(value.value!)) { return Right(VerifyNameViewState()); } else { return Left(VerifyNameFailure(const EmailAddressInvalidException())); diff --git a/lib/features/mailbox_creator/domain/model/verification/empty_name_validator.dart b/lib/features/mailbox_creator/domain/model/verification/empty_name_validator.dart index c0d628763..9e260ca91 100644 --- a/lib/features/mailbox_creator/domain/model/verification/empty_name_validator.dart +++ b/lib/features/mailbox_creator/domain/model/verification/empty_name_validator.dart @@ -9,8 +9,8 @@ import 'package:tmail_ui_user/features/mailbox_creator/domain/state/verify_name_ class EmptyNameValidator extends Validator { @override - Either validate(NewNameRequest newNameRequest) { - if (newNameRequest.value == null || newNameRequest.value!.isEmpty) { + Either validate(NewNameRequest value) { + if (value.value == null || value.value!.isEmpty) { return Left(VerifyNameFailure(const EmptyNameException())); } else { return Right(VerifyNameViewState()); diff --git a/lib/features/mailbox_creator/domain/model/verification/special_character_validator.dart b/lib/features/mailbox_creator/domain/model/verification/special_character_validator.dart index d53ea3244..fc29c9a94 100644 --- a/lib/features/mailbox_creator/domain/model/verification/special_character_validator.dart +++ b/lib/features/mailbox_creator/domain/model/verification/special_character_validator.dart @@ -10,8 +10,8 @@ import 'package:tmail_ui_user/features/mailbox_creator/domain/state/verify_name_ class SpecialCharacterValidator extends Validator { @override - Either validate(NewNameRequest newNameRequest) { - if (newNameRequest.value != null && newNameRequest.value!.hasSpecialCharactersInName()) { + Either validate(NewNameRequest value) { + if (value.value != null && value.value!.hasSpecialCharactersInName()) { return Left(VerifyNameFailure(const SpecialCharacterException())); } else { return Right(VerifyNameViewState()); diff --git a/lib/features/mailbox_creator/presentation/mailbox_creator_view.dart b/lib/features/mailbox_creator/presentation/mailbox_creator_view.dart index 91f97e035..33b8788f7 100644 --- a/lib/features/mailbox_creator/presentation/mailbox_creator_view.dart +++ b/lib/features/mailbox_creator/presentation/mailbox_creator_view.dart @@ -180,7 +180,7 @@ class MailboxCreatorView extends GetWidget { color: AppColor.primaryColor, icon: SvgPicture.asset( _imagePaths.icCollapseFolder, - color: AppColor.colorCollapseMailbox, + colorFilter: AppColor.colorCollapseMailbox.asFilter(), fit: BoxFit.fill), onPressed: () => controller.selectMailboxLocation(context)) ])), diff --git a/lib/features/mailbox_dashboard/data/datasource_impl/search_datasource_impl.dart b/lib/features/mailbox_dashboard/data/datasource_impl/search_datasource_impl.dart index d32d4bd35..4530b9805 100644 --- a/lib/features/mailbox_dashboard/data/datasource_impl/search_datasource_impl.dart +++ b/lib/features/mailbox_dashboard/data/datasource_impl/search_datasource_impl.dart @@ -25,9 +25,7 @@ class SearchDataSourceImpl extends SearchDataSource { recentSearch.value, recentSearch.toRecentSearchCache()); } - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override @@ -47,9 +45,7 @@ class SearchDataSourceImpl extends SearchDataSource { : listRecentSearch; return newListRecentSearch; - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } bool _filterRecentSearchCache(RecentSearchCache recentSearchCache, String? pattern) { diff --git a/lib/features/mailbox_dashboard/data/datasource_impl/share_preference_spam_report_data_source_impl.dart b/lib/features/mailbox_dashboard/data/datasource_impl/share_preference_spam_report_data_source_impl.dart index 24f839d43..0dee5b25b 100644 --- a/lib/features/mailbox_dashboard/data/datasource_impl/share_preference_spam_report_data_source_impl.dart +++ b/lib/features/mailbox_dashboard/data/datasource_impl/share_preference_spam_report_data_source_impl.dart @@ -16,27 +16,21 @@ class SharePreferenceSpamReportDataSourceImpl extends SpamReportDataSource { Future getLastTimeDismissedSpamReported() async { return Future.sync(() async { return await _sharePreferenceSpamReportDataSource.getLastTimeDismissedSpamReported(); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future storeLastTimeDismissedSpamReported(DateTime lastTimeDismissedSpamReported) async { return Future.sync(() async { return await _sharePreferenceSpamReportDataSource.storeLastTimeDismissedSpamReported(lastTimeDismissedSpamReported); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future deleteLastTimeDismissedSpamReported() { return Future.sync(() async { return await _sharePreferenceSpamReportDataSource.deleteLastTimeDismissedSpamReported(); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override @@ -54,26 +48,20 @@ class SharePreferenceSpamReportDataSourceImpl extends SpamReportDataSource { Future deleteSpamReportState() { return Future.sync(() async { return await _sharePreferenceSpamReportDataSource.deleteLastTimeDismissedSpamReported(); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future getSpamReportState() { return Future.sync(() async { return await _sharePreferenceSpamReportDataSource.getSpamReportState(); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future storeSpamReportState(SpamReportState spamReportState) { return Future.sync(() async { return await _sharePreferenceSpamReportDataSource.storeSpamReportState(spamReportState); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } } diff --git a/lib/features/mailbox_dashboard/data/datasource_impl/spam_report_datasource_impl.dart b/lib/features/mailbox_dashboard/data/datasource_impl/spam_report_datasource_impl.dart index 545cf5266..8e5389933 100644 --- a/lib/features/mailbox_dashboard/data/datasource_impl/spam_report_datasource_impl.dart +++ b/lib/features/mailbox_dashboard/data/datasource_impl/spam_report_datasource_impl.dart @@ -28,12 +28,10 @@ class SpamReportDataSourceImpl extends SpamReportDataSource { } ) { return Future.sync(() async { - final _unreadSpamEmailsResponse = await _spamReportApi.getUnreadSpamEmailbox( + final unreadSpamEmailsResponse = await _spamReportApi.getUnreadSpamEmailbox( accountId, mailboxFilterCondition: mailboxFilterCondition, limit: limit); - return _unreadSpamEmailsResponse; - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + return unreadSpamEmailsResponse; + }).catchError(_exceptionThrower.throwException); } @override diff --git a/lib/features/mailbox_dashboard/data/local/share_preference_spam_report_data_source.dart b/lib/features/mailbox_dashboard/data/local/share_preference_spam_report_data_source.dart index 9f80ce4a5..36b97066f 100644 --- a/lib/features/mailbox_dashboard/data/local/share_preference_spam_report_data_source.dart +++ b/lib/features/mailbox_dashboard/data/local/share_preference_spam_report_data_source.dart @@ -14,15 +14,15 @@ class SharePreferenceSpamReportDataSource extends SpamReportDataSource { @override Future getLastTimeDismissedSpamReported() async { - final _timeStamp = _sharedPreferences.getInt(MailboxDashboardConstant.keyLastTimeDismissedSpamReported) ?? 0; - final _lastTimeDismissedSpamReported = DateTime.fromMillisecondsSinceEpoch(_timeStamp); - return _lastTimeDismissedSpamReported; + final timeStamp = _sharedPreferences.getInt(MailboxDashboardConstant.keyLastTimeDismissedSpamReported) ?? 0; + final lastTimeDismissedSpamReported = DateTime.fromMillisecondsSinceEpoch(timeStamp); + return lastTimeDismissedSpamReported; } @override Future storeLastTimeDismissedSpamReported(DateTime lastTimeDismissedSpamReported) async { - final _timeStamp = lastTimeDismissedSpamReported.millisecondsSinceEpoch; - return await _sharedPreferences.setInt(MailboxDashboardConstant.keyLastTimeDismissedSpamReported,_timeStamp); + final timeStamp = lastTimeDismissedSpamReported.millisecondsSinceEpoch; + return await _sharedPreferences.setInt(MailboxDashboardConstant.keyLastTimeDismissedSpamReported,timeStamp); } @override @@ -48,13 +48,13 @@ class SharePreferenceSpamReportDataSource extends SpamReportDataSource { @override Future getSpamReportState() async { - final _spamReportState = _sharedPreferences.getString(MailboxDashboardConstant.keySpamReportState) ?? ''; - return _spamReportState == SpamReportState.disabled.keyValue ? SpamReportState.disabled : SpamReportState.enabled; + final spamReportState = _sharedPreferences.getString(MailboxDashboardConstant.keySpamReportState) ?? ''; + return spamReportState == SpamReportState.disabled.keyValue ? SpamReportState.disabled : SpamReportState.enabled; } @override Future storeSpamReportState(SpamReportState spamReportState) async { - final _spamReportState = spamReportState.keyValue; - return await _sharedPreferences.setString(MailboxDashboardConstant.keySpamReportState, _spamReportState); + final spamReportState0 = spamReportState.keyValue; + return await _sharedPreferences.setString(MailboxDashboardConstant.keySpamReportState, spamReportState0); } } \ No newline at end of file diff --git a/lib/features/mailbox_dashboard/data/network/spam_report_api.dart b/lib/features/mailbox_dashboard/data/network/spam_report_api.dart index ff536b83f..911f2387b 100644 --- a/lib/features/mailbox_dashboard/data/network/spam_report_api.dart +++ b/lib/features/mailbox_dashboard/data/network/spam_report_api.dart @@ -40,12 +40,12 @@ class SpamReportApi { .build() .execute(); - final _mailboxResponse = result + final mailboxResponse = result .parse(getMailboxInvocation.methodCallId, GetMailboxResponse.deserialize); return Future.sync(() async { - final _unreadSpamMailbox = _mailboxResponse?.list.first; - return UnreadSpamEmailsResponse(unreadSpamMailbox: _unreadSpamMailbox); + final unreadSpamMailbox = mailboxResponse?.list.first; + return UnreadSpamEmailsResponse(unreadSpamMailbox: unreadSpamMailbox); }).catchError((error) { throw error; }); diff --git a/lib/features/mailbox_dashboard/domain/usecases/get_unread_spam_mailbox_interactor.dart b/lib/features/mailbox_dashboard/domain/usecases/get_unread_spam_mailbox_interactor.dart index c30340763..adca4bfc2 100644 --- a/lib/features/mailbox_dashboard/domain/usecases/get_unread_spam_mailbox_interactor.dart +++ b/lib/features/mailbox_dashboard/domain/usecases/get_unread_spam_mailbox_interactor.dart @@ -23,17 +23,17 @@ class GetUnreadSpamMailboxInteractor { ) async* { try { yield Right(GetUnreadSpamMailboxLoading()); - final _lastTimeDissmissedSpamReported = await _spamReportRepository.getLastTimeDismissedSpamReported(); - final _timeLast = DateTime.now().difference(_lastTimeDissmissedSpamReported); + final lastTimeDismissedSpamReported = await _spamReportRepository.getLastTimeDismissedSpamReported(); + final timeLast = DateTime.now().difference(lastTimeDismissedSpamReported); - final _checkTimeCondition = (_timeLast.inHours > 0) && (_timeLast.inHours > conditionsForDisplayingSpamReportBanner); + final checkTimeCondition = (timeLast.inHours > 0) && (timeLast.inHours > conditionsForDisplayingSpamReportBanner); - if (_checkTimeCondition) { - final _response = await _spamReportRepository.getUnreadSpamMailbox(accountId, mailboxFilterCondition: mailboxFilterCondition, limit: limit); - final _unreadSpamMailbox = _response.unreadSpamMailbox; + if (checkTimeCondition) { + final response = await _spamReportRepository.getUnreadSpamMailbox(accountId, mailboxFilterCondition: mailboxFilterCondition, limit: limit); + final unreadSpamMailbox = response.unreadSpamMailbox; - if (_unreadSpamMailbox!.unreadEmails!.value.value > 0) { - yield Right(GetUnreadSpamMailboxSuccess(_unreadSpamMailbox)); + if (unreadSpamMailbox!.unreadEmails!.value.value > 0) { + yield Right(GetUnreadSpamMailboxSuccess(unreadSpamMailbox)); } else { yield Left(InvalidSpamReportCondition()); } diff --git a/lib/features/mailbox_dashboard/presentation/controller/advanced_filter_controller.dart b/lib/features/mailbox_dashboard/presentation/controller/advanced_filter_controller.dart index 7da60bd92..d2544fb7e 100644 --- a/lib/features/mailbox_dashboard/presentation/controller/advanced_filter_controller.dart +++ b/lib/features/mailbox_dashboard/presentation/controller/advanced_filter_controller.dart @@ -137,12 +137,12 @@ class AdvancedFilterController extends BaseController { void selectedMailBox(BuildContext context) async { final accountId = _mailboxDashBoardController.accountId.value; - final _session = _mailboxDashBoardController.sessionCurrent; + final session = _mailboxDashBoardController.sessionCurrent; if (accountId != null) { final arguments = DestinationPickerArguments( accountId, MailboxActions.select, - _session, + session, mailboxIdSelected: searchController.searchEmailFilter.value.mailbox?.id); if (BuildUtils.isWeb) { diff --git a/lib/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart b/lib/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart index b8d3792aa..405906510 100644 --- a/lib/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart +++ b/lib/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart @@ -573,7 +573,7 @@ class MailboxDashBoardController extends ReloadableController { _imagePaths.icMailboxDrafts, width: 24, height: 24, - color: Colors.white, + colorFilter: Colors.white.asFilter(), fit: BoxFit.fill), backgroundColor: AppColor.toastSuccessBackgroundColor, textColor: Colors.white, @@ -606,7 +606,7 @@ class MailboxDashBoardController extends ReloadableController { _imagePaths.icFolderMailbox, width: 24, height: 24, - color: Colors.white, + colorFilter: Colors.white.asFilter(), fit: BoxFit.fill), backgroundColor: AppColor.toastSuccessBackgroundColor, textColor: Colors.white, @@ -939,7 +939,7 @@ class MailboxDashBoardController extends ReloadableController { _imagePaths.icFolderMailbox, width: 24, height: 24, - color: Colors.white, + colorFilter: Colors.white.asFilter(), fit: BoxFit.fill), backgroundColor: AppColor.toastSuccessBackgroundColor, textColor: Colors.white, @@ -1553,8 +1553,8 @@ class MailboxDashBoardController extends ReloadableController { } void storeSpamReportStateAction() { - final _storeSpamReportState = enableSpamReport ? SpamReportState.disabled : SpamReportState.enabled; - spamReportController.storeSpamReportStateAction(_storeSpamReportState); + final storeSpamReportState = enableSpamReport ? SpamReportState.disabled : SpamReportState.enabled; + spamReportController.storeSpamReportStateAction(storeSpamReportState); } void onDragMailbox(bool isDragging) { diff --git a/lib/features/mailbox_dashboard/presentation/controller/spam_report_controller.dart b/lib/features/mailbox_dashboard/presentation/controller/spam_report_controller.dart index e9e958ca6..a8e5b604c 100644 --- a/lib/features/mailbox_dashboard/presentation/controller/spam_report_controller.dart +++ b/lib/features/mailbox_dashboard/presentation/controller/spam_report_controller.dart @@ -62,9 +62,9 @@ class SpamReportController extends BaseController { } void getUnreadSpamMailboxAction(AccountId accountId) { - final _mailboxFilterCondition = MailboxFilterCondition(role: Role('Spam')); + final mailboxFilterCondition = MailboxFilterCondition(role: Role('Spam')); getSpamReportStateAction(); - consumeState(_getNumberOfUnreadSpamEmailsInteractor.execute(accountId,mailboxFilterCondition: _mailboxFilterCondition)); + consumeState(_getNumberOfUnreadSpamEmailsInteractor.execute(accountId,mailboxFilterCondition: mailboxFilterCondition)); } void _storeLastTimeDismissedSpamReportedAction() { @@ -78,9 +78,9 @@ class SpamReportController extends BaseController { bool get enableSpamReport => _spamReportState.value == SpamReportState.enabled; void openMailbox(BuildContext context) { - final _mailboxDashBoardController = Get.find(); + final mailboxDashBoardController = Get.find(); dismissSpamReportAction(); - _mailboxDashBoardController.openMailboxAction(context, _presentationSpamMailbox.value!); + mailboxDashBoardController.openMailboxAction(context, _presentationSpamMailbox.value!); } void storeSpamReportStateAction(SpamReportState spamReportState) { diff --git a/lib/features/mailbox_dashboard/presentation/mailbox_dashboard_view_web.dart b/lib/features/mailbox_dashboard/presentation/mailbox_dashboard_view_web.dart index cfb5ea8bc..0988c4f93 100644 --- a/lib/features/mailbox_dashboard/presentation/mailbox_dashboard_view_web.dart +++ b/lib/features/mailbox_dashboard/presentation/mailbox_dashboard_view_web.dart @@ -105,6 +105,7 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView { Column(children: [ _buildComposerButton(context), Expanded(child: SizedBox( + width: ResponsiveUtils.defaultSizeMenu, child: Obx(() { if (controller.searchMailboxActivated.isTrue) { return const SearchMailboxView( @@ -113,8 +114,7 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView { } else { return MailboxView(); } - }), - width: ResponsiveUtils.defaultSizeMenu + }) )) ]), Expanded(child: Column(children: [ @@ -204,8 +204,8 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView { key: controller.scaffoldKey, drawer: ResponsiveWidget( responsiveUtils: responsiveUtils, - mobile: SizedBox(child: MailboxView(), width: ResponsiveUtils.defaultSizeDrawer), - tabletLarge: SizedBox(child: MailboxView(), width: ResponsiveUtils.defaultSizeLeftMenuMobile), + mobile: SizedBox(width: ResponsiveUtils.defaultSizeDrawer, child: MailboxView()), + tabletLarge: SizedBox(width: ResponsiveUtils.defaultSizeLeftMenuMobile, child: MailboxView()), desktop: const SizedBox.shrink() ), body: body, @@ -306,16 +306,6 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView { behavior: HitTestBehavior.opaque, onTap: () => appGridDashboardController.toggleAppGridDashboard()), child: PortalTarget( - child: buildIconWeb( - onTap: controller.showAppDashboardAction, - splashRadius: 20, - icon: SvgPicture.asset( - imagePaths.icAppDashboard, - width: 28, - height: 28, - fit: BoxFit.fill - ), - ), anchor: const Aligned( follower: Alignment.topRight, target: Alignment.bottomRight @@ -327,6 +317,16 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView { return const SizedBox.shrink(); }), visible: appGridDashboardController.isAppGridDashboardOverlayOpen.isTrue, + child: buildIconWeb( + onTap: controller.showAppDashboardAction, + splashRadius: 20, + icon: SvgPicture.asset( + imagePaths.icAppDashboard, + width: 28, + height: 28, + fit: BoxFit.fill + ), + ), ) ) ) diff --git a/lib/features/mailbox_dashboard/presentation/mixin/filter_email_popup_menu_mixin.dart b/lib/features/mailbox_dashboard/presentation/mixin/filter_email_popup_menu_mixin.dart index 7860c49ab..056cbe43f 100644 --- a/lib/features/mailbox_dashboard/presentation/mixin/filter_email_popup_menu_mixin.dart +++ b/lib/features/mailbox_dashboard/presentation/mixin/filter_email_popup_menu_mixin.dart @@ -63,8 +63,8 @@ mixin FilterEmailPopupMenuMixin { width: 20, height: 20, fit: BoxFit.fill, - color: option != FilterMessageOption.starred - ? AppColor.colorTextButton + colorFilter: option != FilterMessageOption.starred + ? AppColor.colorTextButton.asFilter() : null), const SizedBox(width: 12), Expanded(child: Text( diff --git a/lib/features/mailbox_dashboard/presentation/widgets/advanced_search/advanced_search_filter_bottom_sheet.dart b/lib/features/mailbox_dashboard/presentation/widgets/advanced_search/advanced_search_filter_bottom_sheet.dart index 614c624a1..f06f1cfbf 100644 --- a/lib/features/mailbox_dashboard/presentation/widgets/advanced_search/advanced_search_filter_bottom_sheet.dart +++ b/lib/features/mailbox_dashboard/presentation/widgets/advanced_search/advanced_search_filter_bottom_sheet.dart @@ -6,7 +6,7 @@ import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/widgets/ad import 'package:tmail_ui_user/main/localizations/app_localizations.dart'; Future showAdvancedSearchFilterBottomSheet(BuildContext context) async { - final ImagePaths _imagePaths = Get.find(); + final ImagePaths imagePaths = Get.find(); await FullScreenActionSheetBuilder( context: context, @@ -19,8 +19,8 @@ Future showAdvancedSearchFilterBottomSheet(BuildContext context) async { cancelWidget: Padding( padding: const EdgeInsets.only(right: 16), child: SvgPicture.asset( - _imagePaths.icCloseAdvancedSearch, - color: AppColor.colorHintSearchBar, + imagePaths.icCloseAdvancedSearch, + colorFilter: AppColor.colorHintSearchBar.asFilter(), width: 24, height: 24, ), diff --git a/lib/features/mailbox_dashboard/presentation/widgets/advanced_search/advanced_search_filter_form_bottom_view.dart b/lib/features/mailbox_dashboard/presentation/widgets/advanced_search/advanced_search_filter_form_bottom_view.dart index 4bca3ab1e..9698d5ab1 100644 --- a/lib/features/mailbox_dashboard/presentation/widgets/advanced_search/advanced_search_filter_form_bottom_view.dart +++ b/lib/features/mailbox_dashboard/presentation/widgets/advanced_search/advanced_search_filter_form_bottom_view.dart @@ -18,15 +18,15 @@ class AdvancedSearchFilterFormBottomView extends GetWidget(); + final responsiveUtils = Get.find(); return Padding( padding: EdgeInsets.only( - top: _isMobileAndLandscapeTablet(context, _responsiveUtils) ? 8 : 20), + top: _isMobileAndLandscapeTablet(context, responsiveUtils) ? 8 : 20), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - if (_isMobileAndLandscapeTablet(context, _responsiveUtils)) + if (_isMobileAndLandscapeTablet(context, responsiveUtils)) ...[ _buildCheckboxHasAttachment( context, @@ -35,17 +35,17 @@ class AdvancedSearchFilterFormBottomView extends GetWidget({ DateTime? startDate, DateTime? endDate }) { - final ImagePaths _imagePaths = Get.find(); + final ImagePaths imagePaths = Get.find(); return DropdownButtonHideUnderline( child: DropdownButton2( @@ -68,7 +68,7 @@ Widget _buildDropDownButton({ .toList(), value: itemSelected, onChanged: onChanged, - icon: SvgPicture.asset(_imagePaths.icDropDown), + icon: SvgPicture.asset(imagePaths.icDropDown), buttonPadding: const EdgeInsets.symmetric(horizontal: 12), buttonDecoration: BoxDecoration( borderRadius: BorderRadius.circular(10), diff --git a/lib/features/mailbox_dashboard/presentation/widgets/advanced_search/icon_open_advanced_search_widget.dart b/lib/features/mailbox_dashboard/presentation/widgets/advanced_search/icon_open_advanced_search_widget.dart index 2035bf047..91f2a0924 100644 --- a/lib/features/mailbox_dashboard/presentation/widgets/advanced_search/icon_open_advanced_search_widget.dart +++ b/lib/features/mailbox_dashboard/presentation/widgets/advanced_search/icon_open_advanced_search_widget.dart @@ -28,9 +28,9 @@ class IconOpenAdvancedSearchWidget extends StatelessWidget { minSize: 40, iconPadding: const EdgeInsets.only(right: 2), icon: SvgPicture.asset(_imagePaths.icFilterAdvanced, - color: searchController.isAdvancedSearchViewOpen.isTrue || searchController.advancedSearchIsActivated.isTrue - ? AppColor.colorFilterMessageEnabled - : AppColor.colorFilterMessageDisabled, + colorFilter: searchController.isAdvancedSearchViewOpen.isTrue || searchController.advancedSearchIsActivated.isTrue + ? AppColor.colorFilterMessageEnabled.asFilter() + : AppColor.colorFilterMessageDisabled.asFilter(), width: 16, height: 16), onTap: () { diff --git a/lib/features/mailbox_dashboard/presentation/widgets/download/download_task_item_widget.dart b/lib/features/mailbox_dashboard/presentation/widgets/download/download_task_item_widget.dart index d5e7c19d0..af6eeca6c 100644 --- a/lib/features/mailbox_dashboard/presentation/widgets/download/download_task_item_widget.dart +++ b/lib/features/mailbox_dashboard/presentation/widgets/download/download_task_item_widget.dart @@ -19,7 +19,7 @@ class DownloadTaskItemWidget extends StatelessWidget with AppLoaderMixin { @override Widget build(BuildContext context) { - final _imagePaths = Get.find(); + final imagePaths = Get.find(); return Container( padding: EdgeInsets.zero, @@ -36,7 +36,7 @@ class DownloadTaskItemWidget extends StatelessWidget with AppLoaderMixin { height: 30, child: Stack(alignment: Alignment.center, children: [ SvgPicture.asset( - taskState.attachment.getIcon(_imagePaths), + taskState.attachment.getIcon(imagePaths), width: 16, height: 16, fit: BoxFit.fill), diff --git a/lib/features/mailbox_dashboard/presentation/widgets/spam_report_banner_web_widget.dart b/lib/features/mailbox_dashboard/presentation/widgets/spam_report_banner_web_widget.dart index 1b0faea2d..8aba2a24a 100644 --- a/lib/features/mailbox_dashboard/presentation/widgets/spam_report_banner_web_widget.dart +++ b/lib/features/mailbox_dashboard/presentation/widgets/spam_report_banner_web_widget.dart @@ -12,10 +12,10 @@ class SpamReportBannerWebWidget extends StatelessWidget { @override Widget build(BuildContext context){ - final _spamReportController = Get.find(); - final _imagePaths = Get.find(); + final spamReportController = Get.find(); + final imagePaths = Get.find(); return Obx(() { - if (!_spamReportController.enableSpamReport || _spamReportController.notShowSpamReportBanner) { + if (!spamReportController.enableSpamReport || spamReportController.notShowSpamReportBanner) { return const SizedBox( height: 8, ); @@ -36,15 +36,15 @@ class SpamReportBannerWebWidget extends StatelessWidget { Row( children: [ SvgPicture.asset( - _imagePaths.icInfoCircleOutline, + imagePaths.icInfoCircleOutline, width: 28, height: 28, - color: AppColor.primaryColor, + colorFilter: AppColor.primaryColor.asFilter(), ), const SizedBox(width: 8), Text( AppLocalizations.of(context).countNewSpamEmails( - _spamReportController.numberOfUnreadSpamEmails), + spamReportController.numberOfUnreadSpamEmails), style: const TextStyle( fontSize: 16, color: AppColor.primaryColor, @@ -66,7 +66,7 @@ class SpamReportBannerWebWidget extends StatelessWidget { fontWeight: FontWeight.w400), backgroundColor: AppColor.colorCreateNewIdentityButton, radius: 10, - onTap: () => _spamReportController.openMailbox(context), + onTap: () => spamReportController.openMailbox(context), ), ), ], @@ -75,8 +75,8 @@ class SpamReportBannerWebWidget extends StatelessWidget { top: 16, right: 16, child: buildSVGIconButton( - icon: _imagePaths.icCloseComposer, - onTap: () => _spamReportController.dismissSpamReportAction(), + icon: imagePaths.icCloseComposer, + onTap: () => spamReportController.dismissSpamReportAction(), ), ), ], diff --git a/lib/features/mailbox_dashboard/presentation/widgets/top_bar_thread_selection.dart b/lib/features/mailbox_dashboard/presentation/widgets/top_bar_thread_selection.dart index 0bdf165ce..c811b9c3b 100644 --- a/lib/features/mailbox_dashboard/presentation/widgets/top_bar_thread_selection.dart +++ b/lib/features/mailbox_dashboard/presentation/widgets/top_bar_thread_selection.dart @@ -42,7 +42,7 @@ class TopBarThreadSelection { buildIconWeb( icon: SvgPicture.asset( imagePaths.icCloseComposer, - color: AppColor.colorTextButton, + colorFilter: AppColor.colorTextButton.asFilter(), fit: BoxFit.fill), tooltip: AppLocalizations.of(context).cancel, onTap: onCancelSelection), @@ -113,9 +113,9 @@ class TopBarThreadSelection { canDeletePermanently ? imagePaths.icDeleteComposer : imagePaths.icDelete, - color: canDeletePermanently - ? AppColor.colorDeletePermanentlyButton - : AppColor.primaryColor, + colorFilter: canDeletePermanently + ? AppColor.colorDeletePermanentlyButton.asFilter() + : AppColor.primaryColor.asFilter(), width: 20, height: 20, fit: BoxFit.fill), diff --git a/lib/features/manage_account/data/datasource_impl/forwarding_data_source_impl.dart b/lib/features/manage_account/data/datasource_impl/forwarding_data_source_impl.dart index 57bb7f200..f367b54ef 100644 --- a/lib/features/manage_account/data/datasource_impl/forwarding_data_source_impl.dart +++ b/lib/features/manage_account/data/datasource_impl/forwarding_data_source_impl.dart @@ -18,35 +18,27 @@ class ForwardingDataSourceImpl extends ForwardingDataSource { Future getForward(AccountId accountId) { return Future.sync(() async { return await _forwardingAPI.getForward(accountId); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future deleteRecipientInForwarding(AccountId accountId, DeleteRecipientInForwardingRequest deleteRequest) { return Future.sync(() async { return await _forwardingAPI.updateForward(accountId, deleteRequest.newTMailForward); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future addRecipientsInForwarding(AccountId accountId, AddRecipientInForwardingRequest addRequest) { return Future.sync(() async { return await _forwardingAPI.updateForward(accountId, addRequest.newTMailForward); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future editLocalCopyInForwarding(AccountId accountId, EditLocalCopyInForwardingRequest editRequest) { return Future.sync(() async { return await _forwardingAPI.updateForward(accountId, editRequest.newTMailForward); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } } \ No newline at end of file diff --git a/lib/features/manage_account/data/datasource_impl/identity_data_source_impl.dart b/lib/features/manage_account/data/datasource_impl/identity_data_source_impl.dart index 4cfb232f6..27c837007 100644 --- a/lib/features/manage_account/data/datasource_impl/identity_data_source_impl.dart +++ b/lib/features/manage_account/data/datasource_impl/identity_data_source_impl.dart @@ -20,35 +20,27 @@ class IdentityDataSourceImpl extends IdentityDataSource { {Properties? properties}) { return Future.sync(() async { return await _identityAPI.getAllIdentities(accountId, properties: properties); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future createNewIdentity(AccountId accountId, CreateNewIdentityRequest identityRequest) { return Future.sync(() async { return await _identityAPI.createNewIdentity(accountId, identityRequest); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future deleteIdentity(AccountId accountId, IdentityId identityId) { return Future.sync(() async { return await _identityAPI.deleteIdentity(accountId, identityId); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future editIdentity(AccountId accountId, EditIdentityRequest editIdentityRequest) { return Future.sync(() async { return await _identityAPI.editIdentity(accountId, editIdentityRequest); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } } \ No newline at end of file diff --git a/lib/features/manage_account/data/datasource_impl/manage_account_datasource_impl.dart b/lib/features/manage_account/data/datasource_impl/manage_account_datasource_impl.dart index f395927bb..c9fbdfbb3 100644 --- a/lib/features/manage_account/data/datasource_impl/manage_account_datasource_impl.dart +++ b/lib/features/manage_account/data/datasource_impl/manage_account_datasource_impl.dart @@ -18,8 +18,6 @@ class ManageAccountDataSourceImpl extends ManageAccountDataSource { Future persistLanguage(Locale localeCurrent) { return Future.sync(() async { return await _languageCacheManager.persistLanguage(localeCurrent); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } } \ No newline at end of file diff --git a/lib/features/manage_account/data/datasource_impl/rule_filter_datasource_impl.dart b/lib/features/manage_account/data/datasource_impl/rule_filter_datasource_impl.dart index 8f6909cde..10e6ac7fe 100644 --- a/lib/features/manage_account/data/datasource_impl/rule_filter_datasource_impl.dart +++ b/lib/features/manage_account/data/datasource_impl/rule_filter_datasource_impl.dart @@ -22,9 +22,7 @@ class RuleFilterDataSourceImpl extends RuleFilterDataSource { Future> getAllTMailRule(AccountId accountId) { return Future.sync(() async { return await _ruleFilterAPI.getListTMailRule(accountId); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override @@ -34,26 +32,20 @@ class RuleFilterDataSourceImpl extends RuleFilterDataSource { return Future.sync(() async { return await _ruleFilterAPI.updateListTMailRule(accountId, deleteEmailRuleRequest.currentEmailRules); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future> createNewEmailRuleFilter(AccountId accountId, CreateNewEmailRuleFilterRequest ruleFilterRequest) { return Future.sync(() async { return await _ruleFilterAPI.updateListTMailRule(accountId, ruleFilterRequest.newListTMailRules); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future> editEmailRuleFilter(AccountId accountId, EditEmailRuleFilterRequest ruleFilterRequest) { return Future.sync(() async { return await _ruleFilterAPI.updateListTMailRule(accountId, ruleFilterRequest.listTMailRulesUpdated); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } } \ No newline at end of file diff --git a/lib/features/manage_account/data/datasource_impl/vacation_data_source_impl.dart b/lib/features/manage_account/data/datasource_impl/vacation_data_source_impl.dart index d49ef9ec0..c6a1d0b1e 100644 --- a/lib/features/manage_account/data/datasource_impl/vacation_data_source_impl.dart +++ b/lib/features/manage_account/data/datasource_impl/vacation_data_source_impl.dart @@ -15,17 +15,13 @@ class VacationDataSourceImpl extends VacationDataSource { Future> getAllVacationResponse(AccountId accountId) { return Future.sync(() async { return await _vacationAPI.getAllVacationResponse(accountId); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future> updateVacation(AccountId accountId, VacationResponse vacationResponse) { return Future.sync(() async { return await _vacationAPI.updateVacation(accountId, vacationResponse); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } } \ No newline at end of file diff --git a/lib/features/manage_account/presentation/email_rules/email_rules_controller.dart b/lib/features/manage_account/presentation/email_rules/email_rules_controller.dart index 5dbf62b0a..5129ad47f 100644 --- a/lib/features/manage_account/presentation/email_rules/email_rules_controller.dart +++ b/lib/features/manage_account/presentation/email_rules/email_rules_controller.dart @@ -271,8 +271,9 @@ class EmailRulesController extends BaseController { Widget _deleteEmailRuleActionTile(BuildContext context, TMailRule rule) { return (EmailRuleBottomSheetActionTileBuilder( const Key('delete_emailRule_action'), - SvgPicture.asset(_imagePaths.icDeleteComposer, - color: AppColor.colorActionDeleteConfirmDialog), + SvgPicture.asset( + _imagePaths.icDeleteComposer, + colorFilter: AppColor.colorActionDeleteConfirmDialog.asFilter()), AppLocalizations.of(context).deleteRule, rule, iconLeftPadding: const EdgeInsets.only(left: 12, right: 16), diff --git a/lib/features/manage_account/presentation/forward/forward_view.dart b/lib/features/manage_account/presentation/forward/forward_view.dart index e02ec6610..bc5f225b2 100644 --- a/lib/features/manage_account/presentation/forward/forward_view.dart +++ b/lib/features/manage_account/presentation/forward/forward_view.dart @@ -140,7 +140,7 @@ class ForwardView extends GetWidget with AppLoaderMixin { _imagePaths.icNotConnection, width: 24, height: 24, - color: Colors.white, + colorFilter: Colors.white.asFilter(), fit: BoxFit.fill), backgroundColor: AppColor.toastErrorBackgroundColor, textColor: Colors.white, diff --git a/lib/features/manage_account/presentation/forward/widgets/email_forward_item_widget.dart b/lib/features/manage_account/presentation/forward/widgets/email_forward_item_widget.dart index bf89f2f30..d3093bee9 100644 --- a/lib/features/manage_account/presentation/forward/widgets/email_forward_item_widget.dart +++ b/lib/features/manage_account/presentation/forward/widgets/email_forward_item_widget.dart @@ -31,7 +31,7 @@ class EmailForwardItemWidget extends StatelessWidget { @override Widget build(BuildContext context) { - final _imagePaths = Get.find(); + final imagePaths = Get.find(); return Padding( padding: const EdgeInsets.only(top: 4), @@ -53,7 +53,7 @@ class EmailForwardItemWidget extends StatelessWidget { recipientForward.selectMode == SelectMode.ACTIVE ? 12 : 0)) ), child: Row(children: [ - _buildAvatarIcon(_imagePaths), + _buildAvatarIcon(imagePaths), const SizedBox(width: 12), Expanded(child: Column( mainAxisSize: MainAxisSize.min, @@ -92,7 +92,7 @@ class EmailForwardItemWidget extends StatelessWidget { buildIconWeb( iconSize: 30, splashRadius: 20, - icon: SvgPicture.asset(_imagePaths.icDeleteRecipient), + icon: SvgPicture.asset(imagePaths.icDeleteRecipient), onTap: () => onDeleteRecipientCallback?.call(recipientForward) ) ]), diff --git a/lib/features/manage_account/presentation/forward/widgets/list_email_forward_widget.dart b/lib/features/manage_account/presentation/forward/widgets/list_email_forward_widget.dart index 92db80010..c985cac34 100644 --- a/lib/features/manage_account/presentation/forward/widgets/list_email_forward_widget.dart +++ b/lib/features/manage_account/presentation/forward/widgets/list_email_forward_widget.dart @@ -82,6 +82,7 @@ class ListEmailForwardsWidget extends GetWidget { color: Colors.transparent, child: InkWell( customBorder: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(5))), + onTap: controller.selectAllRecipientForward, child: Padding( padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12), child: Text( @@ -93,7 +94,6 @@ class ListEmailForwardsWidget extends GetWidget { ) ), ), - onTap: controller.selectAllRecipientForward, ) ); } @@ -107,7 +107,7 @@ class ListEmailForwardsWidget extends GetWidget { buildIconWeb( icon: SvgPicture.asset( _imagePaths.icCloseComposer, - color: AppColor.colorTextButton, + colorFilter: AppColor.colorTextButton.asFilter(), fit: BoxFit.fill), tooltip: AppLocalizations.of(context).cancel, onTap: controller.cancelSelectionMode diff --git a/lib/features/manage_account/presentation/mailbox_visibility/mailbox_visibility_controller.dart b/lib/features/manage_account/presentation/mailbox_visibility/mailbox_visibility_controller.dart index 45a99ddb0..7746143ec 100644 --- a/lib/features/manage_account/presentation/mailbox_visibility/mailbox_visibility_controller.dart +++ b/lib/features/manage_account/presentation/mailbox_visibility/mailbox_visibility_controller.dart @@ -96,10 +96,10 @@ class MailboxVisibilityController extends BaseMailboxController { @override void onReady() { - final _session = _accountDashBoardController.sessionCurrent.value; - final _accountId = _accountDashBoardController.accountId.value; - if(_session != null && _accountId != null) { - getAllMailbox(_session, _accountId); + final session = _accountDashBoardController.sessionCurrent.value; + final accountId = _accountDashBoardController.accountId.value; + if(session != null && accountId != null) { + getAllMailbox(session, accountId); } super.onReady(); } @@ -111,22 +111,22 @@ class MailboxVisibilityController extends BaseMailboxController { } void subscribeMailbox(MailboxNode mailboxNode) { - final _mailboxSubscribeState = mailboxNode.item.isSubscribedMailbox + final mailboxSubscribeState = mailboxNode.item.isSubscribedMailbox ? MailboxSubscribeState.disabled : MailboxSubscribeState.enabled; - final _mailboxSubscribeStateAction = mailboxNode.item.isSubscribedMailbox + final mailboxSubscribeStateAction = mailboxNode.item.isSubscribedMailbox ? MailboxSubscribeAction.unSubscribe : MailboxSubscribeAction.subscribe; _subscribeMailboxAction( SubscribeMailboxRequest( mailboxNode.item.id, - _mailboxSubscribeState, - _mailboxSubscribeStateAction, + mailboxSubscribeState, + mailboxSubscribeStateAction, ) ); } void _subscribeMailboxAction(SubscribeMailboxRequest subscribeMailboxRequest) { - final _accountId = _accountDashBoardController.accountId.value; - if (_accountId != null) { + final accountId = _accountDashBoardController.accountId.value; + if (accountId != null) { final subscribeRequest = generateSubscribeRequest( subscribeMailboxRequest.mailboxId, subscribeMailboxRequest.subscribeState, @@ -134,9 +134,9 @@ class MailboxVisibilityController extends BaseMailboxController { ); if (subscribeRequest is SubscribeMultipleMailboxRequest) { - consumeState(_subscribeMultipleMailboxInteractor!.execute(_accountId, subscribeRequest)); + consumeState(_subscribeMultipleMailboxInteractor!.execute(accountId, subscribeRequest)); } else if (subscribeRequest is SubscribeMailboxRequest) { - consumeState(_subscribeMailboxInteractor!.execute(_accountId, subscribeRequest)); + consumeState(_subscribeMailboxInteractor!.execute(accountId, subscribeRequest)); } } } @@ -196,11 +196,11 @@ class MailboxVisibilityController extends BaseMailboxController { } void _refreshMailboxChanges(jmap.State? newMailboxState) { - final _session = _accountDashBoardController.sessionCurrent.value; - final _accountId = _accountDashBoardController.accountId.value; + final session = _accountDashBoardController.sessionCurrent.value; + final accountId = _accountDashBoardController.accountId.value; final mailboxState = newMailboxState ?? currentMailboxState; - if (_session != null && _accountId != null && mailboxState != null) { - refreshMailboxChanges(_session, _accountId, mailboxState); + if (session != null && accountId != null && mailboxState != null) { + refreshMailboxChanges(session, accountId, mailboxState); } } @@ -224,7 +224,7 @@ class MailboxVisibilityController extends BaseMailboxController { _imagePaths.icFolderMailbox, width: 24, height: 24, - color: Colors.white, + colorFilter: Colors.white.asFilter(), fit: BoxFit.fill ), backgroundColor: AppColor.toastSuccessBackgroundColor, diff --git a/lib/features/manage_account/presentation/mailbox_visibility/widgets/mailbox_visibility_folder_tile_builder.dart b/lib/features/manage_account/presentation/mailbox_visibility/widgets/mailbox_visibility_folder_tile_builder.dart index d60f73f48..61c6cf3fb 100644 --- a/lib/features/manage_account/presentation/mailbox_visibility/widgets/mailbox_visibility_folder_tile_builder.dart +++ b/lib/features/manage_account/presentation/mailbox_visibility/widgets/mailbox_visibility_folder_tile_builder.dart @@ -62,9 +62,9 @@ class MailBoxVisibilityFolderTileBuilder extends StatelessWidget { _mailboxNode.expandMode == ExpandMode.EXPAND ? _imagePaths.icExpandFolder : _imagePaths.icCollapseFolder, - color: _mailboxNode.item.allowedToDisplay - ? AppColor.primaryColor - : AppColor.colorIconUnSubscribedMailbox, + colorFilter: _mailboxNode.item.allowedToDisplay + ? AppColor.primaryColor.asFilter() + : AppColor.colorIconUnSubscribedMailbox.asFilter(), fit: BoxFit.fill ), tooltip: _mailboxNode.expandMode == ExpandMode.EXPAND @@ -120,9 +120,9 @@ class MailBoxVisibilityFolderTileBuilder extends StatelessWidget { _mailboxNode.item.getMailboxIcon(_imagePaths), width: 20, height: 20, - color: _mailboxNode.item.allowedToDisplay - ? AppColor.primaryColor - : AppColor.colorIconUnSubscribedMailbox, + colorFilter: _mailboxNode.item.allowedToDisplay + ? AppColor.primaryColor.asFilter() + : AppColor.colorIconUnSubscribedMailbox.asFilter(), fit: BoxFit.fill ), ); diff --git a/lib/features/manage_account/presentation/manage_account_dashboard_view.dart b/lib/features/manage_account/presentation/manage_account_dashboard_view.dart index 705052817..e554325ea 100644 --- a/lib/features/manage_account/presentation/manage_account_dashboard_view.dart +++ b/lib/features/manage_account/presentation/manage_account_dashboard_view.dart @@ -77,7 +77,7 @@ class ManageAccountDashBoardView extends GetWidget { _imagePaths.icBack, width: 18, height: 18, - color: AppColor.colorTextButton, + colorFilter: AppColor.colorTextButton.asFilter(), fit: BoxFit.fill), Container( margin: const EdgeInsets.only(left: 8), diff --git a/lib/features/manage_account/presentation/menu/widgets/setting_first_level_tile_builder.dart b/lib/features/manage_account/presentation/menu/widgets/setting_first_level_tile_builder.dart index a0b653c6b..63d74ef9c 100644 --- a/lib/features/manage_account/presentation/menu/widgets/setting_first_level_tile_builder.dart +++ b/lib/features/manage_account/presentation/menu/widgets/setting_first_level_tile_builder.dart @@ -30,7 +30,7 @@ class SettingFirstLevelTileBuilder extends StatelessWidget { @override Widget build(BuildContext context) { - return InkWell(child: Padding( + return InkWell(onTap: clickAction,child: Padding( padding: const EdgeInsets.only(top: 24, bottom: 24), child: Row( children: [ @@ -76,11 +76,10 @@ class SettingFirstLevelTileBuilder extends StatelessWidget { icon: SvgPicture.asset( _imagePath.icCollapseFolder, fit: BoxFit.fill, - color: AppColor.colorCollapseMailbox), + colorFilter: AppColor.colorCollapseMailbox.asFilter()), onPressed: clickAction ) ])), - onTap: clickAction, ); } diff --git a/lib/features/manage_account/presentation/vacation/vacation_controller.dart b/lib/features/manage_account/presentation/vacation/vacation_controller.dart index ee805e5fc..7b029916d 100644 --- a/lib/features/manage_account/presentation/vacation/vacation_controller.dart +++ b/lib/features/manage_account/presentation/vacation/vacation_controller.dart @@ -179,7 +179,7 @@ class VacationController extends BaseController { onPrimary: Colors.white, onSurface: Colors.black), textButtonTheme: TextButtonThemeData( - style: TextButton.styleFrom(primary: AppColor.primaryColor))), + style: TextButton.styleFrom(foregroundColor: AppColor.primaryColor))), child: child!); } ); @@ -207,7 +207,7 @@ class VacationController extends BaseController { onPrimary: Colors.white, onSurface: Colors.black), textButtonTheme: TextButtonThemeData( - style: TextButton.styleFrom(primary: AppColor.primaryColor))), + style: TextButton.styleFrom(foregroundColor: AppColor.primaryColor))), child: MediaQuery( data: const MediaQueryData(alwaysUse24HourFormat: false), child: child!), @@ -270,7 +270,7 @@ class VacationController extends BaseController { final messagePlainText = messageTextController.text; final messageHtmlText = (BuildUtils.isWeb ? _vacationMessageHtmlText : await _getMessageHtmlText()) ?? ''; - if (messagePlainText.isEmpty && messageHtmlText.isEmpty) { + if (messagePlainText.isEmpty && messageHtmlText.isEmpty && context.mounted) { _appToast.showToastWithIcon( context, bgColor: AppColor.toastErrorBackgroundColor, diff --git a/lib/features/manage_account/presentation/vacation/vacation_view.dart b/lib/features/manage_account/presentation/vacation/vacation_view.dart index b80ed086d..9557b2ded 100644 --- a/lib/features/manage_account/presentation/vacation/vacation_view.dart +++ b/lib/features/manage_account/presentation/vacation/vacation_view.dart @@ -1,6 +1,5 @@ import 'package:core/core.dart'; -import 'package:enough_html_editor/enough_html_editor.dart' as html_editor_mobile; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:get/get.dart'; @@ -468,7 +467,7 @@ class VacationView extends GetWidget with RichTextButtonMixi ), ); } else { - return html_editor_mobile.HtmlEditor( + return HtmlEditor( key: controller.htmlKey, minHeight: controller.htmlEditorMinHeight, addDefaultSelectionMenuItems: false, diff --git a/lib/features/push_notification/data/datasource_impl/cache_fcm_datasource_impl.dart b/lib/features/push_notification/data/datasource_impl/cache_fcm_datasource_impl.dart index 889a8421d..8827626fc 100644 --- a/lib/features/push_notification/data/datasource_impl/cache_fcm_datasource_impl.dart +++ b/lib/features/push_notification/data/datasource_impl/cache_fcm_datasource_impl.dart @@ -18,27 +18,21 @@ class CacheFCMDatasourceImpl extends FCMDatasource { Future storeStateToRefresh(TypeName typeName, jmap.State newState) { return Future.sync(() async { return await _firebaseCacheManager.storeStateToRefresh(typeName, newState); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future getStateToRefresh(TypeName typeName) { return Future.sync(() async { return await _firebaseCacheManager.getStateToRefresh(typeName); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override Future deleteStateToRefresh(TypeName typeName) { return Future.sync(() async { return await _firebaseCacheManager.deleteStateToRefresh(typeName); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override @@ -64,9 +58,7 @@ class CacheFCMDatasourceImpl extends FCMDatasource { Future geSubscription() { return Future.sync(() async { return await _firebaseCacheManager.getSubscription(); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override diff --git a/lib/features/push_notification/data/datasource_impl/fcm_datasource_impl.dart b/lib/features/push_notification/data/datasource_impl/fcm_datasource_impl.dart index d6a80a1fe..a02391835 100644 --- a/lib/features/push_notification/data/datasource_impl/fcm_datasource_impl.dart +++ b/lib/features/push_notification/data/datasource_impl/fcm_datasource_impl.dart @@ -19,9 +19,7 @@ class FcmDatasourceImpl extends FCMDatasource { Future getFirebaseSubscriptionByDeviceId(String deviceId) { return Future.sync(() async { return await _fcmApi.getFirebaseSubscriptionByDeviceId(deviceId); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override @@ -44,9 +42,7 @@ class FcmDatasourceImpl extends FCMDatasource { return Future.sync(() async { final firebaseSubscription = await _fcmApi.registerNewToken(newTokenRequest); return firebaseSubscription.fromDeviceId(newDeviceId: newTokenRequest.firebaseSubscription.deviceClientId); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override @@ -63,8 +59,6 @@ class FcmDatasourceImpl extends FCMDatasource { Future destroySubscription(String subscriptionId) { return Future.sync(() async { return await _fcmApi.destroySubscription(subscriptionId); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } } \ No newline at end of file diff --git a/lib/features/push_notification/data/local/fcm_cache_manager.dart b/lib/features/push_notification/data/local/fcm_cache_manager.dart index 49ef77d65..ac848cb21 100644 --- a/lib/features/push_notification/data/local/fcm_cache_manager.dart +++ b/lib/features/push_notification/data/local/fcm_cache_manager.dart @@ -51,11 +51,11 @@ class FCMCacheManager { } Future getSubscription() async { - final _fcmSubscription = await _fcmSubscriptionCacheClient.getItem(FCMSubscriptionCache.keyCacheValue); - if (_fcmSubscription == null) { + final fcmSubscription = await _fcmSubscriptionCacheClient.getItem(FCMSubscriptionCache.keyCacheValue); + if (fcmSubscription == null) { throw NotFoundSubscriptionException(); } else { - return _fcmSubscription; + return fcmSubscription; } } } \ No newline at end of file diff --git a/lib/features/push_notification/data/model/fcm_subscription.dart b/lib/features/push_notification/data/model/fcm_subscription.dart index aaef3e936..b7cb0aa26 100644 --- a/lib/features/push_notification/data/model/fcm_subscription.dart +++ b/lib/features/push_notification/data/model/fcm_subscription.dart @@ -5,7 +5,7 @@ import 'package:tmail_ui_user/features/caching/utils/caching_constants.dart'; part 'fcm_subscription.g.dart'; -@HiveType(typeId: CachingConstants.FCM_SUBSCRIPTION_HIVE_CACHE_INDENTITY) +@HiveType(typeId: CachingConstants.FCM_SUBSCRIPTION_HIVE_CACHE_IDENTITY) class FCMSubscriptionCache extends HiveObject with EquatableMixin { static const String keyCacheValue = 'fcmSubscriptionCache'; diff --git a/lib/features/push_notification/data/repository/fcm_repository_impl.dart b/lib/features/push_notification/data/repository/fcm_repository_impl.dart index 92fbf7c02..8ddf6d546 100644 --- a/lib/features/push_notification/data/repository/fcm_repository_impl.dart +++ b/lib/features/push_notification/data/repository/fcm_repository_impl.dart @@ -88,8 +88,8 @@ class FCMRepositoryImpl extends FCMRepository { @override Future getSubscription() async { - final _fcmSubScription = await _fcmDatasource[DataSourceType.local]!.geSubscription(); - return FCMSubscription(_fcmSubScription.deviceId, _fcmSubScription.subscriptionId); + final fcmSubScription = await _fcmDatasource[DataSourceType.local]!.geSubscription(); + return FCMSubscription(fcmSubScription.deviceId, fcmSubScription.subscriptionId); } @override diff --git a/lib/features/push_notification/domain/usecases/get_fcm_subscription_local_interactor.dart b/lib/features/push_notification/domain/usecases/get_fcm_subscription_local_interactor.dart index e045f7ced..43f9e2036 100644 --- a/lib/features/push_notification/domain/usecases/get_fcm_subscription_local_interactor.dart +++ b/lib/features/push_notification/domain/usecases/get_fcm_subscription_local_interactor.dart @@ -12,8 +12,8 @@ class GetFCMSubscriptionLocalInteractor { Stream> execute() async* { try { yield Right(GetFCMSubscriptionLocalLoading()); - final _subscription = await _fcmRepository.getSubscription(); - yield Right(GetFCMSubscriptionLocalSuccess(_subscription)); + final subscription = await _fcmRepository.getSubscription(); + yield Right(GetFCMSubscriptionLocalSuccess(subscription)); } catch (e) { yield Left(GetFCMSubscriptionLocalFailure(e)); } diff --git a/lib/features/quotas/data/datasource_impl/quotas_data_source_impl.dart b/lib/features/quotas/data/datasource_impl/quotas_data_source_impl.dart index 438709ce2..bf01c7975 100644 --- a/lib/features/quotas/data/datasource_impl/quotas_data_source_impl.dart +++ b/lib/features/quotas/data/datasource_impl/quotas_data_source_impl.dart @@ -14,8 +14,6 @@ class QuotasDataSourceImpl extends QuotasDataSource{ Future getQuotas(AccountId accountId) { return Future.sync(() async { return await _quotasAPI.getQuotas(accountId); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } } \ No newline at end of file diff --git a/lib/features/rules_filter_creator/presentation/rules_filter_creator_controller.dart b/lib/features/rules_filter_creator/presentation/rules_filter_creator_controller.dart index 885cb2435..bd4140b5d 100644 --- a/lib/features/rules_filter_creator/presentation/rules_filter_creator_controller.dart +++ b/lib/features/rules_filter_creator/presentation/rules_filter_creator_controller.dart @@ -252,7 +252,7 @@ class RulesFilterCreatorController extends BaseMailboxController { AppRoutes.destinationPicker, arguments: arguments); - if (destinationMailbox is PresentationMailbox) { + if (destinationMailbox is PresentationMailbox && context.mounted) { mailboxSelected.value = destinationMailbox; errorRuleActionValue.value = _getErrorStringByInputValue( context, diff --git a/lib/features/rules_filter_creator/presentation/widgets/rule_filter_button_field.dart b/lib/features/rules_filter_creator/presentation/widgets/rule_filter_button_field.dart index e001fa523..ba2c8f806 100644 --- a/lib/features/rules_filter_creator/presentation/widgets/rule_filter_button_field.dart +++ b/lib/features/rules_filter_creator/presentation/widgets/rule_filter_button_field.dart @@ -27,7 +27,7 @@ class RuleFilterButtonField extends StatelessWidget { @override Widget build(BuildContext context) { - final _imagePaths = Get.find(); + final imagePaths = Get.find(); return InkWell( onTap: () => tapActionCallback?.call(value), @@ -51,7 +51,7 @@ class RuleFilterButtonField extends StatelessWidget { softWrap: CommonTextStyle.defaultSoftWrap, overflow: CommonTextStyle.defaultTextOverFlow, )), - SvgPicture.asset(_imagePaths.icDropDown) + SvgPicture.asset(imagePaths.icDropDown) ]), ), ); diff --git a/lib/features/search/email/presentation/search_email_controller.dart b/lib/features/search/email/presentation/search_email_controller.dart index 246afe15c..989859017 100644 --- a/lib/features/search/email/presentation/search_email_controller.dart +++ b/lib/features/search/email/presentation/search_email_controller.dart @@ -190,26 +190,24 @@ class SearchEmailController extends BaseController void _initWorkerListener() { dashBoardViewStateWorker = ever(mailboxDashBoardController.viewState, (viewState) { - if (viewState is Either) { - viewState.map((success) { - if (success is MarkAsEmailReadSuccess || - success is MoveToMailboxSuccess || - success is MarkAsStarEmailSuccess || - success is DeleteEmailPermanentlySuccess || - success is MarkAsMultipleEmailReadAllSuccess || - success is MarkAsMultipleEmailReadHasSomeEmailFailure || - success is MarkAsStarMultipleEmailAllSuccess || - success is MarkAsStarMultipleEmailHasSomeEmailFailure || - success is MoveMultipleEmailToMailboxAllSuccess || - success is MoveMultipleEmailToMailboxHasSomeEmailFailure || - success is EmptyTrashFolderSuccess || - success is DeleteMultipleEmailsPermanentlyAllSuccess || - success is DeleteMultipleEmailsPermanentlyHasSomeEmailFailure - ) { - _refreshEmailChanges(); - } - }); - } + viewState.map((success) { + if (success is MarkAsEmailReadSuccess || + success is MoveToMailboxSuccess || + success is MarkAsStarEmailSuccess || + success is DeleteEmailPermanentlySuccess || + success is MarkAsMultipleEmailReadAllSuccess || + success is MarkAsMultipleEmailReadHasSomeEmailFailure || + success is MarkAsStarMultipleEmailAllSuccess || + success is MarkAsStarMultipleEmailHasSomeEmailFailure || + success is MoveMultipleEmailToMailboxAllSuccess || + success is MoveMultipleEmailToMailboxHasSomeEmailFailure || + success is EmptyTrashFolderSuccess || + success is DeleteMultipleEmailsPermanentlyAllSuccess || + success is DeleteMultipleEmailsPermanentlyHasSomeEmailFailure + ) { + _refreshEmailChanges(); + } + }); }); } @@ -500,7 +498,10 @@ class SearchEmailController extends BaseController mailboxOption: Some(mailboxSelected), beforeOption: const None() ); - _searchEmailAction(context); + + if (context.mounted) { + _searchEmailAction(context); + } } } } @@ -530,7 +531,7 @@ class SearchEmailController extends BaseController AppRoutes.contact, arguments: arguments); - if (newContact is EmailAddress) { + if (newContact is EmailAddress && context.mounted) { _dispatchApplyContactAction( context, listContactSelected, diff --git a/lib/features/search/email/presentation/search_email_view.dart b/lib/features/search/email/presentation/search_email_view.dart index de2a643ba..c92989e87 100644 --- a/lib/features/search/email/presentation/search_email_view.dart +++ b/lib/features/search/email/presentation/search_email_view.dart @@ -111,7 +111,7 @@ class SearchEmailView extends GetWidget icon: SvgPicture.asset(_imagePaths.icBack, width: 18, height: 18, - color: AppColor.colorTextButton, + colorFilter: AppColor.colorTextButton.asFilter(), fit: BoxFit.fill), tooltip: AppLocalizations.of(context).back, onTap: () => controller.closeSearchView(context) @@ -241,9 +241,9 @@ class SearchEmailView extends GetWidget const SizedBox(width: 4), SvgPicture.asset( _imagePaths.icChevronDownOutline, - color: filterSelected - ? AppColor.primaryColor - : AppColor.colorDefaultRichTextButton, + colorFilter: filterSelected + ? AppColor.primaryColor.asFilter() + : AppColor.colorDefaultRichTextButton.asFilter(), fit: BoxFit.fill), ] ]) @@ -469,8 +469,11 @@ class SearchEmailView extends GetWidget return (EmailActionCupertinoActionSheetActionBuilder( const Key('mark_as_spam_or_un_spam_action'), SvgPicture.asset( - mailboxContain?.isSpam == true ? _imagePaths.icNotSpam : _imagePaths.icSpam, - width: 28, height: 28, fit: BoxFit.fill, color: AppColor.colorTextButton), + mailboxContain?.isSpam == true ? _imagePaths.icNotSpam : _imagePaths.icSpam, + width: 28, + height: 28, + fit: BoxFit.fill, + colorFilter: AppColor.colorTextButton.asFilter()), mailboxContain?.isSpam == true ? AppLocalizations.of(context).remove_from_spam : AppLocalizations.of(context).mark_as_spam, @@ -553,9 +556,9 @@ class SearchEmailView extends GetWidget const SizedBox(width: 4), SvgPicture.asset( _imagePaths.icChevronDownOutline, - color: filterSelected - ? AppColor.primaryColor - : AppColor.colorDefaultRichTextButton, + colorFilter: filterSelected + ? AppColor.primaryColor.asFilter() + : AppColor.colorDefaultRichTextButton.asFilter(), fit: BoxFit.fill), ]) ), @@ -607,9 +610,9 @@ class SearchEmailView extends GetWidget const SizedBox(width: 4), SvgPicture.asset( _imagePaths.icChevronDownOutline, - color: filterSelected - ? AppColor.primaryColor - : AppColor.colorDefaultRichTextButton, + colorFilter: filterSelected + ? AppColor.primaryColor.asFilter() + : AppColor.colorDefaultRichTextButton.asFilter(), fit: BoxFit.fill), ]) ), diff --git a/lib/features/search/email/presentation/widgets/app_bar_selection_mode.dart b/lib/features/search/email/presentation/widgets/app_bar_selection_mode.dart index 83960862a..01e402268 100644 --- a/lib/features/search/email/presentation/widgets/app_bar_selection_mode.dart +++ b/lib/features/search/email/presentation/widgets/app_bar_selection_mode.dart @@ -38,9 +38,10 @@ class AppBarSelectionMode extends StatelessWidget { return Row(children: [ buildIconWeb( - icon: SvgPicture.asset(_imagePaths.icCloseComposer, - color: AppColor.colorTextButton, - fit: BoxFit.fill), + icon: SvgPicture.asset( + _imagePaths.icCloseComposer, + colorFilter: AppColor.colorTextButton.asFilter(), + fit: BoxFit.fill), minSize: 25, iconSize: 25, iconPadding: const EdgeInsets.all(5), @@ -128,11 +129,11 @@ class AppBarSelectionMode extends StatelessWidget { splashRadius: 15, icon: SvgPicture.asset( canDeletePermanently - ? _imagePaths.icDeleteComposer - : _imagePaths.icDelete, - color: canDeletePermanently - ? AppColor.colorDeletePermanentlyButton - : AppColor.primaryColor, + ? _imagePaths.icDeleteComposer + : _imagePaths.icDelete, + colorFilter: canDeletePermanently + ? AppColor.colorDeletePermanentlyButton.asFilter() + : AppColor.primaryColor.asFilter(), width: 20, height: 20, fit: BoxFit.fill), diff --git a/lib/features/search/mailbox/presentation/search_mailbox_controller.dart b/lib/features/search/mailbox/presentation/search_mailbox_controller.dart index 0b1caeae0..7b89b6295 100644 --- a/lib/features/search/mailbox/presentation/search_mailbox_controller.dart +++ b/lib/features/search/mailbox/presentation/search_mailbox_controller.dart @@ -348,7 +348,7 @@ class SearchMailboxController extends BaseMailboxController with MailboxActionHa imagePaths.icFolderMailbox, width: 24, height: 24, - color: Colors.white, + colorFilter: Colors.white.asFilter(), fit: BoxFit.fill), backgroundColor: AppColor.toastSuccessBackgroundColor, textColor: Colors.white, @@ -426,14 +426,14 @@ class SearchMailboxController extends BaseMailboxController with MailboxActionHa MailboxSubscribeState subscribeState, MailboxSubscribeAction subscribeAction ) { - final _accountId = dashboardController.accountId.value; - if (_accountId != null) { + final accountId = dashboardController.accountId.value; + if (accountId != null) { final subscribeRequest = generateSubscribeRequest(mailboxId, subscribeState, subscribeAction); if (subscribeRequest is SubscribeMultipleMailboxRequest) { - consumeState(_subscribeMultipleMailboxInteractor.execute(_accountId, subscribeRequest)); + consumeState(_subscribeMultipleMailboxInteractor.execute(accountId, subscribeRequest)); } else if (subscribeRequest is SubscribeMailboxRequest) { - consumeState(_subscribeMailboxInteractor.execute(_accountId, subscribeRequest)); + consumeState(_subscribeMailboxInteractor.execute(accountId, subscribeRequest)); } } } @@ -524,7 +524,7 @@ class SearchMailboxController extends BaseMailboxController with MailboxActionHa imagePaths.icFolderMailbox, width: 24, height: 24, - color: Colors.white, + colorFilter: Colors.white.asFilter(), fit: BoxFit.fill ), backgroundColor: AppColor.toastSuccessBackgroundColor, @@ -540,8 +540,8 @@ class SearchMailboxController extends BaseMailboxController with MailboxActionHa MailboxId mailboxIdSubscribed, {List? listDescendantMailboxIds} ) { - final _accountId = dashboardController.accountId.value; - if (_accountId != null) { + final accountId = dashboardController.accountId.value; + if (accountId != null) { SubscribeRequest? subscribeRequest; if (listDescendantMailboxIds != null) { @@ -560,9 +560,9 @@ class SearchMailboxController extends BaseMailboxController with MailboxActionHa } if (subscribeRequest is SubscribeMultipleMailboxRequest) { - consumeState(_subscribeMultipleMailboxInteractor.execute(_accountId, subscribeRequest)); + consumeState(_subscribeMultipleMailboxInteractor.execute(accountId, subscribeRequest)); } else if (subscribeRequest is SubscribeMailboxRequest) { - consumeState(_subscribeMailboxInteractor.execute(_accountId, subscribeRequest)); + consumeState(_subscribeMailboxInteractor.execute(accountId, subscribeRequest)); } } } @@ -571,8 +571,8 @@ class SearchMailboxController extends BaseMailboxController with MailboxActionHa MailboxId mailboxIdSubscribed, {List? listDescendantMailboxIds} ) { - final _accountId = dashboardController.accountId.value; - if (_accountId != null) { + final accountId = dashboardController.accountId.value; + if (accountId != null) { SubscribeRequest? subscribeRequest; if (listDescendantMailboxIds != null) { @@ -591,9 +591,9 @@ class SearchMailboxController extends BaseMailboxController with MailboxActionHa } if (subscribeRequest is SubscribeMultipleMailboxRequest) { - consumeState(_subscribeMultipleMailboxInteractor.execute(_accountId, subscribeRequest)); + consumeState(_subscribeMultipleMailboxInteractor.execute(accountId, subscribeRequest)); } else if (subscribeRequest is SubscribeMailboxRequest) { - consumeState(_subscribeMailboxInteractor.execute(_accountId, subscribeRequest)); + consumeState(_subscribeMailboxInteractor.execute(accountId, subscribeRequest)); } } } diff --git a/lib/features/search/mailbox/presentation/search_mailbox_view.dart b/lib/features/search/mailbox/presentation/search_mailbox_view.dart index 432632e00..be67ba063 100644 --- a/lib/features/search/mailbox/presentation/search_mailbox_view.dart +++ b/lib/features/search/mailbox/presentation/search_mailbox_view.dart @@ -82,7 +82,7 @@ class SearchMailboxView extends GetWidget splashRadius: SearchMailboxUtils.getIconSplashRadius(context, controller.responsiveUtils), icon: SvgPicture.asset( controller.imagePaths.icBack, - color: AppColor.colorTextButton, + colorFilter: AppColor.colorTextButton.asFilter(), fit: BoxFit.fill ), tooltip: AppLocalizations.of(context).back, @@ -104,7 +104,7 @@ class SearchMailboxView extends GetWidget iconPadding: EdgeInsets.zero, icon: SvgPicture.asset( controller.imagePaths.icSearchBar, - color: AppColor.colorTextButton, + colorFilter: AppColor.colorTextButton.asFilter(), fit: BoxFit.fill ), tooltip: AppLocalizations.of(context).search, @@ -229,7 +229,7 @@ class SearchMailboxView extends GetWidget width: 24, height: 24, fit: BoxFit.fill, - color: contextMenuItem.action.getColorContextMenuIcon() + colorFilter: contextMenuItem.action.getColorContextMenuIcon().asFilter() ), const SizedBox(width: 12), Expanded(child: Text( diff --git a/lib/features/session/data/datasource_impl/session_datasource_impl.dart b/lib/features/session/data/datasource_impl/session_datasource_impl.dart index 5b68cfc07..f1495400c 100644 --- a/lib/features/session/data/datasource_impl/session_datasource_impl.dart +++ b/lib/features/session/data/datasource_impl/session_datasource_impl.dart @@ -14,8 +14,6 @@ class SessionDataSourceImpl extends SessionDataSource { Future getSession() { return Future.sync(() async { return await _sessionAPI.getSession(); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } } \ No newline at end of file diff --git a/lib/features/thread/data/datasource_impl/local_thread_datasource_impl.dart b/lib/features/thread/data/datasource_impl/local_thread_datasource_impl.dart index 5130d0335..382b48b0d 100644 --- a/lib/features/thread/data/datasource_impl/local_thread_datasource_impl.dart +++ b/lib/features/thread/data/datasource_impl/local_thread_datasource_impl.dart @@ -61,9 +61,7 @@ class LocalThreadDataSourceImpl extends ThreadDataSource { sort: sort, filterOption: filterOption ?? FilterMessageOption.all, limit: limit); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override @@ -77,9 +75,7 @@ class LocalThreadDataSourceImpl extends ThreadDataSource { updated: updated, created: created, destroyed: destroyed); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override diff --git a/lib/features/thread/data/datasource_impl/thread_datasource_impl.dart b/lib/features/thread/data/datasource_impl/thread_datasource_impl.dart index 71aa53470..328d0b052 100644 --- a/lib/features/thread/data/datasource_impl/thread_datasource_impl.dart +++ b/lib/features/thread/data/datasource_impl/thread_datasource_impl.dart @@ -47,9 +47,7 @@ class ThreadDataSourceImpl extends ThreadDataSource { sort: sort, filter: filter, properties: properties); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override @@ -67,9 +65,7 @@ class ThreadDataSourceImpl extends ThreadDataSource { sinceState, propertiesCreated: propertiesCreated, propertiesUpdated: propertiesUpdated); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override @@ -90,9 +86,7 @@ class ThreadDataSourceImpl extends ThreadDataSource { mailboxId, updateDestroyedEmailCache, ); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } @override @@ -100,8 +94,6 @@ class ThreadDataSourceImpl extends ThreadDataSource { return Future.sync(() async { final email = await threadAPI.getEmailById(accountId, emailId, properties: properties); return email.toPresentationEmail(); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } } \ No newline at end of file diff --git a/lib/features/thread/data/network/thread_isolate_worker.dart b/lib/features/thread/data/network/thread_isolate_worker.dart index 445641df5..56faa37ee 100644 --- a/lib/features/thread/data/network/thread_isolate_worker.dart +++ b/lib/features/thread/data/network/thread_isolate_worker.dart @@ -48,10 +48,9 @@ class ThreadIsolateWorker { List emailListCompleted = List.empty(growable: true); try { var hasEmails = true; + Email? lastEmail; while (hasEmails) { - Email? lastEmail; - final emailsResponse = await args.threadAPI.getAllEmail(args.accountId, sort: {}..add( EmailComparator(EmailComparatorProperty.receivedAt) @@ -66,7 +65,7 @@ class ThreadIsolateWorker { log('ThreadIsolateWorker::_emptyTrashFolderAction(): ${newEmailList.length}'); - if (newEmailList.isNotEmpty == true) { + if (newEmailList.isNotEmpty) { lastEmail = newEmailList.last; hasEmails = true; final emailIds = newEmailList.map((email) => email.id).toList(); @@ -98,10 +97,9 @@ class ThreadIsolateWorker { List emailListCompleted = List.empty(growable: true); try { var hasEmails = true; + Email? lastEmail; while (hasEmails) { - Email? lastEmail; - final emailsResponse = await _threadAPI.getAllEmail(accountId, sort: {}..add( EmailComparator(EmailComparatorProperty.receivedAt) @@ -116,7 +114,7 @@ class ThreadIsolateWorker { log('ThreadIsolateWorker::_emptyTrashFolderOnWeb(): ${newEmailList.length}'); - if (newEmailList.isNotEmpty == true) { + if (newEmailList.isNotEmpty) { lastEmail = newEmailList.last; hasEmails = true; final emailIds = newEmailList.map((email) => email.id).toList(); diff --git a/lib/features/thread/presentation/mixin/email_action_controller.dart b/lib/features/thread/presentation/mixin/email_action_controller.dart index cae986fd0..df91e3cca 100644 --- a/lib/features/thread/presentation/mixin/email_action_controller.dart +++ b/lib/features/thread/presentation/mixin/email_action_controller.dart @@ -110,10 +110,10 @@ mixin EmailActionController on ViewAsDialogActionMixin { {PresentationMailbox? mailboxContain} ) async { final accountId = mailboxDashBoardController.accountId.value; - final _session = mailboxDashBoardController.sessionCurrent; + final session = mailboxDashBoardController.sessionCurrent; if (mailboxContain != null && accountId != null) { - final arguments = DestinationPickerArguments(accountId, MailboxActions.moveEmail, _session); + final arguments = DestinationPickerArguments(accountId, MailboxActions.moveEmail, session); if (BuildUtils.isWeb) { showDialogDestinationPicker( @@ -136,6 +136,7 @@ mixin EmailActionController on ViewAsDialogActionMixin { arguments: arguments); if (destinationMailbox != null && + context.mounted && destinationMailbox is PresentationMailbox && mailboxDashBoardController.sessionCurrent != null) { _dispatchMoveToAction( diff --git a/lib/features/thread/presentation/thread_controller.dart b/lib/features/thread/presentation/thread_controller.dart index 6c0b90d9f..027a3ea3c 100644 --- a/lib/features/thread/presentation/thread_controller.dart +++ b/lib/features/thread/presentation/thread_controller.dart @@ -61,7 +61,6 @@ import 'package:tmail_ui_user/features/thread/domain/usecases/search_more_email_ import 'package:tmail_ui_user/features/thread/presentation/extensions/list_presentation_email_extensions.dart'; import 'package:tmail_ui_user/features/thread/presentation/mixin/email_action_controller.dart'; import 'package:tmail_ui_user/features/thread/presentation/model/delete_action_type.dart'; -import 'package:tmail_ui_user/features/thread/presentation/model/search_state.dart'; import 'package:tmail_ui_user/features/thread/presentation/model/search_status.dart'; import 'package:tmail_ui_user/main/exceptions/remote_exception.dart'; import 'package:tmail_ui_user/main/routes/app_routes.dart'; @@ -207,10 +206,8 @@ class ThreadController extends BaseController with EmailActionController { }); ever(searchController.searchState, (searchState) { - if (searchState is SearchState) { - if (searchState.searchStatus == SearchStatus.ACTIVE) { - cancelSelectEmail(); - } + if (searchState.searchStatus == SearchStatus.ACTIVE) { + cancelSelectEmail(); } }); @@ -278,49 +275,47 @@ class ThreadController extends BaseController with EmailActionController { }); ever(mailboxDashBoardController.viewState, (viewState) { - if (viewState is Either) { - viewState.map((success) { - if (success is MarkAsEmailReadSuccess) { - _refreshEmailChanges(currentEmailState: success.currentEmailState); - } else if (success is MoveToMailboxSuccess) { - _refreshEmailChanges(currentEmailState: success.currentEmailState); - } else if (success is MarkAsStarEmailSuccess) { - _refreshEmailChanges(currentEmailState: success.currentEmailState); - } else if (success is DeleteEmailPermanentlySuccess) { - _refreshEmailChanges(currentEmailState: success.currentEmailState); - } else if (success is SaveEmailAsDraftsSuccess) { - _refreshEmailChanges(currentEmailState: success.currentEmailState); - } else if (success is RemoveEmailDraftsSuccess) { - _refreshEmailChanges(currentEmailState: success.currentEmailState); - } else if (success is SendEmailSuccess) { - _refreshEmailChanges(currentEmailState: success.currentEmailState); - } else if (success is UpdateEmailDraftsSuccess) { - _refreshEmailChanges(currentEmailState: success.currentEmailState); - } else if (success is MarkAsMailboxReadAllSuccess) { - _refreshEmailChanges(currentEmailState: success.currentEmailState); - } else if (success is MarkAsMailboxReadHasSomeEmailFailure) { - _refreshEmailChanges(currentEmailState: success.currentEmailState); - } else if (success is MoveMultipleEmailToMailboxAllSuccess) { - _refreshEmailChanges(currentEmailState: success.currentEmailState); - } else if (success is MoveMultipleEmailToMailboxHasSomeEmailFailure) { - _refreshEmailChanges(currentEmailState: success.currentEmailState); - } else if (success is DeleteMultipleEmailsPermanentlyAllSuccess) { - _refreshEmailChanges(currentEmailState: success.currentEmailState); - } else if (success is DeleteMultipleEmailsPermanentlyHasSomeEmailFailure) { - _refreshEmailChanges(currentEmailState: success.currentEmailState); - } else if (success is MarkAsStarMultipleEmailAllSuccess) { - _refreshEmailChanges(currentEmailState: success.currentEmailState); - } else if (success is MarkAsStarMultipleEmailHasSomeEmailFailure) { - _refreshEmailChanges(currentEmailState: success.currentEmailState); - } else if (success is MarkAsMultipleEmailReadAllSuccess) { - _refreshEmailChanges(currentEmailState: success.currentEmailState); - } else if (success is MarkAsMultipleEmailReadHasSomeEmailFailure) { - _refreshEmailChanges(currentEmailState: success.currentEmailState); - } else if (success is EmptyTrashFolderSuccess) { - refreshAllEmail(); - } - }); - } + viewState.map((success) { + if (success is MarkAsEmailReadSuccess) { + _refreshEmailChanges(currentEmailState: success.currentEmailState); + } else if (success is MoveToMailboxSuccess) { + _refreshEmailChanges(currentEmailState: success.currentEmailState); + } else if (success is MarkAsStarEmailSuccess) { + _refreshEmailChanges(currentEmailState: success.currentEmailState); + } else if (success is DeleteEmailPermanentlySuccess) { + _refreshEmailChanges(currentEmailState: success.currentEmailState); + } else if (success is SaveEmailAsDraftsSuccess) { + _refreshEmailChanges(currentEmailState: success.currentEmailState); + } else if (success is RemoveEmailDraftsSuccess) { + _refreshEmailChanges(currentEmailState: success.currentEmailState); + } else if (success is SendEmailSuccess) { + _refreshEmailChanges(currentEmailState: success.currentEmailState); + } else if (success is UpdateEmailDraftsSuccess) { + _refreshEmailChanges(currentEmailState: success.currentEmailState); + } else if (success is MarkAsMailboxReadAllSuccess) { + _refreshEmailChanges(currentEmailState: success.currentEmailState); + } else if (success is MarkAsMailboxReadHasSomeEmailFailure) { + _refreshEmailChanges(currentEmailState: success.currentEmailState); + } else if (success is MoveMultipleEmailToMailboxAllSuccess) { + _refreshEmailChanges(currentEmailState: success.currentEmailState); + } else if (success is MoveMultipleEmailToMailboxHasSomeEmailFailure) { + _refreshEmailChanges(currentEmailState: success.currentEmailState); + } else if (success is DeleteMultipleEmailsPermanentlyAllSuccess) { + _refreshEmailChanges(currentEmailState: success.currentEmailState); + } else if (success is DeleteMultipleEmailsPermanentlyHasSomeEmailFailure) { + _refreshEmailChanges(currentEmailState: success.currentEmailState); + } else if (success is MarkAsStarMultipleEmailAllSuccess) { + _refreshEmailChanges(currentEmailState: success.currentEmailState); + } else if (success is MarkAsStarMultipleEmailHasSomeEmailFailure) { + _refreshEmailChanges(currentEmailState: success.currentEmailState); + } else if (success is MarkAsMultipleEmailReadAllSuccess) { + _refreshEmailChanges(currentEmailState: success.currentEmailState); + } else if (success is MarkAsMultipleEmailReadHasSomeEmailFailure) { + _refreshEmailChanges(currentEmailState: success.currentEmailState); + } else if (success is EmptyTrashFolderSuccess) { + refreshAllEmail(); + } + }); }); } diff --git a/lib/features/thread/presentation/thread_view.dart b/lib/features/thread/presentation/thread_view.dart index 4fc095750..1ad7821b3 100644 --- a/lib/features/thread/presentation/thread_view.dart +++ b/lib/features/thread/presentation/thread_view.dart @@ -228,8 +228,9 @@ class ThreadView extends GetWidget width: 20, height: 20, fit: BoxFit.fill, - color: filter == FilterMessageOption.attachments - ? AppColor.colorTextButton : null), + colorFilter: filter == FilterMessageOption.attachments + ? AppColor.colorTextButton.asFilter() + : null), filter.getName(context), filter, optionCurrent: optionCurrent, @@ -345,20 +346,6 @@ class ThreadView extends GetWidget return Obx(() => Draggable>( maxSimultaneousDrags: kIsWeb ? null : 0, data: controller.listEmailDrag, - child: (EmailTileBuilder( - context, - currentPresentationEmail, - controller.mailboxDashBoardController.currentSelectMode.value, - controller.searchQuery, - controller.mailboxDashBoardController.selectedEmail.value?.id == currentPresentationEmail.id, - mailboxContain: currentPresentationEmail.mailboxContain, - isSearchEmailRunning: controller.searchController.isSearchEmailRunning) - ..addOnPressEmailActionClick((action, email) => - controller.pressEmailAction(context, action, email, mailboxContain: currentPresentationEmail.mailboxContain)) - ..addOnMoreActionClick((email, position) => _responsiveUtils.isScreenWithShortestSide(context) - ? controller.openContextMenuAction(context, _contextMenuActionTile(context, email)) - : controller.openPopupMenuAction(context, position, _popupMenuActionTile(context, email))) - ).build(), feedback: _buildFeedBackWidget(context), childWhenDragging: (EmailTileBuilder( context, @@ -377,6 +364,20 @@ class ThreadView extends GetWidget }, onDragEnd: (_) => controller.onDragMailBox(false), onDraggableCanceled: (_,__) => controller.onDragMailBox(false), + child: (EmailTileBuilder( + context, + currentPresentationEmail, + controller.mailboxDashBoardController.currentSelectMode.value, + controller.searchQuery, + controller.mailboxDashBoardController.selectedEmail.value?.id == currentPresentationEmail.id, + mailboxContain: currentPresentationEmail.mailboxContain, + isSearchEmailRunning: controller.searchController.isSearchEmailRunning) + ..addOnPressEmailActionClick((action, email) => + controller.pressEmailAction(context, action, email, mailboxContain: currentPresentationEmail.mailboxContain)) + ..addOnMoreActionClick((email, position) => _responsiveUtils.isScreenWithShortestSide(context) + ? controller.openContextMenuAction(context, _contextMenuActionTile(context, email)) + : controller.openPopupMenuAction(context, position, _popupMenuActionTile(context, email))) + ).build(), )); }), ) @@ -398,7 +399,7 @@ class ThreadView extends GetWidget width: 24, height: 24, fit: BoxFit.fill, - color: Colors.white, + colorFilter: Colors.white.asFilter(), ), const SizedBox(width: 10), Obx( @@ -545,7 +546,7 @@ class ThreadView extends GetWidget width: 24, height: 24, fit: BoxFit.fill, - color: AppColor.colorTextButton), + colorFilter: AppColor.colorTextButton.asFilter()), mailboxContain?.isSpam == true ? AppLocalizations.of(context).remove_from_spam : AppLocalizations.of(context).mark_as_spam, @@ -572,7 +573,7 @@ class ThreadView extends GetWidget width: 24, height: 24, fit: BoxFit.fill, - color: AppColor.colorTextButton), + colorFilter: AppColor.colorTextButton.asFilter()), AppLocalizations.of(context).openInNewTab, email, iconLeftPadding: _responsiveUtils.isMobile(context) diff --git a/lib/features/thread/presentation/widgets/app_bar_thread_widget_builder.dart b/lib/features/thread/presentation/widgets/app_bar_thread_widget_builder.dart index 112adbaa6..d7856d33f 100644 --- a/lib/features/thread/presentation/widgets/app_bar_thread_widget_builder.dart +++ b/lib/features/thread/presentation/widgets/app_bar_thread_widget_builder.dart @@ -90,9 +90,10 @@ class AppBarThreadWidgetBuilder extends StatelessWidget { Widget _buildBodyAppBarForWebSelection(BuildContext context) { return Row(children: [ buildIconWeb( - icon: SvgPicture.asset(_imagePaths.icCloseComposer, - color: AppColor.colorTextButton, - fit: BoxFit.fill), + icon: SvgPicture.asset( + _imagePaths.icCloseComposer, + colorFilter: AppColor.colorTextButton.asFilter(), + fit: BoxFit.fill), minSize: 25, iconSize: 25, iconPadding: const EdgeInsets.all(5), @@ -178,7 +179,9 @@ class AppBarThreadWidgetBuilder extends StatelessWidget { splashRadius: 15, icon: SvgPicture.asset( canDeletePermanently ? _imagePaths.icDeleteComposer : _imagePaths.icDelete, - color: canDeletePermanently ? AppColor.colorDeletePermanentlyButton : AppColor.primaryColor, + colorFilter: canDeletePermanently + ? AppColor.colorDeletePermanentlyButton.asFilter() + : AppColor.primaryColor.asFilter(), width: 20, height: 20, fit: BoxFit.fill), @@ -289,9 +292,9 @@ class AppBarThreadWidgetBuilder extends StatelessWidget { padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 3), child: SvgPicture.asset( _imagePaths.icFilter, - color: _filterMessageOption == FilterMessageOption.all - ? AppColor.colorFilterMessageDisabled - : AppColor.colorFilterMessageEnabled, + colorFilter: _filterMessageOption == FilterMessageOption.all + ? AppColor.colorFilterMessageDisabled.asFilter() + : AppColor.colorFilterMessageEnabled.asFilter(), fit: BoxFit.fill), ), onTapDown: (detail) { @@ -337,7 +340,7 @@ class AppBarThreadWidgetBuilder extends StatelessWidget { SvgPicture.asset(_imagePaths.icBack, width: 20, height: 20, - color: AppColor.colorTextButton, + colorFilter: AppColor.colorTextButton.asFilter(), fit: BoxFit.fill), const SizedBox(width: 8), _buildCountItemSelected() diff --git a/lib/features/thread/presentation/widgets/search_app_bar_widget.dart b/lib/features/thread/presentation/widgets/search_app_bar_widget.dart index c07ff6c6a..8933397d4 100644 --- a/lib/features/thread/presentation/widgets/search_app_bar_widget.dart +++ b/lib/features/thread/presentation/widgets/search_app_bar_widget.dart @@ -104,7 +104,10 @@ class SearchAppBarWidget { Widget _buildBackButton() { return buildIconWeb( - icon: SvgPicture.asset(_imagePaths.icBack, color: AppColor.colorTextButton, fit: BoxFit.fill), + icon: SvgPicture.asset( + _imagePaths.icBack, + colorFilter: AppColor.colorTextButton.asFilter(), + fit: BoxFit.fill), onTap: () { _searchInputController?.clear(); if (_onCancelSearchPressed != null) { diff --git a/lib/features/thread/presentation/widgets/spam_report_banner_widget.dart b/lib/features/thread/presentation/widgets/spam_report_banner_widget.dart index b84550f3e..e6e66e155 100644 --- a/lib/features/thread/presentation/widgets/spam_report_banner_widget.dart +++ b/lib/features/thread/presentation/widgets/spam_report_banner_widget.dart @@ -11,11 +11,11 @@ class SpamReportBannerWidget extends StatelessWidget { @override Widget build(BuildContext context){ - final _spamReportController = Get.find(); - final _imagePaths = Get.find(); + final spamReportController = Get.find(); + final imagePaths = Get.find(); return Obx(() { - if (!_spamReportController.enableSpamReport || _spamReportController.notShowSpamReportBanner) { + if (!spamReportController.enableSpamReport || spamReportController.notShowSpamReportBanner) { return const SizedBox.shrink(); } return Container( @@ -35,16 +35,16 @@ class SpamReportBannerWidget extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ SvgPicture.asset( - _imagePaths.icInfoCircleOutline, + imagePaths.icInfoCircleOutline, width: 28, height: 28, - color: AppColor.primaryColor, + colorFilter: AppColor.primaryColor.asFilter(), ), const SizedBox( width: 8, ), Text( - AppLocalizations.of(context).countNewSpamEmails(_spamReportController.numberOfUnreadSpamEmails), + AppLocalizations.of(context).countNewSpamEmails(spamReportController.numberOfUnreadSpamEmails), style: const TextStyle( fontSize: 16, color: AppColor.primaryColor, @@ -64,7 +64,7 @@ class SpamReportBannerWidget extends StatelessWidget { context, AppLocalizations.of(context).showDetails, AppColor.primaryColor, - () => _spamReportController.openMailbox(context)), + () => spamReportController.openMailbox(context)), ), const SizedBox( width: 8, @@ -74,7 +74,7 @@ class SpamReportBannerWidget extends StatelessWidget { context, AppLocalizations.of(context).dismiss, AppColor.textFieldErrorBorderColor, - () => _spamReportController + () => spamReportController .dismissSpamReportAction()), ), ], diff --git a/lib/features/upload/data/datasource_impl/attachment_upload_datasource_impl.dart b/lib/features/upload/data/datasource_impl/attachment_upload_datasource_impl.dart index c6f3e4054..f57f0262b 100644 --- a/lib/features/upload/data/datasource_impl/attachment_upload_datasource_impl.dart +++ b/lib/features/upload/data/datasource_impl/attachment_upload_datasource_impl.dart @@ -26,8 +26,6 @@ class AttachmentUploadDataSourceImpl extends AttachmentUploadDataSource { _fileUploader, cancelToken: cancelToken )..upload(); - }).catchError((error) { - _exceptionThrower.throwException(error); - }); + }).catchError(_exceptionThrower.throwException); } } \ No newline at end of file diff --git a/lib/l10n/intl_messages.arb b/lib/l10n/intl_messages.arb index 572dd097d..dc220dd72 100644 --- a/lib/l10n/intl_messages.arb +++ b/lib/l10n/intl_messages.arb @@ -1,5 +1,5 @@ { - "@@last_modified": "2023-02-10T03:40:25.843946", + "@@last_modified": "2023-02-24T11:57:26.810965", "initializing_data": "Initializing data...", "@initializing_data": { "type": "text", @@ -2727,5 +2727,17 @@ "type": "text", "placeholders_order": [], "placeholders": {} + }, + "mailboxVisibility": "Mailbox visibility", + "@mailboxVisibility": { + "type": "text", + "placeholders_order": [], + "placeholders": {} + }, + "mailboxVisibilitySubtitle": "Show/ hide your mailboxes, including your personal and team mailboxes.", + "@mailboxVisibilitySubtitle": { + "type": "text", + "placeholders_order": [], + "placeholders": {} } } \ No newline at end of file diff --git a/lib/main/bindings/network/network_bindings.dart b/lib/main/bindings/network/network_bindings.dart index 6d4576a97..c7110e766 100644 --- a/lib/main/bindings/network/network_bindings.dart +++ b/lib/main/bindings/network/network_bindings.dart @@ -7,7 +7,7 @@ import 'package:dio/dio.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter_appauth/flutter_appauth.dart'; import 'package:get/get.dart'; -import 'package:jmap_dart_client/http/http_client.dart' as JmapHttpClient; +import 'package:jmap_dart_client/http/http_client.dart'; import 'package:tmail_ui_user/features/email/data/network/email_api.dart'; import 'package:tmail_ui_user/features/email/data/network/mdn_api.dart'; import 'package:tmail_ui_user/features/login/data/local/account_cache_manager.dart'; @@ -73,25 +73,25 @@ class NetworkBindings extends Bindings { } void _bindingApi() { - Get.put(JmapHttpClient.HttpClient(Get.find())); + Get.put(HttpClient(Get.find())); Get.put(DownloadClient(Get.find(), Get.find())); Get.put(DownloadManager(Get.find())); - Get.put(MailboxAPI(Get.find())); - Get.put(SessionAPI(Get.find())); - Get.put(ThreadAPI(Get.find())); + Get.put(MailboxAPI(Get.find())); + Get.put(SessionAPI(Get.find())); + Get.put(ThreadAPI(Get.find())); Get.put(EmailAPI( - Get.find(), + Get.find(), Get.find(), Get.find())); - Get.put(RuleFilterAPI(Get.find())); - Get.put(VacationAPI(Get.find())); - Get.put(ContactAPI(Get.find())); - Get.put(IdentityAPI(Get.find())); - Get.put(MdnAPI(Get.find())); - Get.put(ForwardingAPI(Get.find())); - Get.put(QuotasAPI(Get.find())); - Get.put(FcmApi(Get.find())); - Get.put(SpamReportApi(Get.find())); + Get.put(RuleFilterAPI(Get.find())); + Get.put(VacationAPI(Get.find())); + Get.put(ContactAPI(Get.find())); + Get.put(IdentityAPI(Get.find())); + Get.put(MdnAPI(Get.find())); + Get.put(ForwardingAPI(Get.find())); + Get.put(QuotasAPI(Get.find())); + Get.put(FcmApi(Get.find())); + Get.put(SpamReportApi(Get.find())); } void _bindingConnection() { diff --git a/lib/main/bindings/network/network_isolate_binding.dart b/lib/main/bindings/network/network_isolate_binding.dart index 2441b530f..d251ef138 100644 --- a/lib/main/bindings/network/network_isolate_binding.dart +++ b/lib/main/bindings/network/network_isolate_binding.dart @@ -2,7 +2,7 @@ import 'package:core/core.dart'; import 'package:dio/dio.dart'; import 'package:flutter/foundation.dart'; import 'package:get/get.dart'; -import 'package:jmap_dart_client/http/http_client.dart' as JmapHttpClient; +import 'package:jmap_dart_client/http/http_client.dart'; import 'package:tmail_ui_user/features/email/data/network/email_api.dart'; import 'package:tmail_ui_user/features/login/data/local/account_cache_manager.dart'; import 'package:tmail_ui_user/features/login/data/local/token_oidc_cache_manager.dart'; @@ -44,7 +44,7 @@ class NetworkIsolateBindings extends Bindings { } void _bindingApi() { - final JmapHttpClient.HttpClient httpClient = Get.put(JmapHttpClient.HttpClient(Get.find(tag: BindingTag.isolateTag)), tag: BindingTag.isolateTag); + final httpClient = Get.put(HttpClient(Get.find(tag: BindingTag.isolateTag)), tag: BindingTag.isolateTag); Get.put(DownloadClient(Get.find(tag: BindingTag.isolateTag), Get.find()), tag: BindingTag.isolateTag); Get.put(DownloadManager(Get.find(tag: BindingTag.isolateTag)), tag: BindingTag.isolateTag); Get.put(ThreadAPI(httpClient), tag: BindingTag.isolateTag); diff --git a/lib/main/exceptions/cache_exception_thrower.dart b/lib/main/exceptions/cache_exception_thrower.dart index 01e0d18ef..852bdca45 100644 --- a/lib/main/exceptions/cache_exception_thrower.dart +++ b/lib/main/exceptions/cache_exception_thrower.dart @@ -3,7 +3,7 @@ import 'package:tmail_ui_user/main/exceptions/exception_thrower.dart'; class CacheExceptionThrower extends ExceptionThrower { @override - void throwException(dynamic error) { + throwException(dynamic error) { throw error; } } \ No newline at end of file diff --git a/lib/main/exceptions/exception_thrower.dart b/lib/main/exceptions/exception_thrower.dart index 0f71f88e0..9c21dc60c 100644 --- a/lib/main/exceptions/exception_thrower.dart +++ b/lib/main/exceptions/exception_thrower.dart @@ -1,4 +1,4 @@ abstract class ExceptionThrower { - void throwException(dynamic error); + throwException(dynamic error); } diff --git a/lib/main/exceptions/remote_exception_thrower.dart b/lib/main/exceptions/remote_exception_thrower.dart index 1f69411d4..c8b1470d6 100644 --- a/lib/main/exceptions/remote_exception_thrower.dart +++ b/lib/main/exceptions/remote_exception_thrower.dart @@ -11,7 +11,7 @@ import 'package:tmail_ui_user/main/routes/route_navigation.dart'; class RemoteExceptionThrower extends ExceptionThrower { @override - void throwException(dynamic error) { + throwException(dynamic error) { logError('RemoteExceptionThrower::throwException():error: $error'); final networkConnectionController = getBinding(); if (networkConnectionController != null) { diff --git a/model/analysis_options.yaml b/model/analysis_options.yaml index 61b6c4de1..0f32754d3 100644 --- a/model/analysis_options.yaml +++ b/model/analysis_options.yaml @@ -10,20 +10,7 @@ include: package:flutter_lints/flutter.yaml linter: - # The lint rules applied to this project can be customized in the - # section below to disable rules from the `package:flutter_lints/flutter.yaml` - # included above or to enable additional rules. A list of all available lints - # and their documentation is published at - # https://dart-lang.github.io/linter/lints/index.html. - # - # Instead of disabling a lint rule for the entire project in the - # section below, it can also be suppressed for a single line of code - # or a specific dart file by using the `// ignore: name_of_lint` and - # `// ignore_for_file: name_of_lint` syntax on the line or in the file - # producing the lint. rules: - # avoid_print: false # Uncomment to disable the `avoid_print` rule - # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule - -# Additional information about this file can be found at -# https://dart.dev/guides/language/analysis-options + constant_identifier_names: false + non_constant_identifier_names: false + unnecessary_string_escapes: false \ No newline at end of file diff --git a/model/lib/contact/device_contact.dart b/model/lib/contact/device_contact.dart index a11ad9be1..a1cd4a757 100644 --- a/model/lib/contact/device_contact.dart +++ b/model/lib/contact/device_contact.dart @@ -4,7 +4,4 @@ import 'package:model/contact/contact.dart'; class DeviceContact extends Contact implements EquatableMixin { DeviceContact(String displayName, String email) : super(displayName, email); - - @override - List get props => super.props; } diff --git a/model/lib/email/attachment.dart b/model/lib/email/attachment.dart index 444f8aaaa..2d56989d2 100644 --- a/model/lib/email/attachment.dart +++ b/model/lib/email/attachment.dart @@ -32,9 +32,9 @@ class Attachment with EquatableMixin { bool hasCid() => cid != null && cid?.isNotEmpty == true; String getDownloadUrl(String baseDownloadUrl, AccountId accountId) { - final downloadUriTemplate = UriTemplate('$baseDownloadUrl'); + final downloadUriTemplate = UriTemplate(baseDownloadUrl); final downloadUri = downloadUriTemplate.expand({ - 'accountId' : '${accountId.id.value}', + 'accountId' : accountId.id.value, 'blobId' : '${blobId?.value}', 'name' : '$name', 'type' : '${type?.mimeType}', @@ -68,7 +68,7 @@ extension ContentDispositionExtension on ContentDisposition { case ContentDisposition.attachment: return 'attachment'; case ContentDisposition.other: - return this.toString(); + return toString(); } } } diff --git a/model/lib/email/email_content.dart b/model/lib/email/email_content.dart index 7afd10a26..2a7fb2350 100644 --- a/model/lib/email/email_content.dart +++ b/model/lib/email/email_content.dart @@ -36,10 +36,10 @@ extension EmailContentExtension on EmailContent { return ''; } - final firstTags = ''; - final latestTags = ''; + const firstTags = ''; + const latestTags = ''; if (content.startsWith(firstTags) && content.endsWith(latestTags)) { - final firstIndex = firstTags.length; + const firstIndex = firstTags.length; final latestIndex = content.length - latestTags.length; log('EmailContentExtension::_getContentOriginal(): firstIndex: $firstIndex'); log('EmailContentExtension::_getContentOriginal(): latestIndex: $latestIndex'); diff --git a/model/lib/email/email_property.dart b/model/lib/email/email_property.dart index cfb7010f7..867d7a6e9 100644 --- a/model/lib/email/email_property.dart +++ b/model/lib/email/email_property.dart @@ -18,5 +18,5 @@ class EmailProperty { static const String htmlBody = 'htmlBody'; static const String attachments = 'attachments'; static const String headers = 'headers'; - static final String headerMdnKey = 'Disposition-Notification-To'; + static const String headerMdnKey = 'Disposition-Notification-To'; } \ No newline at end of file diff --git a/model/lib/extensions/session_extension.dart b/model/lib/extensions/session_extension.dart index 9621a1770..2792c3eaa 100644 --- a/model/lib/extensions/session_extension.dart +++ b/model/lib/extensions/session_extension.dart @@ -21,9 +21,9 @@ extension SessionExtension on Session { Uri getUploadUri(AccountId accountId) { final baseUrl = '${uploadUrl.origin}${uploadUrl.path}'; - final uploadUriTemplate = UriTemplate('${Uri.decodeFull(baseUrl)}'); + final uploadUriTemplate = UriTemplate(Uri.decodeFull(baseUrl)); final uploadUri = uploadUriTemplate.expand({ - 'accountId' : '${accountId.id.value}' + 'accountId' : accountId.id.value }); log('SessionExtension::getUploadUri(): uploadUri: $uploadUri'); return Uri.parse(uploadUri); diff --git a/model/lib/oidc/oidc_configuration.dart b/model/lib/oidc/oidc_configuration.dart index 5d992c798..ebec65a3d 100644 --- a/model/lib/oidc/oidc_configuration.dart +++ b/model/lib/oidc/oidc_configuration.dart @@ -21,7 +21,7 @@ class OIDCConfiguration with EquatableMixin { if (authority.endsWith('/')) { return authority + wellKnownOpenId; } else { - return authority + '/' + wellKnownOpenId; + return '$authority/$wellKnownOpenId'; } } diff --git a/model/lib/upload/file_info.dart b/model/lib/upload/file_info.dart index 7612093cf..e655968a9 100644 --- a/model/lib/upload/file_info.dart +++ b/model/lib/upload/file_info.dart @@ -1,6 +1,4 @@ -import 'dart:typed_data'; - import 'package:equatable/equatable.dart'; import 'package:flutter/foundation.dart'; import 'package:mime/mime.dart'; diff --git a/model/pubspec.lock b/model/pubspec.lock index d98954965..efc49b6ae 100644 --- a/model/pubspec.lock +++ b/model/pubspec.lock @@ -146,7 +146,7 @@ packages: source: hosted version: "4.4.0" collection: - dependency: transitive + dependency: "direct main" description: name: collection sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 @@ -201,7 +201,7 @@ packages: source: hosted version: "2.2.4" dartz: - dependency: transitive + dependency: "direct main" description: name: dartz sha256: e6acf34ad2e31b1eb00948692468c30ab48ac8250e0f0df661e29f12dd252168 diff --git a/model/pubspec.yaml b/model/pubspec.yaml index 108c3b319..be9b06877 100644 --- a/model/pubspec.yaml +++ b/model/pubspec.yaml @@ -53,6 +53,11 @@ dependencies: mime: 1.0.4 + # flutter_test from sdk depends on collection 1.17.0 + collection: 1.17.0 + + dartz: 0.10.1 + dev_dependencies: flutter_test: sdk: flutter diff --git a/pubspec.lock b/pubspec.lock index 997951d4b..099abdc7c 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -321,7 +321,7 @@ packages: source: hosted version: "0.7.8" debounce_throttle: - dependency: transitive + dependency: "direct main" description: name: debounce_throttle sha256: c95cf47afda975fc507794a52040a16756fb2f31ad3027d4e691c41862ff5692 @@ -542,7 +542,7 @@ packages: source: hosted version: "4.2.1" flutter_appauth_platform_interface: - dependency: transitive + dependency: "direct main" description: name: flutter_appauth_platform_interface sha256: "7b0c6e19e6b9a33098c6a14fb64aca62fccaefd40eccba1c4974d9a9d1fbe95a" @@ -776,7 +776,7 @@ packages: source: sdk version: "0.0.0" fluttertoast: - dependency: transitive + dependency: "direct main" description: name: fluttertoast sha256: "2f9c4d3f4836421f7067a28f8939814597b27614e021da9d63e5d3fb6e212d25" @@ -920,7 +920,7 @@ packages: source: hosted version: "1.1.0" intl: - dependency: transitive + dependency: "direct main" description: name: intl sha256: "910f85bce16fb5c6f614e117efa303e85a1731bb0081edf3604a2ae6e9a3cc91" @@ -1551,7 +1551,7 @@ packages: source: hosted version: "1.3.1" universal_html: - dependency: transitive + dependency: "direct main" description: name: universal_html sha256: b5061c64c7c863c12e46279e032976f1c274f927fb3589b52b5928dcd2d52f7c diff --git a/pubspec.yaml b/pubspec.yaml index c12f45f6a..c47c1b114 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -189,6 +189,17 @@ dependencies: focus_detector_v2: 3.0.0+2 + universal_html: 2.0.9 + + debounce_throttle: 2.0.0 + + flutter_appauth_platform_interface: 5.2.0 + + # flutter_localizations depends on intl 0.17.0 + intl: 0.17.0 + + fluttertoast: 8.2.1 + dev_dependencies: flutter_test: sdk: flutter diff --git a/rule_filter/analysis_options.yaml b/rule_filter/analysis_options.yaml index a5744c1cf..195df9775 100644 --- a/rule_filter/analysis_options.yaml +++ b/rule_filter/analysis_options.yaml @@ -1,4 +1,16 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. include: package:flutter_lints/flutter.yaml -# Additional information about this file can be found at -# https://dart.dev/guides/language/analysis-options +linter: + rules: + constant_identifier_names: false + non_constant_identifier_names: false + unnecessary_string_escapes: false