TF-1915 Add SendingState property to SendingEmail

(cherry picked from commit 678593583b598f3f06f2a838ce4cd788ed1de513)
This commit is contained in:
dab246
2023-06-08 15:16:55 +07:00
committed by Dat Vu
parent cada3c2607
commit d0888e9847
11 changed files with 157 additions and 14 deletions
@@ -0,0 +1,6 @@
<svg width="60" height="60" viewBox="0 0 60 60" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="60" height="60" rx="30" fill="#F2F3F5" />
<path
d="M38.5 26C38.5 24.0662 36.9338 22.5 35 22.5C33.0662 22.5 31.5 24.0662 31.5 26C31.5 27.9338 33.0662 29.5 35 29.5C36.9338 29.5 38.5 27.9338 38.5 26ZM35 31C37.4706 31 42 31.8571 42 35.2857C42 36.7857 41.5882 37 40.7647 37L33.7546 37.0011C33.9174 36.5134 34 35.9402 34 35.2857C34 33.5963 33.3723 32.2767 32.3292 31.2922C33.2862 31.081 34.2404 31 35 31ZM25 31C27.4706 31 32 31.8571 32 35.2857C32 36.7857 31.5882 37 30.7647 37H19.2353C18.4118 37 18 36.7857 18 35.2857C18 31.8571 22.5294 31 25 31ZM25 22.5C26.9338 22.5 28.5 24.0662 28.5 26C28.5 27.9338 26.9338 29.5 25 29.5C23.0662 29.5 21.5 27.9338 21.5 26C21.5 24.0662 23.0662 22.5 25 22.5Z"
fill="#AEB7C2" />
</svg>

After

Width:  |  Height:  |  Size: 845 B

@@ -0,0 +1,6 @@
<svg width="60" height="60" viewBox="0 0 60 60" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="60" height="60" rx="30" fill="#F2F3F5" />
<path
d="M34.5 25C34.5 22.5138 32.4862 20.5 30 20.5C27.5138 20.5 25.5 22.5138 25.5 25C25.5 27.4862 27.5138 29.5 30 29.5C32.4862 29.5 34.5 27.4862 34.5 25ZM21.5 36C21.5 37.75 22 38 23 38H37C38 38 38.5 37.75 38.5 36C38.5 32 33 31 30 31C27 31 21.5 32 21.5 36Z"
fill="#AEB7C2" />
</svg>

After

Width:  |  Height:  |  Size: 458 B

+5
View File
@@ -0,0 +1,5 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M12 10.6V7C12 6.71667 11.9042 6.47917 11.7125 6.2875C11.5208 6.09583 11.2833 6 11 6C10.7167 6 10.4792 6.09583 10.2875 6.2875C10.0958 6.47917 10 6.71667 10 7V11C10 11.1333 10.025 11.2583 10.075 11.375C10.125 11.4917 10.2 11.6 10.3 11.7L12.3 13.7C12.5 13.9 12.7333 14 13 14C13.2667 14 13.5 13.9 13.7 13.7C13.9 13.5 14 13.2667 14 13C14 12.7333 13.9 12.5 13.7 12.3L12 10.6ZM9.075 19.8C7.04167 19.3667 5.35417 18.3333 4.0125 16.7C2.67083 15.0667 2 13.1667 2 11C2 8.5 2.875 6.375 4.625 4.625C6.375 2.875 8.5 2 11 2C13.5 2 15.625 2.875 17.375 4.625C19.125 6.375 20 8.5 20 11C20 11.7167 19.9167 12.4125 19.75 13.0875C19.5833 13.7625 19.35 14.4 19.05 15H12.95C11.85 15 10.9167 15.3917 10.15 16.175C9.38333 16.9583 9 17.9 9 19C9 19.1333 9.00417 19.2667 9.0125 19.4C9.02083 19.5333 9.04167 19.6667 9.075 19.8ZM13 21H19C19.55 21 20.0208 20.8042 20.4125 20.4125C20.8042 20.0208 21 19.55 21 19C21 18.45 20.8042 17.9792 20.4125 17.5875C20.0208 17.1958 19.55 17 19 17H13C12.45 17 11.9792 17.1958 11.5875 17.5875C11.1958 17.9792 11 18.45 11 19C11 19.55 11.1958 20.0208 11.5875 20.4125C11.9792 20.8042 12.45 21 13 21ZM13 20C12.7167 20 12.4792 19.9042 12.2875 19.7125C12.0958 19.5208 12 19.2833 12 19C12 18.7167 12.0958 18.4792 12.2875 18.2875C12.4792 18.0958 12.7167 18 13 18C13.2833 18 13.5208 18.0958 13.7125 18.2875C13.9042 18.4792 14 18.7167 14 19C14 19.2833 13.9042 19.5208 13.7125 19.7125C13.5208 19.9042 13.2833 20 13 20ZM16 20C15.7167 20 15.4792 19.9042 15.2875 19.7125C15.0958 19.5208 15 19.2833 15 19C15 18.7167 15.0958 18.4792 15.2875 18.2875C15.4792 18.0958 15.7167 18 16 18C16.2833 18 16.5208 18.0958 16.7125 18.2875C16.9042 18.4792 17 18.7167 17 19C17 19.2833 16.9042 19.5208 16.7125 19.7125C16.5208 19.9042 16.2833 20 16 20ZM19 20C18.7167 20 18.4792 19.9042 18.2875 19.7125C18.0958 19.5208 18 19.2833 18 19C18 18.7167 18.0958 18.4792 18.2875 18.2875C18.4792 18.0958 18.7167 18 19 18C19.2833 18 19.5208 18.0958 19.7125 18.2875C19.9042 18.4792 20 18.7167 20 19C20 19.2833 19.9042 19.5208 19.7125 19.7125C19.5208 19.9042 19.2833 20 19 20Z"
fill="#AEB7C2" />
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

+5
View File
@@ -0,0 +1,5 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M12 17C12.2833 17 12.5208 16.9042 12.7125 16.7125C12.9042 16.5208 13 16.2833 13 16C13 15.7167 12.9042 15.4792 12.7125 15.2875C12.5208 15.0958 12.2833 15 12 15C11.7167 15 11.4792 15.0958 11.2875 15.2875C11.0958 15.4792 11 15.7167 11 16C11 16.2833 11.0958 16.5208 11.2875 16.7125C11.4792 16.9042 11.7167 17 12 17ZM11 13H13V7H11V13ZM12 22C10.6167 22 9.31667 21.7375 8.1 21.2125C6.88333 20.6875 5.825 19.975 4.925 19.075C4.025 18.175 3.3125 17.1167 2.7875 15.9C2.2625 14.6833 2 13.3833 2 12C2 10.6167 2.2625 9.31667 2.7875 8.1C3.3125 6.88333 4.025 5.825 4.925 4.925C5.825 4.025 6.88333 3.3125 8.1 2.7875C9.31667 2.2625 10.6167 2 12 2C13.3833 2 14.6833 2.2625 15.9 2.7875C17.1167 3.3125 18.175 4.025 19.075 4.925C19.975 5.825 20.6875 6.88333 21.2125 8.1C21.7375 9.31667 22 10.6167 22 12C22 13.3833 21.7375 14.6833 21.2125 15.9C20.6875 17.1167 19.975 18.175 19.075 19.075C18.175 19.975 17.1167 20.6875 15.9 21.2125C14.6833 21.7375 13.3833 22 12 22Z"
fill="#E64646" />
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

@@ -177,6 +177,10 @@ extension AppColor on Color {
static const colorTitleAUnSubscribedMailbox = Color(0xFF818C99);
static const colorTitleSendingItem = Color(0xFF818C99);
static const colorBannerMessageSendingQueue = Color(0xFFF7F8FA);
static const colorDeliveringState = Color(0xFFAEB7C2);
static const colorErrorState = Color(0xFFE64646);
static const colorBackgroundErrorState = Color(0xFFFAEBEB);
static const colorBackgroundDeliveringState = Color(0xFFF2F3F5);
static const mapGradientColor = [
[Color(0xFF21D4FD), Color(0xFFB721FF)],
@@ -182,9 +182,13 @@ class ImagePaths {
String get icMailboxSendingQueue => _getImagePath('ic_mailbox_sending_queue.svg');
String get icMailboxOutbox => _getImagePath('ic_mailbox_outbox.svg');
String get icAvatarGroup => _getImagePath('ic_avatar_group.svg');
String get icAvatarGroupDelivering => _getImagePath('ic_avatar_group_delivering.svg');
String get icAvatarPersonal => _getImagePath('ic_avatar_personal.svg');
String get icAvatarPersonalDelivering => _getImagePath('ic_avatar_personal_delivering.svg');
String get icDialogOfflineMode => _getImagePath('ic_dialog_offline_mode.svg');
String get icMenuMailbox => _getImagePath('ic_menu_mailbox.svg');
String get icDelivering => _getImagePath('ic_delivering.svg');
String get icError => _getImagePath('ic_error.svg');
String _getImagePath(String imageName) {
return AssetsPaths.images + imageName;
@@ -8,20 +8,20 @@ class ResponsiveUtils {
static const double defaultSizeDrawer = 320;
static const double defaultSizeMenu = 256;
final int heightShortest = 600;
static const int heightShortest = 600;
final int minDesktopWidth = 1200;
final int minTabletWidth = 600;
final int minTabletLargeWidth = 900;
static const int minDesktopWidth = 1200;
static const int minTabletWidth = 600;
static const int minTabletLargeWidth = 900;
final double _loginTextFieldWidthSmallScreen = 280.0;
final double _loginTextFieldWidthLargeScreen = 320.0;
final double _loginButtonWidth = 240.0;
static const double _loginTextFieldWidthSmallScreen = 280.0;
static const double _loginTextFieldWidthLargeScreen = 320.0;
static const double _loginButtonWidth = 240.0;
final double tabletHorizontalMargin = 120.0;
final double tabletVerticalMargin = 200.0;
final double desktopVerticalMargin = 120.0;
final double desktopHorizontalMargin = 200.0;
static const double tabletHorizontalMargin = 120.0;
static const double tabletVerticalMargin = 200.0;
static const double desktopVerticalMargin = 120.0;
static const double desktopHorizontalMargin = 200.0;
bool isScreenWithShortestSide(BuildContext context) => context.mediaQueryShortestSide < minTabletWidth;
@@ -116,4 +116,6 @@ class ResponsiveUtils {
isDesktop(context));
}
}
static bool isMatchedMobileWidth(double width) => width < minTabletWidth;
}
@@ -15,6 +15,7 @@ import 'package:model/email/email_action_type.dart';
import 'package:model/email/presentation_email.dart';
import 'package:model/extensions/email_extension.dart';
import 'package:model/mailbox/select_mode.dart';
import 'package:tmail_ui_user/features/offline_mode/model/sending_state.dart';
class SendingEmail with EquatableMixin {
final String sendingId;
@@ -28,6 +29,7 @@ class SendingEmail with EquatableMixin {
final Id? creationIdRequest;
final DateTime createTime;
final SelectMode selectMode;
final SendingState sendingState;
SendingEmail({
required this.sendingId,
@@ -40,7 +42,8 @@ class SendingEmail with EquatableMixin {
this.identityId,
this.mailboxNameRequest,
this.creationIdRequest,
this.selectMode = SelectMode.INACTIVE
this.selectMode = SelectMode.INACTIVE,
this.sendingState = SendingState.ready
});
Map<String, dynamic> toJson() {
@@ -96,6 +99,10 @@ class SendingEmail with EquatableMixin {
bool get isSelected => selectMode == SelectMode.ACTIVE;
bool get isDelivering => sendingState == SendingState.delivering;
bool get isReady => sendingState == SendingState.ready;
@override
List<Object?> get props => [
sendingId,
@@ -108,6 +115,7 @@ class SendingEmail with EquatableMixin {
identityId,
mailboxNameRequest,
creationIdRequest,
selectMode
selectMode,
sendingState,
];
}
@@ -0,0 +1,77 @@
import 'package:core/presentation/extensions/color_extension.dart';
import 'package:core/presentation/resources/image_paths.dart';
import 'package:flutter/material.dart';
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
enum SendingState {
ready,
delivering,
error;
String getTitle(BuildContext context) {
switch(this) {
case SendingState.delivering:
return AppLocalizations.of(context).delivering;
case SendingState.error:
return AppLocalizations.of(context).error;
case SendingState.ready:
return '';
}
}
String getIcon(ImagePaths imagePaths) {
switch(this) {
case SendingState.delivering:
return imagePaths.icDelivering;
case SendingState.error:
return imagePaths.icError;
case SendingState.ready:
return '';
}
}
String getAvatarGroup(ImagePaths imagePaths) {
switch(this) {
case SendingState.delivering:
return imagePaths.icAvatarGroupDelivering;
case SendingState.error:
return imagePaths.icAvatarGroup;
case SendingState.ready:
return imagePaths.icAvatarGroup;
}
}
String getAvatarPersonal(ImagePaths imagePaths) {
switch(this) {
case SendingState.delivering:
return imagePaths.icAvatarPersonalDelivering;
case SendingState.error:
return imagePaths.icAvatarPersonal;
case SendingState.ready:
return imagePaths.icAvatarPersonal;
}
}
Color getTitleColor() {
switch(this) {
case SendingState.delivering:
return AppColor.colorTitleSendingItem;
case SendingState.error:
return AppColor.colorErrorState;
case SendingState.ready:
return Colors.transparent;
}
}
Color getBackgroundColor() {
switch(this) {
case SendingState.delivering:
return AppColor.colorBackgroundDeliveringState;
case SendingState.error:
return AppColor.colorBackgroundErrorState;
case SendingState.ready:
return Colors.transparent;
}
}
}
+13 -1
View File
@@ -1,5 +1,5 @@
{
"@@last_modified": "2023-06-05T09:10:02.535366",
"@@last_modified": "2023-06-08T15:15:04.969556",
"initializing_data": "Initializing data...",
"@initializing_data": {
"type": "text",
@@ -2887,5 +2887,17 @@
"type": "text",
"placeholders_order": [],
"placeholders": {}
},
"delivering": "Delivering",
"@delivering": {
"type": "text",
"placeholders_order": [],
"placeholders": {}
},
"error": "Error",
"@error": {
"type": "text",
"placeholders_order": [],
"placeholders": {}
}
}
@@ -2974,4 +2974,18 @@ class AppLocalizations {
name: 'deleteSomeOfflineEmailSuccessfully',
);
}
String get delivering {
return Intl.message(
'Delivering',
name: 'delivering',
);
}
String get error {
return Intl.message(
'Error',
name: 'error',
);
}
}