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
@@ -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);
}
}
@@ -271,8 +271,9 @@ class EmailRulesController extends BaseController {
Widget _deleteEmailRuleActionTile(BuildContext context, TMailRule rule) {
return (EmailRuleBottomSheetActionTileBuilder(
const Key('delete_emailRule_action'),
SvgPicture.asset(_imagePaths.icDeleteComposer,
color: AppColor.colorActionDeleteConfirmDialog),
SvgPicture.asset(
_imagePaths.icDeleteComposer,
colorFilter: AppColor.colorActionDeleteConfirmDialog.asFilter()),
AppLocalizations.of(context).deleteRule,
rule,
iconLeftPadding: const EdgeInsets.only(left: 12, right: 16),
@@ -140,7 +140,7 @@ class ForwardView extends GetWidget<ForwardController> with AppLoaderMixin {
_imagePaths.icNotConnection,
width: 24,
height: 24,
color: Colors.white,
colorFilter: Colors.white.asFilter(),
fit: BoxFit.fill),
backgroundColor: AppColor.toastErrorBackgroundColor,
textColor: Colors.white,
@@ -31,7 +31,7 @@ class EmailForwardItemWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
final _imagePaths = Get.find<ImagePaths>();
final imagePaths = Get.find<ImagePaths>();
return Padding(
padding: const EdgeInsets.only(top: 4),
@@ -53,7 +53,7 @@ class EmailForwardItemWidget extends StatelessWidget {
recipientForward.selectMode == SelectMode.ACTIVE ? 12 : 0))
),
child: Row(children: [
_buildAvatarIcon(_imagePaths),
_buildAvatarIcon(imagePaths),
const SizedBox(width: 12),
Expanded(child: Column(
mainAxisSize: MainAxisSize.min,
@@ -92,7 +92,7 @@ class EmailForwardItemWidget extends StatelessWidget {
buildIconWeb(
iconSize: 30,
splashRadius: 20,
icon: SvgPicture.asset(_imagePaths.icDeleteRecipient),
icon: SvgPicture.asset(imagePaths.icDeleteRecipient),
onTap: () => onDeleteRecipientCallback?.call(recipientForward)
)
]),
@@ -82,6 +82,7 @@ class ListEmailForwardsWidget extends GetWidget<ForwardController> {
color: Colors.transparent,
child: InkWell(
customBorder: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(5))),
onTap: controller.selectAllRecipientForward,
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
child: Text(
@@ -93,7 +94,6 @@ class ListEmailForwardsWidget extends GetWidget<ForwardController> {
)
),
),
onTap: controller.selectAllRecipientForward,
)
);
}
@@ -107,7 +107,7 @@ class ListEmailForwardsWidget extends GetWidget<ForwardController> {
buildIconWeb(
icon: SvgPicture.asset(
_imagePaths.icCloseComposer,
color: AppColor.colorTextButton,
colorFilter: AppColor.colorTextButton.asFilter(),
fit: BoxFit.fill),
tooltip: AppLocalizations.of(context).cancel,
onTap: controller.cancelSelectionMode
@@ -96,10 +96,10 @@ class MailboxVisibilityController extends BaseMailboxController {
@override
void onReady() {
final _session = _accountDashBoardController.sessionCurrent.value;
final _accountId = _accountDashBoardController.accountId.value;
if(_session != null && _accountId != null) {
getAllMailbox(_session, _accountId);
final session = _accountDashBoardController.sessionCurrent.value;
final accountId = _accountDashBoardController.accountId.value;
if(session != null && accountId != null) {
getAllMailbox(session, accountId);
}
super.onReady();
}
@@ -111,22 +111,22 @@ class MailboxVisibilityController extends BaseMailboxController {
}
void subscribeMailbox(MailboxNode mailboxNode) {
final _mailboxSubscribeState = mailboxNode.item.isSubscribedMailbox
final mailboxSubscribeState = mailboxNode.item.isSubscribedMailbox
? MailboxSubscribeState.disabled : MailboxSubscribeState.enabled;
final _mailboxSubscribeStateAction = mailboxNode.item.isSubscribedMailbox
final mailboxSubscribeStateAction = mailboxNode.item.isSubscribedMailbox
? MailboxSubscribeAction.unSubscribe : MailboxSubscribeAction.subscribe;
_subscribeMailboxAction(
SubscribeMailboxRequest(
mailboxNode.item.id,
_mailboxSubscribeState,
_mailboxSubscribeStateAction,
mailboxSubscribeState,
mailboxSubscribeStateAction,
)
);
}
void _subscribeMailboxAction(SubscribeMailboxRequest subscribeMailboxRequest) {
final _accountId = _accountDashBoardController.accountId.value;
if (_accountId != null) {
final accountId = _accountDashBoardController.accountId.value;
if (accountId != null) {
final subscribeRequest = generateSubscribeRequest(
subscribeMailboxRequest.mailboxId,
subscribeMailboxRequest.subscribeState,
@@ -134,9 +134,9 @@ class MailboxVisibilityController extends BaseMailboxController {
);
if (subscribeRequest is SubscribeMultipleMailboxRequest) {
consumeState(_subscribeMultipleMailboxInteractor!.execute(_accountId, subscribeRequest));
consumeState(_subscribeMultipleMailboxInteractor!.execute(accountId, subscribeRequest));
} else if (subscribeRequest is SubscribeMailboxRequest) {
consumeState(_subscribeMailboxInteractor!.execute(_accountId, subscribeRequest));
consumeState(_subscribeMailboxInteractor!.execute(accountId, subscribeRequest));
}
}
}
@@ -196,11 +196,11 @@ class MailboxVisibilityController extends BaseMailboxController {
}
void _refreshMailboxChanges(jmap.State? newMailboxState) {
final _session = _accountDashBoardController.sessionCurrent.value;
final _accountId = _accountDashBoardController.accountId.value;
final session = _accountDashBoardController.sessionCurrent.value;
final accountId = _accountDashBoardController.accountId.value;
final mailboxState = newMailboxState ?? currentMailboxState;
if (_session != null && _accountId != null && mailboxState != null) {
refreshMailboxChanges(_session, _accountId, mailboxState);
if (session != null && accountId != null && mailboxState != null) {
refreshMailboxChanges(session, accountId, mailboxState);
}
}
@@ -224,7 +224,7 @@ class MailboxVisibilityController extends BaseMailboxController {
_imagePaths.icFolderMailbox,
width: 24,
height: 24,
color: Colors.white,
colorFilter: Colors.white.asFilter(),
fit: BoxFit.fill
),
backgroundColor: AppColor.toastSuccessBackgroundColor,
@@ -62,9 +62,9 @@ class MailBoxVisibilityFolderTileBuilder extends StatelessWidget {
_mailboxNode.expandMode == ExpandMode.EXPAND
? _imagePaths.icExpandFolder
: _imagePaths.icCollapseFolder,
color: _mailboxNode.item.allowedToDisplay
? AppColor.primaryColor
: AppColor.colorIconUnSubscribedMailbox,
colorFilter: _mailboxNode.item.allowedToDisplay
? AppColor.primaryColor.asFilter()
: AppColor.colorIconUnSubscribedMailbox.asFilter(),
fit: BoxFit.fill
),
tooltip: _mailboxNode.expandMode == ExpandMode.EXPAND
@@ -120,9 +120,9 @@ class MailBoxVisibilityFolderTileBuilder extends StatelessWidget {
_mailboxNode.item.getMailboxIcon(_imagePaths),
width: 20,
height: 20,
color: _mailboxNode.item.allowedToDisplay
? AppColor.primaryColor
: AppColor.colorIconUnSubscribedMailbox,
colorFilter: _mailboxNode.item.allowedToDisplay
? AppColor.primaryColor.asFilter()
: AppColor.colorIconUnSubscribedMailbox.asFilter(),
fit: BoxFit.fill
),
);
@@ -77,7 +77,7 @@ class ManageAccountDashBoardView extends GetWidget<ManageAccountDashBoardControl
Expanded(child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(child: ManageAccountMenuView(), width: ResponsiveUtils.defaultSizeMenu),
SizedBox(width: ResponsiveUtils.defaultSizeMenu, child: ManageAccountMenuView()),
Expanded(child: Container(
color: AppColor.colorBgDesktop,
child: Column(children: [
@@ -134,7 +134,7 @@ class SettingsView extends GetWidget<SettingsController> {
_imagePaths.icBack,
width: 18,
height: 18,
color: AppColor.colorTextButton,
colorFilter: AppColor.colorTextButton.asFilter(),
fit: BoxFit.fill),
Container(
margin: const EdgeInsets.only(left: 8),
@@ -30,7 +30,7 @@ class SettingFirstLevelTileBuilder extends StatelessWidget {
@override
Widget build(BuildContext context) {
return InkWell(child: Padding(
return InkWell(onTap: clickAction,child: Padding(
padding: const EdgeInsets.only(top: 24, bottom: 24),
child: Row(
children: [
@@ -76,11 +76,10 @@ class SettingFirstLevelTileBuilder extends StatelessWidget {
icon: SvgPicture.asset(
_imagePath.icCollapseFolder,
fit: BoxFit.fill,
color: AppColor.colorCollapseMailbox),
colorFilter: AppColor.colorCollapseMailbox.asFilter()),
onPressed: clickAction
)
])),
onTap: clickAction,
);
}
@@ -179,7 +179,7 @@ class VacationController extends BaseController {
onPrimary: Colors.white,
onSurface: Colors.black),
textButtonTheme: TextButtonThemeData(
style: TextButton.styleFrom(primary: AppColor.primaryColor))),
style: TextButton.styleFrom(foregroundColor: AppColor.primaryColor))),
child: child!);
}
);
@@ -207,7 +207,7 @@ class VacationController extends BaseController {
onPrimary: Colors.white,
onSurface: Colors.black),
textButtonTheme: TextButtonThemeData(
style: TextButton.styleFrom(primary: AppColor.primaryColor))),
style: TextButton.styleFrom(foregroundColor: AppColor.primaryColor))),
child: MediaQuery(
data: const MediaQueryData(alwaysUse24HourFormat: false),
child: child!),
@@ -270,7 +270,7 @@ class VacationController extends BaseController {
final messagePlainText = messageTextController.text;
final messageHtmlText = (BuildUtils.isWeb ? _vacationMessageHtmlText : await _getMessageHtmlText()) ?? '';
if (messagePlainText.isEmpty && messageHtmlText.isEmpty) {
if (messagePlainText.isEmpty && messageHtmlText.isEmpty && context.mounted) {
_appToast.showToastWithIcon(
context,
bgColor: AppColor.toastErrorBackgroundColor,
@@ -1,6 +1,5 @@
import 'package:core/core.dart';
import 'package:enough_html_editor/enough_html_editor.dart' as html_editor_mobile;
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:get/get.dart';
@@ -468,7 +467,7 @@ class VacationView extends GetWidget<VacationController> with RichTextButtonMixi
),
);
} else {
return html_editor_mobile.HtmlEditor(
return HtmlEditor(
key: controller.htmlKey,
minHeight: controller.htmlEditorMinHeight,
addDefaultSelectionMenuItems: false,