TF-101 Show counter for regular mailbox
This commit is contained in:
@@ -34,8 +34,9 @@ extension AppColor on Color {
|
|||||||
static const storageUseSizeColor = Color(0xFF2D0CFF);
|
static const storageUseSizeColor = Color(0xFF2D0CFF);
|
||||||
static const myFolderTitleColor = Color(0xFF7E869B);
|
static const myFolderTitleColor = Color(0xFF7E869B);
|
||||||
static const titleAppBarMailboxListMail = Color(0xFF182952);
|
static const titleAppBarMailboxListMail = Color(0xFF182952);
|
||||||
static const notifyCountAppBarMailboxListMail = Color(0xFF3840F7);
|
static const counterMailboxColor = Color(0xFF3840F7);
|
||||||
static const bgNotifyCountAppBarMailboxListMail = Color(0xFFE6E5FF);
|
static const backgroundCounterMailboxColor = Color(0xFFE6E5FF);
|
||||||
|
static const backgroundCounterMailboxSelectedColor = Color(0x17313131);
|
||||||
static const bgMailboxListMail = Color(0xFFFBFBFF);
|
static const bgMailboxListMail = Color(0xFFFBFBFF);
|
||||||
static const bgMessenger = Color(0xFFF2F2F5);
|
static const bgMessenger = Color(0xFFF2F2F5);
|
||||||
static const textButtonColor = Color(0xFF182952);
|
static const textButtonColor = Color(0xFF182952);
|
||||||
|
|||||||
@@ -278,7 +278,6 @@ class EmailView extends GetView {
|
|||||||
switch(emailController.emailContent.value!.type) {
|
switch(emailController.emailContent.value!.type) {
|
||||||
case EmailContentType.textHtml:
|
case EmailContentType.textHtml:
|
||||||
return HtmlContentViewer(
|
return HtmlContentViewer(
|
||||||
minHeight: 400,
|
|
||||||
contentHtml: emailController.emailContent.value!.content,
|
contentHtml: emailController.emailContent.value!.content,
|
||||||
onLoadStart: (webController, uri) => emailController.dispatchState(Right(WebViewLoadingState())),
|
onLoadStart: (webController, uri) => emailController.dispatchState(Right(WebViewLoadingState())),
|
||||||
onLoadStop: (webController, uri) => emailController.dispatchState(Right(WebViewLoadCompletedState())),
|
onLoadStop: (webController, uri) => emailController.dispatchState(Right(WebViewLoadCompletedState())),
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import 'package:model/mailbox/select_mode.dart';
|
|||||||
import 'package:model/model.dart';
|
import 'package:model/model.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_displayed.dart';
|
import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_displayed.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_node.dart';
|
import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_node.dart';
|
||||||
|
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||||
|
|
||||||
typedef OnExpandFolderActionClick = void Function(MailboxNode mailboxNode);
|
typedef OnExpandFolderActionClick = void Function(MailboxNode mailboxNode);
|
||||||
typedef OnSelectMailboxFolderClick = void Function(MailboxNode mailboxNode);
|
typedef OnSelectMailboxFolderClick = void Function(MailboxNode mailboxNode);
|
||||||
@@ -74,44 +75,71 @@ class MailBoxFolderTileBuilder {
|
|||||||
? AppColor.mailboxSelectedIconColor
|
? AppColor.mailboxSelectedIconColor
|
||||||
: AppColor.mailboxIconColor,
|
: AppColor.mailboxIconColor,
|
||||||
fit: BoxFit.fill)),
|
fit: BoxFit.fill)),
|
||||||
title: Padding(
|
title: _buildTitleFolderItem(),
|
||||||
padding: EdgeInsets.only(left: 8),
|
trailing: _mailboxNode.hasChildren()
|
||||||
child: Text(
|
? Padding(
|
||||||
'${_mailboxNode.item.name?.name}',
|
padding: EdgeInsets.only(
|
||||||
maxLines: 1,
|
right: mailboxDisplayed == MailboxDisplayed.mailbox
|
||||||
overflow: TextOverflow.ellipsis,
|
? _responsiveUtils.isMobile(_context) ? 0 : 8
|
||||||
style: TextStyle(
|
: 0,
|
||||||
fontSize: 15,
|
left: 16),
|
||||||
color: selectMode == SelectMode.ACTIVE
|
child: IconButton(
|
||||||
? AppColor.mailboxSelectedTextColor
|
|
||||||
: AppColor.mailboxTextColor,
|
|
||||||
fontWeight: mailboxDisplayed == MailboxDisplayed.mailbox ? FontWeight.bold : FontWeight.w500),
|
|
||||||
)),
|
|
||||||
trailing: Padding(
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
right: mailboxDisplayed == MailboxDisplayed.mailbox
|
|
||||||
? _responsiveUtils.isMobile(_context) ? 0 : 8
|
|
||||||
: 0,
|
|
||||||
left: 16),
|
|
||||||
child: _mailboxNode.hasChildren()
|
|
||||||
? IconButton(
|
|
||||||
color: AppColor.primaryColor,
|
color: AppColor.primaryColor,
|
||||||
icon: SvgPicture.asset(
|
icon: SvgPicture.asset(
|
||||||
_mailboxNode.expandMode == ExpandMode.EXPAND ? _imagePaths.icExpandFolder : _imagePaths.icFolderArrow,
|
_mailboxNode.expandMode == ExpandMode.EXPAND ? _imagePaths.icExpandFolder : _imagePaths.icFolderArrow,
|
||||||
color: selectMode == SelectMode.ACTIVE
|
color: selectMode == SelectMode.ACTIVE ? AppColor.mailboxSelectedIconColor : AppColor.mailboxIconColor,
|
||||||
? AppColor.mailboxSelectedIconColor
|
|
||||||
: AppColor.mailboxIconColor,
|
|
||||||
fit: BoxFit.fill),
|
fit: BoxFit.fill),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (_onExpandFolderActionClick != null) {
|
if (_onExpandFolderActionClick != null) {
|
||||||
_onExpandFolderActionClick!(_mailboxNode);
|
_onExpandFolderActionClick!(_mailboxNode);
|
||||||
}
|
}
|
||||||
}
|
}))
|
||||||
)
|
: null
|
||||||
: SizedBox.shrink())
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildTitleFolderItem() {
|
||||||
|
return Row(
|
||||||
|
children: [
|
||||||
|
Expanded(child: Padding(
|
||||||
|
padding: EdgeInsets.only(left: 8),
|
||||||
|
child: Text(
|
||||||
|
'${_mailboxNode.item.name?.name ?? ''}',
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 15,
|
||||||
|
color: selectMode == SelectMode.ACTIVE ? AppColor.mailboxSelectedTextColor : AppColor.mailboxTextColor,
|
||||||
|
fontWeight: mailboxDisplayed == MailboxDisplayed.mailbox ? FontWeight.bold : FontWeight.w500),
|
||||||
|
))),
|
||||||
|
if (_mailboxNode.item.getCountUnReadEmails().isNotEmpty && mailboxDisplayed == MailboxDisplayed.mailbox)
|
||||||
|
!_mailboxNode.hasChildren()
|
||||||
|
? _buildCounter()
|
||||||
|
: Transform(
|
||||||
|
transform: Matrix4.translationValues(40.0, 0.0, 0.0),
|
||||||
|
child: _buildCounter())
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildCounter() {
|
||||||
|
return Container(
|
||||||
|
margin: EdgeInsets.only(left: 8, right: _mailboxNode.hasChildren() ? 0 : 16),
|
||||||
|
padding: EdgeInsets.only(left: 8, right: 8, top: 2.5, bottom: 2.5),
|
||||||
|
decoration:BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
color: selectMode == SelectMode.ACTIVE ? AppColor.backgroundCounterMailboxSelectedColor : AppColor.backgroundCounterMailboxColor),
|
||||||
|
child: Text(
|
||||||
|
'${_mailboxNode.item.getCountUnReadEmails()} ${AppLocalizations.of(_context).unread_email_notification}',
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 10,
|
||||||
|
color: selectMode == SelectMode.ACTIVE ? AppColor.mailboxTextColor : AppColor.counterMailboxColor,
|
||||||
|
fontWeight: FontWeight.bold),
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -68,7 +68,7 @@ class MailboxTileBuilder {
|
|||||||
title: Padding(
|
title: Padding(
|
||||||
padding: EdgeInsets.only(left: 8),
|
padding: EdgeInsets.only(left: 8),
|
||||||
child: Text(
|
child: Text(
|
||||||
'${_presentationMailbox.name?.name}',
|
'${_presentationMailbox.name?.name ?? ''}',
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow:TextOverflow.ellipsis,
|
overflow:TextOverflow.ellipsis,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
|
|||||||
@@ -128,12 +128,12 @@ class AppBarThreadWidgetBuilder {
|
|||||||
padding: EdgeInsets.only(left: 8, right: 8, top: 2.5, bottom: 2.5),
|
padding: EdgeInsets.only(left: 8, right: 8, top: 2.5, bottom: 2.5),
|
||||||
decoration:BoxDecoration(
|
decoration:BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
color: AppColor.bgNotifyCountAppBarMailboxListMail),
|
color: AppColor.backgroundCounterMailboxColor),
|
||||||
child: Text(
|
child: Text(
|
||||||
'${_presentationMailbox!.getCountUnReadEmails()} ${AppLocalizations.of(_context).unread_email_notification}',
|
'${_presentationMailbox!.getCountUnReadEmails()} ${AppLocalizations.of(_context).unread_email_notification}',
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: TextStyle(fontSize: 10, color: AppColor.notifyCountAppBarMailboxListMail, fontWeight: FontWeight.w500),
|
style: TextStyle(fontSize: 10, color: AppColor.counterMailboxColor, fontWeight: FontWeight.w500),
|
||||||
)),
|
)),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user