TF-528 Apply linter for some widget

This commit is contained in:
dab246
2022-05-04 11:15:37 +07:00
committed by Dat H. Pham
parent dbbc13eab4
commit 4088c88649
35 changed files with 198 additions and 223 deletions
@@ -20,14 +20,14 @@ abstract class BaseMailboxController extends BaseController {
List<PresentationMailbox> allMailboxes = <PresentationMailbox>[];
Future buildTree(List<PresentationMailbox> allMailbox) async {
this.allMailboxes = allMailbox;
allMailboxes = allMailbox;
final tupleTree = await _treeBuilder.generateMailboxTreeInUI(allMailbox);
defaultMailboxTree.value = tupleTree.value1;
folderMailboxTree.value = tupleTree.value2;
}
Future refreshTree(List<PresentationMailbox> allMailbox) async {
this.allMailboxes = allMailbox;
allMailboxes = allMailbox;
final tupleTree = await _treeBuilder.generateMailboxTreeInUIAfterRefreshChanges(
allMailbox, defaultMailboxTree.value, folderMailboxTree.value);
defaultMailboxTree.firstRebuild = true;
@@ -5,7 +5,7 @@ import 'package:flutter/cupertino.dart';
mixin AppLoaderMixin {
Widget get loadingWidget {
return Center(child: SizedBox(
return const Center(child: SizedBox(
width: 24,
height: 24,
child: CupertinoActivityIndicator(color: AppColor.colorLoading)));
@@ -21,7 +21,7 @@ mixin MessageDialogActionMixin {
if (_responsiveUtils.isMobile(context)) {
(ConfirmationDialogActionSheetBuilder(context)
..messageText(message)
..styleConfirmButton(TextStyle(fontSize: 20, fontWeight: FontWeight.normal, color: Colors.black))
..styleConfirmButton(const TextStyle(fontSize: 20, fontWeight: FontWeight.normal, color: Colors.black))
..onCancelAction(AppLocalizations.of(context).cancel, () => popBack())
..onConfirmAction(actionName, () {
popBack();
@@ -32,20 +32,20 @@ mixin MessageDialogActionMixin {
context: context,
barrierColor: AppColor.colorDefaultCupertinoActionSheet,
builder: (BuildContext context) => PointerInterceptor(child: (ConfirmDialogBuilder(_imagePaths)
..key(Key('confirm_dialog_action'))
..key(const Key('confirm_dialog_action'))
..title(title ?? '')
..content(message)
..addIcon(icon)
..colorConfirmButton(AppColor.colorTextButton)
..colorCancelButton(AppColor.colorCancelButton)
..paddingTitle(icon != null ? EdgeInsets.only(top: 34) : EdgeInsets.zero)
..paddingTitle(icon != null ? const EdgeInsets.only(top: 34) : EdgeInsets.zero)
..marginIcon(EdgeInsets.zero)
..paddingContent(EdgeInsets.only(left: 44, right: 44, bottom: 24, top: 8))
..paddingButton(hasCancelButton ? null : EdgeInsets.only(bottom: 16, left: 44, right: 44))
..styleTitle(TextStyle(fontSize: 20, fontWeight: FontWeight.bold, color: Colors.black))
..styleContent(TextStyle(fontSize: 14, fontWeight: FontWeight.normal, color: AppColor.colorContentEmail))
..styleTextCancelButton(TextStyle(fontSize: 17, fontWeight: FontWeight.w500, color: AppColor.colorTextButton))
..styleTextConfirmButton(TextStyle(fontSize: 17, fontWeight: FontWeight.w500, color: Colors.white))
..paddingContent(const EdgeInsets.only(left: 44, right: 44, bottom: 24, top: 8))
..paddingButton(hasCancelButton ? null : const EdgeInsets.only(bottom: 16, left: 44, right: 44))
..styleTitle(const TextStyle(fontSize: 20, fontWeight: FontWeight.bold, color: Colors.black))
..styleContent(const TextStyle(fontSize: 14, fontWeight: FontWeight.normal, color: AppColor.colorContentEmail))
..styleTextCancelButton(const TextStyle(fontSize: 17, fontWeight: FontWeight.w500, color: AppColor.colorTextButton))
..styleTextConfirmButton(const TextStyle(fontSize: 17, fontWeight: FontWeight.w500, color: Colors.white))
..onConfirmButtonAction(actionName, () {
popBack();
onConfirmAction.call();
@@ -15,17 +15,17 @@ mixin NetworkConnectionMixin {
color: Colors.white,
borderRadius: BorderRadius.circular(16)),
width: 320,
margin: EdgeInsets.only(bottom: 100),
margin: const EdgeInsets.only(bottom: 100),
child: Material(
elevation: 8,
shape: RoundedRectangleBorder(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(16.0)),
),
child: ListTile(
leading: SvgPicture.asset(_imagePaths.icNotConnection),
title: Text(
AppLocalizations.of(context).no_internet_connection,
style: TextStyle(fontSize: 15, color: Colors.black)),
style: const TextStyle(fontSize: 15, color: Colors.black)),
)
)
);
@@ -2,7 +2,7 @@ import 'dart:io';
import 'package:get/get.dart';
import 'package:hive/hive.dart';
import 'package:path_provider/path_provider.dart' as pathProvider;
import 'package:path_provider/path_provider.dart' as path_provider;
import 'package:tmail_ui_user/features/mailbox/data/model/mailbox_cache.dart';
import 'package:tmail_ui_user/features/mailbox/data/model/mailbox_rights_cache.dart';
import 'package:tmail_ui_user/features/mailbox/data/model/state_cache.dart';
@@ -22,7 +22,7 @@ class HiveCacheConfig {
Hive.init(databasePath);
} else {
if (!GetPlatform.isWeb) {
Directory directory = await pathProvider.getApplicationDocumentsDirectory();
Directory directory = await path_provider.getApplicationDocumentsDirectory();
Hive.init(directory.path);
}
}
@@ -22,6 +22,8 @@ class DestinationPickerView extends GetWidget<DestinationPickerController> {
final _imagePaths = Get.find<ImagePaths>();
final _responsiveUtils = Get.find<ResponsiveUtils>();
DestinationPickerView({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
MailboxActions? actions;
@@ -157,15 +159,15 @@ class DestinationPickerView extends GetWidget<DestinationPickerController> {
Widget _buildLoadingView() {
return Obx(() => controller.viewState.value.fold(
(failure) => SizedBox.shrink(),
(failure) => const SizedBox.shrink(),
(success) => success is LoadingState
? Center(child: Padding(
? const Center(child: Padding(
padding: EdgeInsets.only(top: 16),
child: SizedBox(
width: 24,
height: 24,
child: CircularProgressIndicator(color: AppColor.primaryColor))))
: SizedBox.shrink()));
: const SizedBox.shrink()));
}
Widget _buildListMailbox(BuildContext context, MailboxActions? actions) {
@@ -178,18 +180,18 @@ class DestinationPickerView extends GetWidget<DestinationPickerController> {
if (actions == MailboxActions.create && !BuildUtils.isWeb && _responsiveUtils.isScreenWithShortestSide(context))
const SizedBox(height: 12),
if (actions == MailboxActions.create) _buildUnifiedMailbox(context),
SizedBox(height: 12),
const SizedBox(height: 12),
Obx(() => controller.defaultMailboxTree.value.root.childrenItems?.isNotEmpty ?? false
? _buildMailboxCategory(context, MailboxCategories.exchange, controller.defaultMailboxTree.value.root, actions)
: SizedBox.shrink()),
if (actions == MailboxActions.create) SizedBox(height: 12),
: const SizedBox.shrink()),
if (actions == MailboxActions.create) const SizedBox(height: 12),
if (actions != MailboxActions.create && !kIsWeb)
Padding(
const Padding(
padding: EdgeInsets.only(left: 60),
child: Divider(color: AppColor.lineItemListColor, height: 0.5, thickness: 0.2)),
Obx(() => controller.folderMailboxTree.value.root.childrenItems?.isNotEmpty ?? false
? _buildMailboxCategory(context, MailboxCategories.folders, controller.folderMailboxTree.value.root, actions)
: SizedBox.shrink()),
: const SizedBox.shrink()),
]
);
}
@@ -201,10 +203,10 @@ class DestinationPickerView extends GetWidget<DestinationPickerController> {
return Column(children: [
_buildHeaderMailboxCategory(context, categories),
AnimatedContainer(
duration: Duration(milliseconds: 400),
duration: const Duration(milliseconds: 400),
child: categories.getExpandMode(controller.mailboxCategoriesExpandMode.value) == ExpandMode.EXPAND
? _buildBodyMailboxCategory(context, categories, mailboxNode, actions)
: Offstage())
: const Offstage())
]);
}
@@ -217,7 +219,7 @@ class DestinationPickerView extends GetWidget<DestinationPickerController> {
Expanded(child: Text(categories.getTitle(context),
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(fontSize: 20, color: Colors.black, fontWeight: FontWeight.bold))),
style: const TextStyle(fontSize: 20, color: Colors.black, fontWeight: FontWeight.bold))),
buildIconWeb(
icon: SvgPicture.asset(
categories.getExpandMode(controller.mailboxCategoriesExpandMode.value) == ExpandMode.EXPAND
@@ -248,7 +250,7 @@ class DestinationPickerView extends GetWidget<DestinationPickerController> {
?.map((mailboxNode) => mailboxNode.hasChildren()
? TreeViewChild(
context,
key: Key('children_tree_mailbox_child'),
key: const Key('children_tree_mailbox_child'),
isExpanded: mailboxNode.expandMode == ExpandMode.EXPAND,
parent: (MailBoxFolderTileBuilder(context, _imagePaths, mailboxNode,
lastNode: lastNode,
@@ -268,14 +270,14 @@ class DestinationPickerView extends GetWidget<DestinationPickerController> {
Widget _buildListMailboxSearched(BuildContext context) {
return Obx(() => Container(
margin: _responsiveUtils.isDesktop(context)
? EdgeInsets.only(left: 16, right: 16)
? const EdgeInsets.only(left: 16, right: 16)
: EdgeInsets.zero,
decoration: _responsiveUtils.isDesktop(context)
? BoxDecoration(borderRadius: BorderRadius.circular(14), color: Colors.white)
: null,
child: ListView.builder(
padding: EdgeInsets.only(left: 16, right: 8),
key: Key('list_mailbox_searched'),
padding: const EdgeInsets.only(left: 16, right: 8),
key: const Key('list_mailbox_searched'),
itemCount: controller.listMailboxSearched.length,
shrinkWrap: true,
primary: false,
@@ -299,12 +301,12 @@ class DestinationPickerView extends GetWidget<DestinationPickerController> {
right: 16),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(14), color: Colors.white),
child: MediaQuery(
data: MediaQueryData(padding: EdgeInsets.zero),
data: const MediaQueryData(padding: EdgeInsets.zero),
child: ListTile(
contentPadding: EdgeInsets.zero,
onTap: () => controller.selectMailboxAction(null),
leading: Padding(
padding: EdgeInsets.only(left: 16),
padding: const EdgeInsets.only(left: 16),
child: SvgPicture.asset(_imagePaths.icFolderMailbox, width: 28, height: 28, fit: BoxFit.fill)),
title: Transform(
transform: Matrix4.translationValues(-5.0, 0.0, 0.0),
@@ -314,7 +316,7 @@ class DestinationPickerView extends GetWidget<DestinationPickerController> {
AppLocalizations.of(context).default_mailbox,
maxLines: 1,
overflow:TextOverflow.ellipsis,
style: TextStyle(fontSize: 15, color: AppColor.colorNameEmail),
style: const TextStyle(fontSize: 15, color: AppColor.colorNameEmail),
))
]
)
@@ -339,10 +341,10 @@ class DestinationPickerView extends GetWidget<DestinationPickerController> {
Widget _buildInputSearchFormWidget(BuildContext context) {
return Padding(
padding: EdgeInsets.only(top: 16, bottom: 16),
padding: const EdgeInsets.only(top: 16, bottom: 16),
child: Row(
children: [
Padding(padding: EdgeInsets.only(left: 5), child: buildIconWeb(
Padding(padding: const EdgeInsets.only(left: 5), child: buildIconWeb(
icon: SvgPicture.asset(_imagePaths.icBack, color: AppColor.colorTextButton, fit: BoxFit.fill),
onTap: () => controller.disableSearch(context))),
Expanded(child: (SearchAppBarWidget(context, _imagePaths, _responsiveUtils,
@@ -352,7 +354,7 @@ class DestinationPickerView extends GetWidget<DestinationPickerController> {
hasBackButton: false,
hasSearchButton: true)
..addPadding(EdgeInsets.zero)
..setMargin(EdgeInsets.only(right: 16))
..setMargin(const EdgeInsets.only(right: 16))
..addDecoration(BoxDecoration(borderRadius: BorderRadius.circular(12), color: AppColor.colorBgSearchBar))
..addIconClearText(SvgPicture.asset(_imagePaths.icClearTextSearch, width: 18, height: 18, fit: BoxFit.fill))
..setHintText(AppLocalizations.of(context).hint_search_mailboxes)
@@ -26,14 +26,14 @@ class AppBarDestinationPickerBuilder {
Widget build() {
return Container(
key: Key('app_bar_destination_picker'),
key: const Key('app_bar_destination_picker'),
alignment: Alignment.center,
decoration: BoxDecoration(
decoration: const BoxDecoration(
borderRadius: BorderRadius.only(topLeft: Radius.circular(20), topRight: Radius.circular(20)),
color: Colors.white),
height: 52,
child: MediaQuery(
data: MediaQueryData(padding: EdgeInsets.zero),
data: const MediaQueryData(padding: EdgeInsets.zero),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
@@ -49,19 +49,19 @@ class AppBarDestinationPickerBuilder {
Widget _buildCancelButton() {
if (_mailboxAction == MailboxActions.moveEmail) {
return Padding(
padding: EdgeInsets.only(right: 12),
padding: const EdgeInsets.only(right: 12),
child: Material(
borderRadius: BorderRadius.circular(20),
color: Colors.transparent,
child: TextButton(
child: Text(
AppLocalizations.of(_context).cancel,
style: TextStyle(fontSize: 17, color: AppColor.colorTextButton)),
style: const TextStyle(fontSize: 17, color: AppColor.colorTextButton)),
onPressed: () => _onCloseActionClick?.call()
)
));
} else {
return SizedBox(width: 40, height: 40);
return const SizedBox(width: 40, height: 40);
}
}
@@ -71,7 +71,7 @@ class AppBarDestinationPickerBuilder {
icon: SvgPicture.asset(_imagePaths.icBack, color: AppColor.colorTextButton, fit: BoxFit.fill),
onTap: () => _onCloseActionClick?.call());
} else {
return SizedBox(width: 100, height: 40);
return const SizedBox(width: 100, height: 40);
}
}
@@ -81,6 +81,6 @@ class AppBarDestinationPickerBuilder {
maxLines: 1,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: TextStyle(fontSize: 20, color: AppColor.colorNameEmail, fontWeight: FontWeight.w700));
style: const TextStyle(fontSize: 20, color: AppColor.colorNameEmail, fontWeight: FontWeight.w700));
}
}
@@ -70,7 +70,7 @@ class EmailAPI {
if (emailRequest.emailIdDestroyed != null) {
setEmailMethod
..addDestroy({emailRequest.emailIdDestroyed!.id});
.addDestroy({emailRequest.emailIdDestroyed!.id});
}
final setEmailSubmissionMethod = SetEmailSubmissionMethod(accountId)
@@ -160,7 +160,7 @@ class EmailAPI {
String baseDownloadUrl,
AccountRequest accountRequest
) async {
var externalStorageDirPath;
String externalStorageDirPath;
if (Platform.isAndroid) {
externalStorageDirPath = await ExternalPath.getExternalStoragePublicDirectory(ExternalPath.DIRECTORY_DOWNLOADS);
} else if (Platform.isIOS) {
@@ -381,7 +381,7 @@ class EmailAPI {
Future<bool> deleteEmailPermanently(AccountId accountId, EmailId emailId) async {
final requestBuilder = JmapRequestBuilder(_httpClient, ProcessingInvocation());
final setEmailMethod = SetEmailMethod(accountId)
..addDestroy(Set.of([emailId.id]));
..addDestroy({emailId.id});
final setEmailInvocation = requestBuilder.invocation(setEmailMethod);
@@ -78,10 +78,10 @@ class EmailRepositoryImpl extends EmailRepository {
String? baseUrlDownload,
AccountId accountId
) async {
final mapUrlDownloadCID = Map<String, String>.fromIterable(
attachmentInlines,
key: (attachment) => attachment.cid!,
value: (attachment) => attachment.getDownloadUrl(baseUrlDownload, accountId));
final mapUrlDownloadCID = {
for (var attachment in attachmentInlines)
attachment.cid! : attachment.getDownloadUrl(baseUrlDownload!, accountId)
};
return await Future.wait(emailContents
.map((emailContent) async {
return await _htmlDataSource.transformEmailContent(emailContent, mapUrlDownloadCID);
@@ -115,11 +115,6 @@ class EmailController extends BaseController {
}
}
@override
void onData(Either<Failure, Success> newState) {
super.onData(newState);
}
@override
void onDone() {
viewState.value.fold(
@@ -271,7 +266,7 @@ class EmailController extends BaseController {
context: context,
builder: (_) =>
PointerInterceptor(child: (DownloadingFileDialogBuilder()
..key(Key('downloading_file_dialog'))
..key(const Key('downloading_file_dialog'))
..title(AppLocalizations.of(context).preparing_to_export)
..content(AppLocalizations.of(context).downloading_file(attachment.name ?? ''))
..actionText(AppLocalizations.of(context).cancel)
@@ -285,7 +280,7 @@ class EmailController extends BaseController {
context: context,
builder: (_) =>
PointerInterceptor(child: (DownloadingFileDialogBuilder()
..key(Key('downloading_file_for_web_dialog'))
..key(const Key('downloading_file_for_web_dialog'))
..title(AppLocalizations.of(context).preparing_to_save)
..content(AppLocalizations.of(context).downloading_file(attachment.name ?? '')))
.build()));
@@ -301,7 +296,7 @@ class EmailController extends BaseController {
}
void _exportAttachmentFailureAction(Failure failure) {
if (failure is ExportAttachmentFailure && !(failure.exception is CancelDownloadFileException)) {
if (failure is ExportAttachmentFailure && failure.exception is! CancelDownloadFileException) {
popBack();
}
}
@@ -589,12 +584,12 @@ class EmailController extends BaseController {
context: context,
barrierColor: AppColor.colorDefaultCupertinoActionSheet,
builder: (BuildContext context) => PointerInterceptor(child: (ConfirmDialogBuilder(imagePaths)
..key(Key('confirm_dialog_delete_email_permanently'))
..key(const Key('confirm_dialog_delete_email_permanently'))
..title(DeleteActionType.single.getTitleDialog(context))
..content(DeleteActionType.single.getContentDialog(context))
..addIcon(SvgPicture.asset(imagePaths.icRemoveDialog, fit: BoxFit.fill))
..colorConfirmButton(AppColor.colorConfirmActionDialog)
..styleTextConfirmButton(TextStyle(fontSize: 17, fontWeight: FontWeight.w500, color: AppColor.colorActionDeleteConfirmDialog))
..styleTextConfirmButton(const TextStyle(fontSize: 17, fontWeight: FontWeight.w500, color: AppColor.colorActionDeleteConfirmDialog))
..onCloseButtonAction(() => popBack())
..onConfirmButtonAction(DeleteActionType.single.getConfirmActionName(context), () => _deleteEmailPermanentlyAction(context, email))
..onCancelButtonAction(AppLocalizations.of(context).cancel, () => popBack()))
@@ -55,16 +55,16 @@ class AttachmentFileTileBuilder {
splashColor: Colors.transparent ,
highlightColor: Colors.transparent),
child: Container(
key: Key('attach_file_tile'),
key: const Key('attach_file_tile'),
alignment: Alignment.center,
margin: EdgeInsets.only(top:heightItem != null ? 8 : 0),
height: heightItem ?? null,
height: heightItem,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(color: AppColor.attachmentFileBorderColor),
color: Colors.white),
child: MediaQuery(
data: MediaQueryData(padding: EdgeInsets.zero),
data: const MediaQueryData(padding: EdgeInsets.zero),
child: Stack(
alignment: AlignmentDirectional.bottomEnd,
children: [
@@ -85,7 +85,7 @@ class AttachmentFileTileBuilder {
_attachment.name ?? '',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(fontSize: 12, color: AppColor.attachmentFileNameColor, fontWeight: FontWeight.w500),
style: const TextStyle(fontSize: 12, color: AppColor.attachmentFileNameColor, fontWeight: FontWeight.w500),
)),
subtitle: _attachment.size != null && _attachment.size?.value != 0
? Transform(
@@ -94,7 +94,7 @@ class AttachmentFileTileBuilder {
filesize(_attachment.size?.value),
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(fontSize: 12, color: AppColor.attachmentFileSizeColor)))
style: const TextStyle(fontSize: 12, color: AppColor.attachmentFileSizeColor)))
: null,
trailing: buttonAction != null
? Transform(
@@ -134,7 +134,7 @@ class AttachmentFileTileBuilder {
Container(color: AppColor.backgroundCountAttachment),
Text(
'+${_attachmentSize - _limitDisplayAttachment + 1}',
style: TextStyle(fontSize: 16, color: Colors.white, fontWeight: FontWeight.bold))
style: const TextStyle(fontSize: 16, color: Colors.white, fontWeight: FontWeight.bold))
],
),
);
@@ -23,9 +23,9 @@ Decoration _radiusBoxDecoration({
return color;
}).toList()
: [
Color.fromRGBO(0, 0, 0, 0.1),
Color(0x32E5E5E5),
Color.fromRGBO(0, 0, 0, 0.1),
const Color.fromRGBO(0, 0, 0, 0.1),
const Color(0x32E5E5E5),
const Color.fromRGBO(0, 0, 0, 0.1),
],
stops: [animation.value - 2, animation.value, animation.value + 1]));
}
@@ -50,7 +50,7 @@ class _AttachmentsPlaceHolderLoadingState extends State<AttachmentsPlaceHolderLo
@override
void initState() {
super.initState();
_animationController = AnimationController(duration: Duration(seconds: 1), vsync: this)..repeat();
_animationController = AnimationController(duration: const Duration(seconds: 1), vsync: this)..repeat();
_animation = Tween<double>(begin: -2, end: 2)
.animate(CurvedAnimation(curve: Curves.easeInOutSine, parent: _animationController));
}
@@ -67,13 +67,13 @@ class _AttachmentsPlaceHolderLoadingState extends State<AttachmentsPlaceHolderLo
animation: _animation,
builder: (BuildContext context, Widget? child) {
return Container(
margin: EdgeInsets.only(top: 20),
margin: const EdgeInsets.only(top: 20),
padding: EdgeInsets.zero,
color: Colors.transparent,
child: Row(children: [
_placeHolderAttachment(context),
if (widget.responsiveUtils.isDesktop(context))
SizedBox(width: 16),
const SizedBox(width: 16),
if (widget.responsiveUtils.isDesktop(context))
_placeHolderAttachment(context),
]),
@@ -91,7 +91,7 @@ class _AttachmentsPlaceHolderLoadingState extends State<AttachmentsPlaceHolderLo
height: 55,
width: width * percentAttachment,
margin: EdgeInsets.zero,
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 16),
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 16),
decoration: _radiusBoxDecoration(animation: _animation),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -100,14 +100,14 @@ class _AttachmentsPlaceHolderLoadingState extends State<AttachmentsPlaceHolderLo
height: 24,
width: 24,
decoration: _radiusBoxDecoration(animation: _animation, radius: 12)),
SizedBox(width: 8),
const SizedBox(width: 8),
Expanded(child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
height: 5,
decoration: _radiusBoxDecoration(animation: _animation)),
SizedBox(height: 10),
const SizedBox(height: 10),
Container(
height: 5,
decoration: _radiusBoxDecoration(animation: _animation))
@@ -27,12 +27,12 @@ class BottomBarMailWidgetBuilder {
Widget build() {
return Container(
key: Key('bottom_bar_messenger_widget'),
key: const Key('bottom_bar_messenger_widget'),
alignment: Alignment.center,
color: Colors.white,
child: MediaQuery(
data: MediaQueryData(padding: EdgeInsets.zero),
child: _presentationEmail != null ? _buildListOptionButton(_presentationEmail!) : SizedBox.shrink()
data: const MediaQueryData(padding: EdgeInsets.zero),
child: _presentationEmail != null ? _buildListOptionButton(_presentationEmail!) : const SizedBox.shrink()
)
);
}
@@ -44,7 +44,7 @@ class BottomBarMailWidgetBuilder {
children: [
if (presentationEmail.numberOfAllEmailAddress() > 1)
Expanded(child: (ButtonBuilder(_imagePaths.icReplyAll)
..key(Key('button_reply_all_message'))
..key(const Key('button_reply_all_message'))
..size(15)
..paddingIcon(EdgeInsets.only(
top: _responsiveUtils.isMobile(_context) ? 10 : 16,
@@ -60,7 +60,7 @@ class BottomBarMailWidgetBuilder {
..text(AppLocalizations.of(_context).reply_all, isVertical: _responsiveUtils.isMobile(_context)))
.build()),
Expanded(child: (ButtonBuilder(_imagePaths.icReply)
..key(Key('button_reply_message'))
..key(const Key('button_reply_message'))
..size(20)
..paddingIcon(EdgeInsets.only(
top: _responsiveUtils.isMobile(_context) ? 10 : 16,
@@ -76,7 +76,7 @@ class BottomBarMailWidgetBuilder {
..text(AppLocalizations.of(_context).reply, isVertical: _responsiveUtils.isMobile(_context)))
.build()),
Expanded(child: (ButtonBuilder(_imagePaths.icForward)
..key(Key('button_forward_message'))
..key(const Key('button_forward_message'))
..size(20)
..paddingIcon(EdgeInsets.only(
top: _responsiveUtils.isMobile(_context) ? 10 : 16,
@@ -93,7 +93,7 @@ class BottomBarMailWidgetBuilder {
.build()),
if (!_responsiveUtils.isDesktop(_context))
Expanded(child: (ButtonBuilder(_imagePaths.icNewMessage)
..key(Key('button_new_message'))
..key(const Key('button_new_message'))
..size(20)
..paddingIcon(EdgeInsets.only(
top: _responsiveUtils.isMobile(_context) ? 10 : 16,
@@ -34,7 +34,7 @@ class EmailActionCupertinoActionSheetActionBuilder extends CupertinoActionSheetA
key: key,
child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [
Padding(
padding: iconLeftPadding ?? EdgeInsets.only(left: 12, right: 16),
padding: iconLeftPadding ?? const EdgeInsets.only(left: 12, right: 16),
child: actionIcon),
Expanded(child: Text(actionName, textAlign: TextAlign.left, style: actionTextStyle())),
]),
@@ -41,18 +41,18 @@ class EmailAddressBottomSheetBuilder {
}
RoundedRectangleBorder _shape() {
return RoundedRectangleBorder(
return const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20.0),
topRight: Radius.circular(20.0)));
}
BoxDecoration _decoration(BuildContext context) {
return BoxDecoration(
return const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: const Radius.circular(20.0),
topRight: const Radius.circular(20.0)));
topLeft: Radius.circular(20.0),
topRight: Radius.circular(20.0)));
}
void show() {
@@ -70,27 +70,27 @@ class EmailAddressBottomSheetBuilder {
Align(
alignment: Alignment.centerRight,
child: IconButton(
padding: EdgeInsets.only(top: 16, right: 16),
padding: const EdgeInsets.only(top: 16, right: 16),
onPressed: () => _onCloseBottomSheetAction?.call(),
icon: SvgPicture.asset(_imagePaths.icCloseMailbox, width: 24, height: 24, fit: BoxFit.fill))),
(AvatarBuilder()
..text('${_emailAddress.asString().characters.first.toUpperCase()}')
..text(_emailAddress.asString().characters.first.toUpperCase())
..size(64)
..addTextStyle(TextStyle(fontWeight: FontWeight.w600, fontSize: 23, color: Colors.white))
..addTextStyle(const TextStyle(fontWeight: FontWeight.w600, fontSize: 23, color: Colors.white))
..avatarColor(_emailAddress.avatarColors))
.build(),
if (_emailAddress.displayName.isNotEmpty)
Padding(
padding: EdgeInsets.only(left: 16, right: 16, top: 16),
padding: const EdgeInsets.only(left: 16, right: 16, top: 16),
child: Text(
_emailAddress.asString(),
style: TextStyle(fontSize: 20, fontWeight: FontWeight.w600, color: AppColor.colorNameEmail),
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.w600, color: AppColor.colorNameEmail),
)),
Padding(
padding: EdgeInsets.only(left: 16, right: 16, top: _emailAddress.displayName.isNotEmpty ? 12 : 16),
child: Text(
_emailAddress.emailAddress,
style: TextStyle(fontSize: 17, fontWeight: FontWeight.normal, color: AppColor.colorMessageConfirmDialog),
style: const TextStyle(fontSize: 17, fontWeight: FontWeight.normal, color: AppColor.colorMessageConfirmDialog),
)),
Material(
borderRadius: BorderRadius.circular(20),
@@ -98,16 +98,16 @@ class EmailAddressBottomSheetBuilder {
child: TextButton(
child: Text(
AppLocalizations.of(_context).copy_email_address,
style: TextStyle(fontSize: 13, color: AppColor.colorTextButton, fontWeight: FontWeight.normal),
style: const TextStyle(fontSize: 13, color: AppColor.colorTextButton, fontWeight: FontWeight.normal),
),
onPressed: () => _onCopyEmailAddressAction?.call(_emailAddress)
)
),
SizedBox(height: _emailAddress.displayName.isNotEmpty ? 100 : 130),
Padding(
padding: EdgeInsets.only(left: 16, right: 16, bottom: 20),
padding: const EdgeInsets.only(left: 16, right: 16, bottom: 20),
child: SizedBox(
key: Key('compose_email_button'),
key: const Key('compose_email_button'),
width: double.infinity,
height: 48,
child: ElevatedButton(
@@ -116,8 +116,8 @@ class EmailAddressBottomSheetBuilder {
backgroundColor: MaterialStateProperty.resolveWith<Color>((Set<MaterialState> states) => AppColor.colorTextButton),
shape: MaterialStateProperty.all(RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
side: BorderSide(width: 0, color: AppColor.colorTextButton)))),
child: Text(AppLocalizations.of(_context).compose_email, style: TextStyle(fontSize: 16, color: Colors.white, fontWeight: FontWeight.w500)),
side: const BorderSide(width: 0, color: AppColor.colorTextButton)))),
child: Text(AppLocalizations.of(_context).compose_email, style: const TextStyle(fontSize: 16, color: Colors.white, fontWeight: FontWeight.w500)),
onPressed: () => _onComposeEmailAction?.call(_emailAddress)),
)
)
@@ -40,13 +40,13 @@ class EmailAddressDialogBuilder {
Widget build() {
return Dialog(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(16))),
insetPadding: EdgeInsets.symmetric(horizontal: 24.0, vertical: 16.0),
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(16))),
insetPadding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 16.0),
child: Container(
margin: EdgeInsets.zero,
padding: EdgeInsets.zero,
width: 400,
decoration: BoxDecoration(
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(16))),
child: Wrap(
@@ -54,48 +54,48 @@ class EmailAddressDialogBuilder {
Align(
alignment: Alignment.centerRight,
child: IconButton(
padding: EdgeInsets.only(top: 16, right: 16),
padding: const EdgeInsets.only(top: 16, right: 16),
onPressed: () => _onCloseDialogAction?.call(),
icon: SvgPicture.asset(_imagePaths.icCloseMailbox, width: 24, height: 24, fit: BoxFit.fill))),
Padding(padding: EdgeInsets.symmetric(horizontal: 16),
Padding(padding: const EdgeInsets.symmetric(horizontal: 16),
child: Center(child: (AvatarBuilder()
..text('${_emailAddress.asString().characters.first.toUpperCase()}')
..text(_emailAddress.asString().characters.first.toUpperCase())
..size(64)
..addTextStyle(TextStyle(fontWeight: FontWeight.w600, fontSize: 23, color: Colors.white))
..addTextStyle(const TextStyle(fontWeight: FontWeight.w600, fontSize: 23, color: Colors.white))
..avatarColor(_emailAddress.avatarColors))
.build())),
if (_emailAddress.displayName.isNotEmpty)
Padding(
padding: EdgeInsets.only(left: 16, right: 16, top: 16),
padding: const EdgeInsets.only(left: 16, right: 16, top: 16),
child: Center(child: Text(
_emailAddress.asString(),
style: TextStyle(fontSize: 20, fontWeight: FontWeight.w600, color: AppColor.colorNameEmail),
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.w600, color: AppColor.colorNameEmail),
))
),
Padding(
padding: EdgeInsets.only(left: 16, right: 16, top: _emailAddress.displayName.isNotEmpty ? 12 : 16),
child: Center(child: Text(
_emailAddress.emailAddress,
style: TextStyle(fontSize: 17, fontWeight: FontWeight.normal, color: AppColor.colorMessageConfirmDialog),
style: const TextStyle(fontSize: 17, fontWeight: FontWeight.normal, color: AppColor.colorMessageConfirmDialog),
))
),
Padding(padding: EdgeInsets.symmetric(horizontal: 16),
Padding(padding: const EdgeInsets.symmetric(horizontal: 16),
child: Center(child: Material(
borderRadius: BorderRadius.circular(20),
color: Colors.transparent,
child: TextButton(
child: Text(
AppLocalizations.of(_context).copy_email_address,
style: TextStyle(fontSize: 13, color: AppColor.colorTextButton, fontWeight: FontWeight.normal),
style: const TextStyle(fontSize: 13, color: AppColor.colorTextButton, fontWeight: FontWeight.normal),
),
onPressed: () => _onCopyEmailAddressAction?.call(_emailAddress)
)
))),
SizedBox(height: _emailAddress.displayName.isNotEmpty ? 100 : 130),
Padding(
padding: EdgeInsets.only(left: 16, right: 16, bottom: 20),
padding: const EdgeInsets.only(left: 16, right: 16, bottom: 20),
child: SizedBox(
key: Key('compose_email_button'),
key: const Key('compose_email_button'),
width: double.infinity,
height: 48,
child: ElevatedButton(
@@ -104,8 +104,8 @@ class EmailAddressDialogBuilder {
backgroundColor: MaterialStateProperty.resolveWith<Color>((Set<MaterialState> states) => AppColor.colorTextButton),
shape: MaterialStateProperty.all(RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
side: BorderSide(width: 0, color: AppColor.colorTextButton)))),
child: Text(AppLocalizations.of(_context).compose_email, style: TextStyle(fontSize: 16, color: Colors.white, fontWeight: FontWeight.w500)),
side: const BorderSide(width: 0, color: AppColor.colorTextButton)))),
child: Text(AppLocalizations.of(_context).compose_email, style: const TextStyle(fontSize: 16, color: Colors.white, fontWeight: FontWeight.w500)),
onPressed: () => _onComposeEmailAction?.call(_emailAddress)),
)
)
@@ -23,9 +23,9 @@ Decoration _radiusBoxDecoration({
return color;
}).toList()
: [
Color.fromRGBO(0, 0, 0, 0.1),
Color(0x32E5E5E5),
Color.fromRGBO(0, 0, 0, 0.1),
const Color.fromRGBO(0, 0, 0, 0.1),
const Color(0x32E5E5E5),
const Color.fromRGBO(0, 0, 0, 0.1),
],
stops: [animation.value - 2, animation.value, animation.value + 1]));
}
@@ -50,7 +50,7 @@ class _EmailContentPlaceHolderLoadingState extends State<EmailContentPlaceHolder
@override
void initState() {
super.initState();
_animationController = AnimationController(duration: Duration(seconds: 1), vsync: this)..repeat();
_animationController = AnimationController(duration: const Duration(seconds: 1), vsync: this)..repeat();
_animation = Tween<double>(begin: -2, end: 2)
.animate(CurvedAnimation(curve: Curves.easeInOutSine, parent: _animationController));
}
@@ -67,22 +67,22 @@ class _EmailContentPlaceHolderLoadingState extends State<EmailContentPlaceHolder
animation: _animation,
builder: (BuildContext context, Widget? child) {
return Container(
margin: EdgeInsets.only(top: 16),
margin: const EdgeInsets.only(top: 16),
padding: EdgeInsets.zero,
color: Colors.transparent,
child: Column(
children: [
Container(
margin: EdgeInsets.only(right: 64),
margin: const EdgeInsets.only(right: 64),
height: 10,
decoration: _radiusBoxDecoration(animation: _animation, radius: 5)),
SizedBox(height: 16),
const SizedBox(height: 16),
Container(
height: 10,
decoration: _radiusBoxDecoration(animation: _animation, radius: 5)),
SizedBox(height: 16),
const SizedBox(height: 16),
Container(
margin: EdgeInsets.only(right: 128),
margin: const EdgeInsets.only(right: 128),
height: 10,
decoration: _radiusBoxDecoration(animation: _animation, radius: 5)),
],
@@ -14,11 +14,6 @@ import 'package:tmail_ui_user/main/utils/email_receive_manager.dart';
class HomeBindings extends BaseBindings {
@override
void dependencies() {
super.dependencies();
}
@override
void bindingsController() {
Get.lazyPut(() => HomeController(
@@ -4,12 +4,13 @@ import 'package:get/get.dart';
import 'package:tmail_ui_user/features/home/presentation/home_controller.dart';
class HomeView extends GetWidget<HomeController> {
const HomeView({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
color: AppColor.primaryLightColor,
child: SizedBox(
child: const SizedBox(
width: 100,
height: 100,
child: CupertinoActivityIndicator(),
@@ -1,13 +1,13 @@
import 'package:equatable/equatable.dart';
abstract class AuthenticationException extends Equatable {
static final wrongCredential = 'Credential is wrong';
static const wrongCredential = 'Credential is wrong';
AuthenticationException(String message);
const AuthenticationException(String message);
}
class BadCredentials extends AuthenticationException {
BadCredentials() : super(AuthenticationException.wrongCredential);
const BadCredentials() : super(AuthenticationException.wrongCredential);
@override
List<Object> get props => [];
@@ -13,11 +13,6 @@ import 'package:tmail_ui_user/features/login/presentation/login_controller.dart'
class LoginBindings extends BaseBindings {
@override
void dependencies() {
super.dependencies();
}
@override
void bindingsController() {
Get.lazyPut(() => LoginController(
+21 -19
View File
@@ -15,6 +15,8 @@ class LoginView extends GetWidget<LoginController> {
final responsiveUtils = Get.find<ResponsiveUtils>();
final keyboardUtils = Get.find<KeyboardUtils>();
LoginView({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
@@ -30,7 +32,7 @@ class LoginView extends GetWidget<LoginController> {
padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
child: Container(
alignment: Alignment.center,
padding: EdgeInsets.only(top: 40),
padding: const EdgeInsets.only(top: 40),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
@@ -58,18 +60,18 @@ class LoginView extends GetWidget<LoginController> {
return (SloganBuilder()
..setSloganText(AppLocalizations.of(context).login_text_slogan)
..setSloganTextAlign(TextAlign.center)
..setSloganTextStyle(TextStyle(color: AppColor.primaryColor, fontSize: 16, fontWeight: FontWeight.w700))
..setSloganTextStyle(const TextStyle(color: AppColor.primaryColor, fontSize: 16, fontWeight: FontWeight.w700))
..setLogo(imagePaths.icLogoTMail))
.build();
}
Widget _buildLoginMessage(BuildContext context, LoginState loginState) {
return Padding(
padding: EdgeInsets.only(bottom: 24, top: 60),
child: Container(
padding: const EdgeInsets.only(bottom: 24, top: 60),
child: SizedBox(
width: responsiveUtils.getWidthLoginTextField(context),
child: CenterTextBuilder()
.key(Key('login_message'))
.key(const Key('login_message'))
.text(loginState.viewState.fold(
(failure) => failure is AuthenticationUserFailure
? AppLocalizations.of(context).unknown_error_login_message
@@ -88,11 +90,11 @@ class LoginView extends GetWidget<LoginController> {
Widget _buildUrlInput(BuildContext context) {
return Padding(
padding: EdgeInsets.only(bottom: 16),
child: Container(
padding: const EdgeInsets.only(bottom: 16),
child: SizedBox(
width: responsiveUtils.getWidthLoginTextField(context),
child: (TextFieldBuilder()
..key(Key('login_url_input'))
..key(const Key('login_url_input'))
..onChange((value) => loginController.formatUrl(value))
..textInputAction(TextInputAction.next)
..addController(loginController.urlInputController)
@@ -106,11 +108,11 @@ class LoginView extends GetWidget<LoginController> {
Widget _buildUserNameInput(BuildContext context) {
return Padding(
padding: EdgeInsets.only(bottom: 16),
child: Container(
padding: const EdgeInsets.only(bottom: 16),
child: SizedBox(
width: responsiveUtils.getWidthLoginTextField(context),
child: (TextFieldBuilder()
..key(Key('login_username_input'))
..key(const Key('login_username_input'))
..onChange((value) => loginController.setUserNameText(value))
..textInputAction(TextInputAction.next)
..keyboardType(TextInputType.emailAddress)
@@ -123,11 +125,11 @@ class LoginView extends GetWidget<LoginController> {
Widget _buildPasswordInput(BuildContext context) {
return Padding(
padding: EdgeInsets.only(bottom: 40),
child: Container(
padding: const EdgeInsets.only(bottom: 40),
child: SizedBox(
width: responsiveUtils.getWidthLoginTextField(context),
child: (TextFieldBuilder()
..key(Key('login_password_input'))
..key(const Key('login_password_input'))
..obscureText(true)
..onChange((value) => loginController.setPasswordText(value))
..textInputAction(TextInputAction.done)
@@ -140,9 +142,9 @@ class LoginView extends GetWidget<LoginController> {
Widget _buildLoginButton(BuildContext context) {
return Padding(
padding: EdgeInsets.only(bottom: 16),
padding: const EdgeInsets.only(bottom: 16),
child: SizedBox(
key: Key('login_confirm_button'),
key: const Key('login_confirm_button'),
width: responsiveUtils.getWidthLoginButton(),
height: 48,
child: ElevatedButton(
@@ -151,8 +153,8 @@ class LoginView extends GetWidget<LoginController> {
backgroundColor: MaterialStateProperty.resolveWith<Color>((Set<MaterialState> states) => AppColor.buttonColor),
shape: MaterialStateProperty.all(RoundedRectangleBorder(
borderRadius: BorderRadius.circular(80),
side: BorderSide(width: 0, color: AppColor.buttonColor)))),
child: Text(AppLocalizations.of(context).login, style: TextStyle(fontSize: 16, color: Colors.white)),
side: const BorderSide(width: 0, color: AppColor.buttonColor)))),
child: Text(AppLocalizations.of(context).login, style: const TextStyle(fontSize: 16, color: Colors.white)),
onPressed: () {
keyboardUtils.hideKeyboard(context);
loginController.handleLoginPressed();
@@ -162,7 +164,7 @@ class LoginView extends GetWidget<LoginController> {
}
Widget _buildLoadingCircularProgress() {
return SizedBox(
return const SizedBox(
key: Key('login_loading_icon'),
width: 40,
height: 40,
@@ -7,22 +7,22 @@ class LoginInputDecorationBuilder extends InputDecorationBuilder {
@override
InputDecoration build() {
return InputDecoration(
enabledBorder: enabledBorder ?? OutlineInputBorder(
enabledBorder: enabledBorder ?? const OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(29)),
borderSide: BorderSide(width: 1, color: AppColor.textFieldBorderColor)),
focusedBorder: enabledBorder ?? OutlineInputBorder(
focusedBorder: enabledBorder ?? const OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(29)),
borderSide: BorderSide(width: 2, color: AppColor.textFieldFocusedBorderColor)),
errorBorder: OutlineInputBorder(
errorBorder: const OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(29)),
borderSide: BorderSide(width: 1, color: AppColor.textFieldErrorBorderColor)),
prefixText: prefixText,
labelText: labelText,
floatingLabelBehavior: FloatingLabelBehavior.never,
labelStyle: labelStyle ?? TextStyle(color: AppColor.textFieldLabelColor, fontSize: 16),
labelStyle: labelStyle ?? const TextStyle(color: AppColor.textFieldLabelColor, fontSize: 16),
hintText: hintText,
hintStyle: hintStyle ?? TextStyle(color: AppColor.textFieldHintColor, fontSize: 16),
contentPadding: contentPadding ?? EdgeInsets.only(left: 25, top: 15, bottom: 15, right: 25),
hintStyle: hintStyle ?? const TextStyle(color: AppColor.textFieldHintColor, fontSize: 16),
contentPadding: contentPadding ?? const EdgeInsets.only(left: 25, top: 15, bottom: 15, right: 25),
filled: true,
fillColor: AppColor.textFieldBorderColor);
}
@@ -2,31 +2,31 @@
import 'package:equatable/equatable.dart';
abstract class VerifyNameException extends Equatable implements Exception {
static const EmptyName = 'The name cannot be empty!';
static const DuplicatedName = 'The name already exists!';
static const NameContainSpecialCharacter = 'The name cannot contain special characters';
static const emptyName = 'The name cannot be empty!';
static const duplicatedName = 'The name already exists!';
static const nameContainSpecialCharacter = 'The name cannot contain special characters';
final String? message;
VerifyNameException(this.message);
const VerifyNameException(this.message);
}
class EmptyNameException extends VerifyNameException {
EmptyNameException() : super(VerifyNameException.EmptyName);
const EmptyNameException() : super(VerifyNameException.emptyName);
@override
List<Object> get props => [];
}
class DuplicatedNameException extends VerifyNameException {
DuplicatedNameException() : super(VerifyNameException.DuplicatedName);
const DuplicatedNameException() : super(VerifyNameException.duplicatedName);
@override
List<Object> get props => [];
}
class SpecialCharacterException extends VerifyNameException {
SpecialCharacterException() : super(VerifyNameException.NameContainSpecialCharacter);
const SpecialCharacterException() : super(VerifyNameException.nameContainSpecialCharacter);
@override
List<Object> get props => [];
@@ -17,7 +17,7 @@ class DuplicateNameValidator extends Validator<NewNameRequest> {
.map((nameItem) => nameItem.toLowerCase())
.contains(newNameRequest.value!.toLowerCase());
if (nameExist) {
return Left<Failure, Success>(VerifyNameFailure(DuplicatedNameException()));
return Left<Failure, Success>(VerifyNameFailure(const DuplicatedNameException()));
} else {
return Right<Failure, Success>(VerifyNameViewState());
}
@@ -11,7 +11,7 @@ class EmptyNameValidator extends Validator<NewNameRequest> {
@override
Either<Failure, Success> validate(NewNameRequest newNameRequest) {
if (newNameRequest.value == null || newNameRequest.value!.isEmpty) {
return Left<Failure, Success>(VerifyNameFailure(EmptyNameException()));
return Left<Failure, Success>(VerifyNameFailure(const EmptyNameException()));
} else {
return Right<Failure, Success>(VerifyNameViewState());
}
@@ -12,7 +12,7 @@ class SpecialCharacterValidator extends Validator<NewNameRequest> {
@override
Either<Failure, Success> validate(NewNameRequest newNameRequest) {
if (newNameRequest.value != null && newNameRequest.value!.hasSpecialCharactersInName()) {
return Left<Failure, Success>(VerifyNameFailure(SpecialCharacterException()));
return Left<Failure, Success>(VerifyNameFailure(const SpecialCharacterException()));
} else {
return Right<Failure, Success>(VerifyNameViewState());
}
@@ -5,11 +5,6 @@ import 'package:tmail_ui_user/features/mailbox_creator/presentation/mailbox_crea
class MailboxCreatorBindings extends BaseBindings {
@override
void dependencies() {
super.dependencies();
}
@override
void bindingsController() {
Get.lazyPut(() => MailboxCreatorController(
@@ -1,6 +1,5 @@
import 'package:core/core.dart';
import 'package:dartz/dartz.dart';
import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
import 'package:jmap_dart_client/jmap/account_id.dart';
@@ -56,11 +55,6 @@ class MailboxCreatorController extends BaseController {
}
}
@override
void onData(Either<Failure, Success> newState) {
super.onData(newState);
}
@override
void onDone() {
}
@@ -77,7 +77,7 @@ class MailboxCreatorView extends GetWidget<MailboxCreatorController> {
Widget _buildAppBar(BuildContext context) {
return Padding(
padding: EdgeInsets.only(top: 5),
padding: const EdgeInsets.only(top: 5),
child: Obx(() => (AppBarMailboxCreatorBuilder(
context,
title: AppLocalizations.of(context).new_mailbox,
@@ -90,13 +90,13 @@ class MailboxCreatorView extends GetWidget<MailboxCreatorController> {
Widget _buildCreateMailboxNameInput(BuildContext context) {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 14),
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
child: Obx(() => (TextFieldBuilder()
..key(Key('create_mailbox_name_input'))
..key(const Key('create_mailbox_name_input'))
..onChange((value) => controller.setNewNameMailbox(value))
..keyboardType(TextInputType.visiblePassword)
..cursorColor(AppColor.colorTextButton)
..textStyle(TextStyle(color: AppColor.colorNameEmail, fontSize: 16))
..textStyle(const TextStyle(color: AppColor.colorNameEmail, fontSize: 16))
..addFocusNode(controller.nameInputFocusNode)
..textDecoration((CreateMailboxNameInputDecorationBuilder()
..setHintText(AppLocalizations.of(context).hint_input_create_new_mailbox)
@@ -109,26 +109,26 @@ class MailboxCreatorView extends GetWidget<MailboxCreatorController> {
Widget _buildMailboxLocation(BuildContext context) {
return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Padding(
padding: EdgeInsets.only(left: 24, right: 16, top: 16),
padding: const EdgeInsets.only(left: 24, right: 16, top: 16),
child: Text(
AppLocalizations.of(context).mailbox_location.toUpperCase(),
textAlign: TextAlign.left,
style: TextStyle(fontSize: 13, color: AppColor.colorHintSearchBar)),
style: const TextStyle(fontSize: 13, color: AppColor.colorHintSearchBar)),
),
Container(
alignment: Alignment.center,
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(14),
color: Colors.white
),
child: MediaQuery(
data: MediaQueryData(padding: EdgeInsets.zero),
data: const MediaQueryData(padding: EdgeInsets.zero),
child: ListTile(
contentPadding: EdgeInsets.zero,
onTap: () => controller.selectMailboxLocation(context),
leading: Padding(
padding: EdgeInsets.only(left: 16),
padding: const EdgeInsets.only(left: 16),
child: SvgPicture.asset(
_imagePaths.icFolderMailbox,
width: 28,
@@ -138,7 +138,7 @@ class MailboxCreatorView extends GetWidget<MailboxCreatorController> {
transform: Matrix4.translationValues(-5.0, 0.0, 0.0),
child: Row(children: [
Expanded(child: Obx(() => Text(
'${controller.selectedMailbox.value?.name?.name ?? AppLocalizations.of(context).default_mailbox}',
controller.selectedMailbox.value?.name?.name ?? AppLocalizations.of(context).default_mailbox,
maxLines: 1,
overflow:TextOverflow.ellipsis,
style: TextStyle(
@@ -32,14 +32,14 @@ class AppBarMailboxCreatorBuilder {
Widget build() {
return Container(
key: Key('app_bar_mailbox_creator'),
key: const Key('app_bar_mailbox_creator'),
alignment: Alignment.center,
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 12),
decoration: BoxDecoration(
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
decoration: const BoxDecoration(
borderRadius: BorderRadius.only(topLeft: Radius.circular(20), topRight: Radius.circular(20)),
color: AppColor.colorBgMailbox),
child: MediaQuery(
data: MediaQueryData(padding: EdgeInsets.zero),
data: const MediaQueryData(padding: EdgeInsets.zero),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
@@ -59,7 +59,7 @@ class AppBarMailboxCreatorBuilder {
child: TextButton(
child: Text(
AppLocalizations.of(_context).cancel,
style: TextStyle(fontSize: 17, color: AppColor.colorTextButton),
style: const TextStyle(fontSize: 17, color: AppColor.colorTextButton),
),
onPressed: () => _cancelActionClick?.call()
)
@@ -82,10 +82,10 @@ class AppBarMailboxCreatorBuilder {
Widget _buildTitle() {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 8),
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Text(
title ?? '',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 20, color: AppColor.colorNameEmail, fontWeight: FontWeight.bold)));
style: const TextStyle(fontSize: 20, color: AppColor.colorNameEmail, fontWeight: FontWeight.bold)));
}
}
@@ -7,27 +7,27 @@ class CreateMailboxNameInputDecorationBuilder extends InputDecorationBuilder {
@override
InputDecoration build() {
return InputDecoration(
enabledBorder: enabledBorder ?? OutlineInputBorder(
enabledBorder: enabledBorder ?? const OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10)),
borderSide: BorderSide(width: 1, color: AppColor.colorInputBorderCreateMailbox)),
focusedBorder: enabledBorder ?? OutlineInputBorder(
focusedBorder: enabledBorder ?? const OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10)),
borderSide: BorderSide(width: 1, color: AppColor.colorTextButton)),
errorBorder: errorBorder ?? OutlineInputBorder(
errorBorder: errorBorder ?? const OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10)),
borderSide: BorderSide(width: 1, color: AppColor.colorInputBorderErrorVerifyName)),
focusedErrorBorder: errorBorder ?? OutlineInputBorder(
focusedErrorBorder: errorBorder ?? const OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10)),
borderSide: BorderSide(width: 1, color: AppColor.colorInputBorderErrorVerifyName)),
prefixText: prefixText,
labelText: labelText,
floatingLabelBehavior: FloatingLabelBehavior.never,
labelStyle: labelStyle ?? TextStyle(color: AppColor.colorNameEmail, fontSize: 16),
labelStyle: labelStyle ?? const TextStyle(color: AppColor.colorNameEmail, fontSize: 16),
hintText: hintText,
hintStyle: hintStyle ?? TextStyle(color: AppColor.colorHintInputCreateMailbox, fontSize: 16),
contentPadding: contentPadding ?? EdgeInsets.all(12),
hintStyle: hintStyle ?? const TextStyle(color: AppColor.colorHintInputCreateMailbox, fontSize: 16),
contentPadding: contentPadding ?? const EdgeInsets.all(12),
errorText: errorText,
errorStyle: errorTextStyle ?? TextStyle(color: AppColor.colorInputBorderErrorVerifyName, fontSize: 13),
errorStyle: errorTextStyle ?? const TextStyle(color: AppColor.colorInputBorderErrorVerifyName, fontSize: 13),
filled: true,
fillColor: errorText?.isNotEmpty == true
? AppColor.colorInputBackgroundErrorVerifyName
@@ -15,11 +15,11 @@ mixin FilterEmailPopupMenuMixin {
PopupMenuItem(
padding: EdgeInsets.zero,
child: _filterEmailAction(context, optionSelected, FilterMessageOption.attachments, onCallBack)),
PopupMenuDivider(height: 0.5),
const PopupMenuDivider(height: 0.5),
PopupMenuItem(
padding: EdgeInsets.zero,
child: _filterEmailAction(context, optionSelected, FilterMessageOption.unread, onCallBack)),
PopupMenuDivider(height: 0.5),
const PopupMenuDivider(height: 0.5),
PopupMenuItem(
padding: EdgeInsets.zero,
child: _filterEmailAction(context, optionSelected, FilterMessageOption.starred, onCallBack)),
@@ -31,7 +31,7 @@ mixin FilterEmailPopupMenuMixin {
return InkWell(
onTap: () => onCallBack?.call(option == optionSelected ? FilterMessageOption.all : option),
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 16),
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 16),
child: SizedBox(
child: Row(children: [
SvgPicture.asset(option.getIcon(_imagePaths),
@@ -39,12 +39,12 @@ mixin FilterEmailPopupMenuMixin {
height: 20,
fit: BoxFit.fill,
color: option != FilterMessageOption.starred ? AppColor.colorTextButton : null),
SizedBox(width: 12),
const SizedBox(width: 12),
Expanded(child: Text(
option.getName(context),
style: TextStyle(fontSize: 15, color: Colors.black, fontWeight: FontWeight.w500))),
style: const TextStyle(fontSize: 15, color: Colors.black, fontWeight: FontWeight.w500))),
if (optionSelected == option)
SizedBox(width: 12),
const SizedBox(width: 12),
if (optionSelected == option)
SvgPicture.asset(_imagePaths.icFilterSelected, width: 16, height: 16, fit: BoxFit.fill),
])
@@ -7,11 +7,6 @@ import 'package:tmail_ui_user/features/session/presentation/session_controller.d
class SessionPageBindings extends BaseBindings {
@override
void dependencies() {
super.dependencies();
}
@override
void bindingsController() {
Get.lazyPut(() => SessionController(
@@ -4,12 +4,13 @@ import 'package:get/get.dart';
import 'package:tmail_ui_user/features/session/presentation/session_controller.dart';
class SessionView extends GetWidget<SessionController> {
const SessionView({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
color: AppColor.primaryLightColor,
child: SizedBox(
child: const SizedBox(
width: 100,
height: 100,
child: CupertinoActivityIndicator(),