TF-1487 Apply linter rule

This commit is contained in:
dab246
2023-02-24 12:12:54 +07:00
committed by Dat Vu
parent 117a8a8fc6
commit 2b71aba278
155 changed files with 798 additions and 1039 deletions
+3 -16
View File
@@ -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
+14 -2
View File
@@ -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
+3 -16
View File
@@ -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
-3
View File
@@ -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';
@@ -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);
}
}
}
@@ -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 '';
+3 -2
View File
@@ -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 {
+1 -1
View File
@@ -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(
+2 -2
View File
@@ -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),
);
}
@@ -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,
);
}
}
@@ -161,7 +161,7 @@ class ButtonBuilder {
width: _size ?? 24,
height: _size ?? 24,
fit: BoxFit.fill,
color: _iconColor));
colorFilter: _iconColor.asFilter()));
Widget _buildText() {
return Text(
@@ -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<Color>((Set<MaterialState> states) => AppColor.colorFocusButton),
shape: MaterialStateProperty.all(const CircleBorder()),
padding: MaterialStateProperty.resolveWith<EdgeInsets>((Set<MaterialState> states) => EdgeInsets.zero),
elevation: MaterialStateProperty.resolveWith<double>((Set<MaterialState> states) => 0)),
onPressed: () => onTap?.call()
onPressed: () => onTap?.call(),
child: Text(
text,
style: textStyle ?? const TextStyle(
fontWeight: FontWeight.normal,
fontSize: 15,
color: AppColor.lineItemListColor
)
)
)
);
}
@@ -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)
@@ -57,7 +57,7 @@ class ScrollingFloatingButtonAnimated extends StatefulWidget {
: super(key: key);
@override
_ScrollingFloatingButtonAnimatedState createState() =>
State<ScrollingFloatingButtonAnimated> 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
? [
@@ -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))),
@@ -156,7 +156,7 @@ class QuickSearchInputForm<T, R> extends FormField<String> {
});
@override
_TypeAheadFormFieldState<T, R> createState() => _TypeAheadFormFieldState<T, R>();
FormFieldState<String> createState() => _TypeAheadFormFieldState<T, R>();
}
class _TypeAheadFormFieldState<T, R> extends FormFieldState<String> {
@@ -567,7 +567,7 @@ class TypeAheadFieldQuickSearch<T, R> extends StatefulWidget {
super(key: key);
@override
_TypeAheadFieldQuickSearchState<T, R> createState() => _TypeAheadFieldQuickSearchState<T, R>();
State<TypeAheadFieldQuickSearch<T, R>> createState() => _TypeAheadFieldQuickSearchState<T, R>();
}
class _TypeAheadFieldQuickSearchState<T, R> extends State<TypeAheadFieldQuickSearch<T, R>>
@@ -678,13 +678,9 @@ class _TypeAheadFieldQuickSearchState<T, R> extends State<TypeAheadFieldQuickSea
void didChangeDependencies() {
super.didChangeDependencies();
ScrollableState? scrollableState = Scrollable.of(context);
if (scrollableState != null) {
// The TypeAheadFieldQuickSearch is inside a scrollable widget
_scrollPosition = scrollableState.position;
_scrollPosition!.removeListener(_scrollResizeListener);
_scrollPosition!.isScrollingNotifier.addListener(_scrollResizeListener);
}
_scrollPosition = scrollableState.position;
_scrollPosition!.removeListener(_scrollResizeListener);
_scrollPosition!.isScrollingNotifier.addListener(_scrollResizeListener);
}
void _scrollResizeListener() {
@@ -1176,7 +1172,6 @@ class _SuggestionsListState<T, R> extends State<_SuggestionsList<T, R>>
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<T, R> extends State<_SuggestionsList<T, R>>
invalidateSuggestions();
}
},
child: widget.actionButtonBuilder!(context, action),
),
);
} else {
@@ -1257,7 +1253,6 @@ class _SuggestionsListState<T, R> extends State<_SuggestionsList<T, R>>
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<T, R> extends State<_SuggestionsList<T, R>>
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<void>.delayed(const Duration(milliseconds: 170));
timer += 170;
if (widgetMounted &&
if (widgetMounted && context.mounted &&
(MediaQuery.of(context).viewInsets != initial ||
_findRootMediaQuery() != initialRootMediaQuery)) {
return true;
@@ -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);
}
}
}
+4 -4
View File
@@ -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) {
+1 -1
View File
@@ -33,4 +33,4 @@ class _Benchmark {
}
}
final _Benchmark bench = _Benchmark();
final bench = _Benchmark();
+6 -5
View File
@@ -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;
}
+3 -3
View File
@@ -34,8 +34,8 @@ class FpsManager {
final List<FpsCallback> _fpsCallbacks = [];
/// Temporarily save 120 frames
static const int _queue_capacity = 120;
final ListQueue framesQueue = ListQueue<FrameTiming>(_queue_capacity);
static const int queueCapacity = 120;
final ListQueue framesQueue = ListQueue<FrameTiming>(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();
}
+14 -2
View File
@@ -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
+14 -2
View File
@@ -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
+7 -7
View File
@@ -78,9 +78,9 @@ abstract class BaseController extends GetxController
return;
}
final _appToast = Get.find<AppToast>();
final _imagePaths = Get.find<ImagePaths>();
final _responsiveUtils = Get.find<ResponsiveUtils>();
final appToast = Get.find<AppToast>();
final imagePaths = Get.find<ImagePaths>();
final responsiveUtils = Get.find<ResponsiveUtils>();
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!));
}
}
@@ -26,10 +26,10 @@ mixin MessageDialogActionMixin {
Color? cancelButtonColor,
}
) {
final _responsiveUtils = Get.find<ResponsiveUtils>();
final _imagePaths = Get.find<ImagePaths>();
final responsiveUtils = Get.find<ResponsiveUtils>();
final imagePaths = Get.find<ImagePaths>();
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)
@@ -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(
@@ -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) {
@@ -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<T> extends StatelessWidget {
@override
Widget build(BuildContext context) {
final _imagePaths = Get.find<ImagePaths>();
final imagePaths = Get.find<ImagePaths>();
return DropdownButtonHideUnderline(
child: PointerInterceptor(
@@ -91,7 +91,7 @@ class DropDownButtonWidget<T> 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<T> 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<T> 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) {
@@ -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(
@@ -133,7 +133,7 @@ class HiveCacheConfig {
);
registerCacheAdapter<FCMSubscriptionCache>(
FCMSubscriptionCacheAdapter(),
CachingConstants.FCM_SUBSCRIPTION_HIVE_CACHE_INDENTITY
CachingConstants.FCM_SUBSCRIPTION_HIVE_CACHE_IDENTITY
);
}
@@ -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<bool> storeVersion(int newVersion) {
return Future.sync(() async {
return await _sharedPreferences.setInt(versionKey, newVersion);
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
}
@@ -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;
}
@@ -30,35 +30,27 @@ class CleanupDataSourceImpl extends CleanupDataSource {
Future<void> cleanEmailCache(EmailCleanupRule cleanupRule) {
return Future.sync(() async {
return await emailCacheManager.clean(cleanupRule);
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
@override
Future<void> cleanRecentSearchCache(RecentSearchCleanupRule cleanupRule) {
return Future.sync(() async {
return await recentSearchCacheManager.clean(cleanupRule);
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
@override
Future<void> cleanRecentLoginUrlCache(RecentLoginUrlCleanupRule cleanupRule) {
return Future.sync(() async {
return await recentLoginUrlCacheManager.clean(cleanupRule);
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
@override
Future<void> cleanRecentLoginUsernameCache(RecentLoginUsernameCleanupRule cleanupRule) {
return Future.sync(() async {
return await recentLoginUsernameCacheManager.clean(cleanupRule);
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
}
@@ -30,8 +30,6 @@ class ComposerDataSourceImpl extends ComposerDataSource {
bytesData: fileInfo.bytes,
maxWidth: maxWidth,
compress: compress);
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
}
@@ -25,9 +25,7 @@ class ContactDataSourceImpl extends ContactDataSource {
return <DeviceContact>[];
}
}
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
List<DeviceContact> _toDeviceContact(contact_service.Contact contact) {
@@ -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,
@@ -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';
@@ -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)
),
@@ -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)
),
@@ -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),
@@ -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),
@@ -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,
@@ -536,7 +536,10 @@ class DestinationPickerView extends GetWidget<DestinationPickerController>
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,
@@ -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
)
);
}
}
@@ -27,27 +27,21 @@ class EmailDataSourceImpl extends EmailDataSource {
Future<Email> 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<bool> 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<List<Email>> markAsRead(AccountId accountId, List<Email> 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<List<EmailId>> 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<List<Email>> markAsStar(AccountId accountId, List<Email> emails, MarkStarAction markStarAction) {
return Future.sync(() async {
return await emailAPI.markAsStar(accountId, emails, markStarAction);
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
@override
Future<Email> 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<bool> 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<Email> 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<List<EmailId>> deleteMultipleEmailsPermanently(AccountId accountId, List<EmailId> emailIds) {
return Future.sync(() async {
return await emailAPI.deleteMultipleEmailsPermanently(accountId, emailIds);
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
@override
Future<bool> deleteEmailPermanently(AccountId accountId, EmailId emailId) {
return Future.sync(() async {
return await emailAPI.deleteEmailPermanently(accountId, emailId);
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
}
@@ -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<EmailContent> addTooltipWhenHoverOnLink(EmailContent emailContent) {
return Future.sync(() async {
return await _htmlAnalyzer.addTooltipWhenHoverOnLink(emailContent);
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
}
@@ -18,8 +18,6 @@ class MdnDataSourceImpl extends MdnDataSource {
Future<MDN?> sendReceiptToSender(AccountId accountId, SendReceiptToSenderRequest request) {
return Future.sync(() async {
return await _mdnAPI.sendReceiptToSender(accountId, request);
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
}
+10 -10
View File
@@ -192,9 +192,9 @@ class EmailView extends GetWidget<SingleEmailController> {
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<SingleEmailController> {
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<SingleEmailController> {
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<SingleEmailController> {
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<SingleEmailController> {
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<SingleEmailController> {
width: 24,
height: 24,
fit: BoxFit.fill,
color: AppColor.colorTextButton),
colorFilter: AppColor.colorTextButton.asFilter()),
AppLocalizations.of(context).quickCreatingRule,
email,
iconLeftPadding: responsiveUtils.isMobile(context)
@@ -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),
@@ -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)
),
@@ -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';
@@ -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<IdentityCreatorController> {
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<IdentityCreatorController> {
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<IdentityCreatorController> {
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,
@@ -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<OIDCConfiguration> getOIDCConfiguration(OIDCResponse oidcResponse) {
return Future.sync(() async {
return await _oidcHttpClient.getOIDCConfiguration(oidcResponse);
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
@override
Future<TokenOIDC> getTokenOIDC(String clientId, String redirectUrl, String discoveryUrl, List<String> scopes) {
return Future.sync(() async {
return await _authenticationClient.getTokenOIDC(clientId, redirectUrl, discoveryUrl, scopes);
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
@override
Future<TokenOIDC> getStoredTokenOIDC(String tokenIdHash) {
return Future.sync(() async {
return await _tokenOidcCacheManager.getTokenOidc(tokenIdHash);
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
@override
Future<void> persistTokenOIDC(TokenOIDC tokenOidc) {
return Future.sync(() async {
return await _tokenOidcCacheManager.persistOneTokenOidc(tokenOidc);
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
@override
Future<OIDCConfiguration> getStoredOidcConfiguration() {
return Future.sync(() async {
return await _oidcConfigurationCacheManager.getOidcConfiguration();
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
@override
Future<void> 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<bool> 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<void> 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<String?> getAuthenticationInfo() {
return Future.sync(() async {
return await _authenticationClient.getAuthenticationInfo();
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
@override
Future<void> deleteTokenOIDC() {
return Future.sync(() async {
return await _tokenOidcCacheManager.deleteTokenOidc();
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
}
@@ -14,26 +14,20 @@ class HiveAccountDatasourceImpl extends AccountDatasource {
Future<Account> getCurrentAccount() {
return Future.sync(() async {
return await _accountCacheManager.getSelectedAccount();
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
@override
Future<void> setCurrentAccount(Account newCurrentAccount) {
return Future.sync(() async {
return await _accountCacheManager.setSelectedAccount(newCurrentAccount);
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
@override
Future<void> deleteCurrentAccount(String accountId) {
return Future.sync(() async {
return await _accountCacheManager.deleteSelectedAccount(accountId);
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
}
@@ -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) {
@@ -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(
@@ -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;
@@ -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()
)
),
);
@@ -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) {
@@ -43,9 +43,7 @@ class MailboxCacheDataSourceImpl extends MailboxDataSource {
Future<void> update({List<Mailbox>? updated, List<Mailbox>? created, List<MailboxId>? 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
@@ -35,18 +35,14 @@ class MailboxDataSourceImpl extends MailboxDataSource {
Future<MailboxResponse> 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<MailboxChangeResponse> 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<Mailbox?> 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<Map<Id,SetError>> deleteMultipleMailbox(Session session, AccountId accountId, List<MailboxId> mailboxIds) {
return Future.sync(() async {
return await mailboxAPI.deleteMultipleMailbox(session, accountId, mailboxIds);
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
@override
Future<bool> 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<bool> 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<bool> 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<List<MailboxId>> subscribeMultipleMailbox(AccountId accountId, SubscribeMultipleMailboxRequest subscribeRequest) {
return Future.sync(() async {
return await mailboxAPI.subscribeMultipleMailbox(accountId, subscribeRequest);
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
}
@@ -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);
}
}
@@ -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<Either<Failure, Success>> execute(Session session, AccountId accountId, jmapState.State currentState) async* {
Stream<Either<Failure, Success>> execute(Session session, AccountId accountId, jmap_state.State currentState) async* {
try {
yield Right<Failure, Success>(RefreshingState());
@@ -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<MailboxId>? 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));
}
}
}
@@ -221,7 +221,7 @@ class MailboxView extends GetWidget<MailboxController>
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<MailboxController>
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<MailboxController>
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),
@@ -151,7 +151,7 @@ class MailboxView extends GetWidget<MailboxController>
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<MailboxController>
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<MailboxController>
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<MailboxController>
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,
@@ -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
@@ -53,8 +53,8 @@ class MailboxNode with EquatableMixin{
}
List<MailboxNode>? updateNode(MailboxId mailboxId, MailboxNode newNode, {MailboxNode? parent}) {
List<MailboxNode>? _children = parent == null ? childrenItems : parent.childrenItems;
return _children?.map((MailboxNode child) {
List<MailboxNode>? 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<MailboxNode>? toggleSelectNode(MailboxNode selectedMailboxMode, {MailboxNode? parent}) {
List<MailboxNode>? _children = parent == null ? childrenItems : parent.childrenItems;
return _children?.map((MailboxNode child) {
List<MailboxNode>? 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<MailboxNode>? toSelectedNode({required SelectMode selectMode, ExpandMode? newExpandMode, MailboxNode? parent}) {
List<MailboxNode>? _children = parent == null ? childrenItems : parent.childrenItems;
return _children?.map((MailboxNode child) {
List<MailboxNode>? 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),
@@ -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),
@@ -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,
@@ -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: () => {}))
]),
);
@@ -13,9 +13,9 @@ class CompositeNameValidator extends Validator<NewNameRequest> {
CompositeNameValidator(this._listValidator);
@override
Either<Failure, Success> validate(NewNameRequest newNameRequest) {
Either<Failure, Success> validate(NewNameRequest value) {
return _listValidator.isNotEmpty
? _listValidator.getValidatorNameViewState(newNameRequest)
? _listValidator.getValidatorNameViewState(value)
: Right<Failure, Success>(VerifyNameViewState());
}
}
@@ -11,11 +11,11 @@ class DuplicateNameValidator extends Validator<NewNameRequest> {
DuplicateNameValidator(this._listName);
@override
Either<Failure, Success> validate(NewNameRequest newNameRequest) {
if (newNameRequest.value != null) {
Either<Failure, Success> 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<Failure, Success>(VerifyNameFailure(const DuplicatedNameException()));
} else {
@@ -10,8 +10,8 @@ import 'package:tmail_ui_user/features/mailbox_creator/domain/state/verify_name_
class EmailAddressValidator extends Validator<NewNameRequest> {
@override
Either<Failure, Success> validate(NewNameRequest newNameRequest) {
if (newNameRequest.value != null && GetUtils.isEmail(newNameRequest.value!)) {
Either<Failure, Success> validate(NewNameRequest value) {
if (value.value != null && GetUtils.isEmail(value.value!)) {
return Right<Failure, Success>(VerifyNameViewState());
} else {
return Left<Failure, Success>(VerifyNameFailure(const EmailAddressInvalidException()));
@@ -9,8 +9,8 @@ import 'package:tmail_ui_user/features/mailbox_creator/domain/state/verify_name_
class EmptyNameValidator extends Validator<NewNameRequest> {
@override
Either<Failure, Success> validate(NewNameRequest newNameRequest) {
if (newNameRequest.value == null || newNameRequest.value!.isEmpty) {
Either<Failure, Success> validate(NewNameRequest value) {
if (value.value == null || value.value!.isEmpty) {
return Left<Failure, Success>(VerifyNameFailure(const EmptyNameException()));
} else {
return Right<Failure, Success>(VerifyNameViewState());
@@ -10,8 +10,8 @@ import 'package:tmail_ui_user/features/mailbox_creator/domain/state/verify_name_
class SpecialCharacterValidator extends Validator<NewNameRequest> {
@override
Either<Failure, Success> validate(NewNameRequest newNameRequest) {
if (newNameRequest.value != null && newNameRequest.value!.hasSpecialCharactersInName()) {
Either<Failure, Success> validate(NewNameRequest value) {
if (value.value != null && value.value!.hasSpecialCharactersInName()) {
return Left<Failure, Success>(VerifyNameFailure(const SpecialCharacterException()));
} else {
return Right<Failure, Success>(VerifyNameViewState());
@@ -180,7 +180,7 @@ class MailboxCreatorView extends GetWidget<MailboxCreatorController> {
color: AppColor.primaryColor,
icon: SvgPicture.asset(
_imagePaths.icCollapseFolder,
color: AppColor.colorCollapseMailbox,
colorFilter: AppColor.colorCollapseMailbox.asFilter(),
fit: BoxFit.fill),
onPressed: () => controller.selectMailboxLocation(context))
])),
@@ -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) {
@@ -16,27 +16,21 @@ class SharePreferenceSpamReportDataSourceImpl extends SpamReportDataSource {
Future<DateTime> getLastTimeDismissedSpamReported() async {
return Future.sync(() async {
return await _sharePreferenceSpamReportDataSource.getLastTimeDismissedSpamReported();
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
@override
Future<bool> storeLastTimeDismissedSpamReported(DateTime lastTimeDismissedSpamReported) async {
return Future.sync(() async {
return await _sharePreferenceSpamReportDataSource.storeLastTimeDismissedSpamReported(lastTimeDismissedSpamReported);
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
@override
Future<bool> 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<void> deleteSpamReportState() {
return Future.sync(() async {
return await _sharePreferenceSpamReportDataSource.deleteLastTimeDismissedSpamReported();
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
@override
Future<SpamReportState> getSpamReportState() {
return Future.sync(() async {
return await _sharePreferenceSpamReportDataSource.getSpamReportState();
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
@override
Future<void> storeSpamReportState(SpamReportState spamReportState) {
return Future.sync(() async {
return await _sharePreferenceSpamReportDataSource.storeSpamReportState(spamReportState);
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
}
@@ -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
@@ -14,15 +14,15 @@ class SharePreferenceSpamReportDataSource extends SpamReportDataSource {
@override
Future<DateTime> 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<bool> 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<SpamReportState> 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<bool> 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);
}
}
@@ -40,12 +40,12 @@ class SpamReportApi {
.build()
.execute();
final _mailboxResponse = result
final mailboxResponse = result
.parse<GetMailboxResponse>(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;
});
@@ -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());
}
@@ -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) {
@@ -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) {
@@ -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<MailboxDashBoardController>();
final mailboxDashBoardController = Get.find<MailboxDashBoardController>();
dismissSpamReportAction();
_mailboxDashBoardController.openMailboxAction(context, _presentationSpamMailbox.value!);
mailboxDashBoardController.openMailboxAction(context, _presentationSpamMailbox.value!);
}
void storeSpamReportStateAction(SpamReportState spamReportState) {
@@ -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
),
),
)
)
)
@@ -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(
@@ -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<void> showAdvancedSearchFilterBottomSheet(BuildContext context) async {
final ImagePaths _imagePaths = Get.find<ImagePaths>();
final ImagePaths imagePaths = Get.find<ImagePaths>();
await FullScreenActionSheetBuilder(
context: context,
@@ -19,8 +19,8 @@ Future<void> 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,
),
@@ -18,15 +18,15 @@ class AdvancedSearchFilterFormBottomView extends GetWidget<AdvancedFilterControl
@override
Widget build(BuildContext context) {
final _responsiveUtils = Get.find<ResponsiveUtils>();
final responsiveUtils = Get.find<ResponsiveUtils>();
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<AdvancedFilterControl
const SizedBox(height: 24)
],
Row(
mainAxisAlignment: _isMobileAndLandscapeTablet(context, _responsiveUtils)
mainAxisAlignment: _isMobileAndLandscapeTablet(context, responsiveUtils)
? MainAxisAlignment.spaceEvenly
: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
if (!_isMobileAndLandscapeTablet(context, _responsiveUtils))
if (!_isMobileAndLandscapeTablet(context, responsiveUtils))
Expanded(child: _buildCheckboxHasAttachment(
context,
currentFocusNode: focusManager?.attachmentCheckboxFocusNode,
nextFocusNode: focusManager?.searchButtonFocusNode)),
..._buildListButton(context, _responsiveUtils),
..._buildListButton(context, responsiveUtils),
],
),
],
@@ -42,7 +42,7 @@ Widget _buildDropDownButton<T>({
DateTime? startDate,
DateTime? endDate
}) {
final ImagePaths _imagePaths = Get.find<ImagePaths>();
final ImagePaths imagePaths = Get.find<ImagePaths>();
return DropdownButtonHideUnderline(
child: DropdownButton2<T>(
@@ -68,7 +68,7 @@ Widget _buildDropDownButton<T>({
.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),
@@ -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: () {
@@ -19,7 +19,7 @@ class DownloadTaskItemWidget extends StatelessWidget with AppLoaderMixin {
@override
Widget build(BuildContext context) {
final _imagePaths = Get.find<ImagePaths>();
final imagePaths = Get.find<ImagePaths>();
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),
@@ -12,10 +12,10 @@ class SpamReportBannerWebWidget extends StatelessWidget {
@override
Widget build(BuildContext context){
final _spamReportController = Get.find<SpamReportController>();
final _imagePaths = Get.find<ImagePaths>();
final spamReportController = Get.find<SpamReportController>();
final imagePaths = Get.find<ImagePaths>();
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(),
),
),
],
@@ -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),
@@ -18,35 +18,27 @@ class ForwardingDataSourceImpl extends ForwardingDataSource {
Future<TMailForward> getForward(AccountId accountId) {
return Future.sync(() async {
return await _forwardingAPI.getForward(accountId);
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
@override
Future<TMailForward> 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<TMailForward> 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<TMailForward> editLocalCopyInForwarding(AccountId accountId, EditLocalCopyInForwardingRequest editRequest) {
return Future.sync(() async {
return await _forwardingAPI.updateForward(accountId, editRequest.newTMailForward);
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
}
@@ -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<Identity> 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<bool> 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<bool> editIdentity(AccountId accountId, EditIdentityRequest editIdentityRequest) {
return Future.sync(() async {
return await _identityAPI.editIdentity(accountId, editIdentityRequest);
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
}
@@ -18,8 +18,6 @@ class ManageAccountDataSourceImpl extends ManageAccountDataSource {
Future<void> persistLanguage(Locale localeCurrent) {
return Future.sync(() async {
return await _languageCacheManager.persistLanguage(localeCurrent);
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
}
@@ -22,9 +22,7 @@ class RuleFilterDataSourceImpl extends RuleFilterDataSource {
Future<List<TMailRule>> 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<List<TMailRule>> 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<List<TMailRule>> editEmailRuleFilter(AccountId accountId, EditEmailRuleFilterRequest ruleFilterRequest) {
return Future.sync(() async {
return await _ruleFilterAPI.updateListTMailRule(accountId, ruleFilterRequest.listTMailRulesUpdated);
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
}
@@ -15,17 +15,13 @@ class VacationDataSourceImpl extends VacationDataSource {
Future<List<VacationResponse>> getAllVacationResponse(AccountId accountId) {
return Future.sync(() async {
return await _vacationAPI.getAllVacationResponse(accountId);
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
@override
Future<List<VacationResponse>> updateVacation(AccountId accountId, VacationResponse vacationResponse) {
return Future.sync(() async {
return await _vacationAPI.updateVacation(accountId, vacationResponse);
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
}

Some files were not shown because too many files have changed in this diff Show More