TF-248 Change font, style for title and content item list email
This commit is contained in:
@@ -4,6 +4,7 @@ import 'dart:ui';
|
||||
import 'package:core/core.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/mailbox/mailbox.dart';
|
||||
import 'package:model/model.dart';
|
||||
import 'package:tmail_ui_user/features/thread/domain/model/search_query.dart';
|
||||
@@ -60,157 +61,149 @@ class EmailTileBuilder {
|
||||
highlightColor: Colors.transparent),
|
||||
child: Container(
|
||||
key: Key('thread_tile'),
|
||||
margin: EdgeInsets.only(bottom: 10),
|
||||
padding: EdgeInsets.only(top: 10, bottom: 10, left: 25, right: 6),
|
||||
margin: EdgeInsets.zero,
|
||||
padding: EdgeInsets.only(bottom: 10, left: 20, right: 6),
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(_selectModeAll == SelectMode.ACTIVE ? 0 : 16),
|
||||
borderRadius: BorderRadius.circular(0),
|
||||
color: _getBackgroundColorItem()),
|
||||
child: MediaQuery(
|
||||
data: MediaQueryData(padding: EdgeInsets.zero),
|
||||
child: ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
onTap: () => {
|
||||
if (_onOpenEmailActionClick != null) {
|
||||
_onOpenEmailActionClick!(_presentationEmail)
|
||||
}
|
||||
},
|
||||
onLongPress: () => {
|
||||
if (_onSelectEmailActionClick != null) {
|
||||
_onSelectEmailActionClick!(_presentationEmail)
|
||||
}
|
||||
},
|
||||
leading: Transform(
|
||||
transform: Matrix4.translationValues(-10.0, -2.0, 0.0),
|
||||
child: _buildAvatarIcon()),
|
||||
title: Transform(
|
||||
transform: Matrix4.translationValues(-10.0, 0.0, 0.0),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: _searchStatus == SearchStatus.ACTIVE && _searchQuery != null && _searchQuery!.value.isNotEmpty
|
||||
? RichTextBuilder(
|
||||
_getInformationSender(),
|
||||
'${_searchQuery!.value}',
|
||||
TextStyle(
|
||||
fontSize: 14,
|
||||
color: AppColor.mailboxTextColor,
|
||||
fontWeight: _presentationEmail.isUnReadEmail() ? FontWeight.bold : FontWeight.w500),
|
||||
TextStyle(
|
||||
fontSize: 14,
|
||||
color: AppColor.mailboxTextColor,
|
||||
backgroundColor: AppColor.bgWordSearch,
|
||||
fontWeight: _presentationEmail.isUnReadEmail() ? FontWeight.bold : FontWeight.w500)).build()
|
||||
: Text(
|
||||
_getInformationSender(),
|
||||
maxLines: 1,
|
||||
overflow:TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: AppColor.mailboxTextColor,
|
||||
fontWeight: _presentationEmail.isUnReadEmail() ? FontWeight.bold : FontWeight.w500))
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(right: 4),
|
||||
child: Text(
|
||||
'${_presentationEmail.getReceivedAt(Localizations.localeOf(_context).toLanguageTag())}',
|
||||
maxLines: 1,
|
||||
overflow:TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: _presentationEmail.isUnReadEmail() ? AppColor.sentTimeTextColorUnRead : AppColor.baseTextColor)))
|
||||
],
|
||||
)
|
||||
),
|
||||
subtitle: Transform(
|
||||
transform: Matrix4.translationValues(-10.0, 8.0, 0.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(bottom: 3),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: _searchStatus == SearchStatus.ACTIVE && _searchQuery != null && _searchQuery!.value.isNotEmpty
|
||||
? RichTextBuilder(
|
||||
'${_presentationEmail.getEmailTitle()}',
|
||||
'${_searchQuery!.value}',
|
||||
TextStyle(
|
||||
fontSize: 12,
|
||||
color: _presentationEmail.isUnReadEmail() ? AppColor.subjectEmailTextColorUnRead : AppColor.baseTextColor,
|
||||
fontWeight: _presentationEmail.isUnReadEmail() ? FontWeight.bold : FontWeight.w500),
|
||||
TextStyle(
|
||||
fontSize: 12,
|
||||
backgroundColor: AppColor.bgWordSearch,
|
||||
color: _presentationEmail.isUnReadEmail() ? AppColor.subjectEmailTextColorUnRead : AppColor.baseTextColor,
|
||||
fontWeight: _presentationEmail.isUnReadEmail() ? FontWeight.bold : FontWeight.w500)).build()
|
||||
: Text(
|
||||
'${_presentationEmail.getEmailTitle()}',
|
||||
maxLines: 1,
|
||||
overflow:TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: _presentationEmail.isUnReadEmail() ? AppColor.subjectEmailTextColorUnRead : AppColor.baseTextColor,
|
||||
fontWeight: _presentationEmail.isUnReadEmail() ? FontWeight.bold : FontWeight.w500))
|
||||
),
|
||||
if (_searchStatus == SearchStatus.ACTIVE && _presentationEmail.mailboxName.isNotEmpty)
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 8),
|
||||
padding: EdgeInsets.only(left: 8, right: 8, top: 3, bottom: 3),
|
||||
constraints: BoxConstraints(maxWidth: 100),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: AppColor.backgroundCounterMailboxColor),
|
||||
child: Text(
|
||||
'${_presentationEmail.mailboxName}',
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 10, color: AppColor.mailboxTextColor, fontWeight: FontWeight.bold),
|
||||
)
|
||||
)
|
||||
],
|
||||
)),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
child: Column(children: [
|
||||
ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
onTap: () => {
|
||||
if (_onOpenEmailActionClick != null) {
|
||||
_onOpenEmailActionClick!(_presentationEmail)
|
||||
}
|
||||
},
|
||||
onLongPress: () => {
|
||||
if (_onSelectEmailActionClick != null) {
|
||||
_onSelectEmailActionClick!(_presentationEmail)
|
||||
}
|
||||
},
|
||||
leading: Transform(
|
||||
transform: Matrix4.translationValues(-5.0, 0.0, 0.0),
|
||||
child: _buildAvatarIcon()),
|
||||
title: Transform(
|
||||
transform: Matrix4.translationValues(-8.0, 0.0, 0.0),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
if (_presentationEmail.isUnReadEmail())
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 6, right: 5),
|
||||
child: SvgPicture.asset(_imagePaths.icUnread, width: 9, height: 9, fit: BoxFit.fill)),
|
||||
Expanded(
|
||||
child: _searchStatus == SearchStatus.ACTIVE && _searchQuery != null && _searchQuery!.value.isNotEmpty
|
||||
? RichTextBuilder(
|
||||
'${_presentationEmail.getPartialContent()}',
|
||||
'${_searchQuery!.value}',
|
||||
TextStyle(fontSize: 12, color: AppColor.baseTextColor),
|
||||
TextStyle(fontSize: 12, color: AppColor.baseTextColor, backgroundColor: AppColor.bgWordSearch)).build()
|
||||
: Text(
|
||||
'${_presentationEmail.getPartialContent()}',
|
||||
child: _searchStatus == SearchStatus.ACTIVE && _searchQuery != null && _searchQuery!.value.isNotEmpty
|
||||
? RichTextBuilder(
|
||||
_getInformationSender(),
|
||||
'${_searchQuery!.value}',
|
||||
TextStyle(fontSize: 15, color: AppColor.colorNameEmail, fontWeight: FontWeight.w600),
|
||||
TextStyle(fontSize: 15, color: AppColor.colorNameEmail, backgroundColor: AppColor.bgWordSearch, fontWeight: FontWeight.w600)).build()
|
||||
: Text(
|
||||
_getInformationSender(),
|
||||
maxLines: 1,
|
||||
overflow:TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 15, color: AppColor.colorNameEmail, fontWeight: FontWeight.w600))
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(right: 4),
|
||||
child: Text(
|
||||
'${_presentationEmail.getReceivedAt(Localizations.localeOf(_context).toLanguageTag())}',
|
||||
maxLines: 1,
|
||||
overflow:TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 12, color: AppColor.baseTextColor))
|
||||
),
|
||||
if (_presentationEmail.hasAttachment == true)
|
||||
(ButtonBuilder(_imagePaths.icShare)
|
||||
style: TextStyle(fontSize: 13, color: AppColor.colorContentEmail)))
|
||||
],
|
||||
)
|
||||
),
|
||||
subtitle: Transform(
|
||||
transform: Matrix4.translationValues(-8.0, 8.0, 0.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.zero,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: _searchStatus == SearchStatus.ACTIVE && _searchQuery != null && _searchQuery!.value.isNotEmpty
|
||||
? RichTextBuilder(
|
||||
'${_presentationEmail.getEmailTitle()}',
|
||||
'${_searchQuery!.value}',
|
||||
TextStyle(
|
||||
fontSize: 13,
|
||||
color: _presentationEmail.isUnReadEmail() ? AppColor.subjectEmailTextColorUnRead : AppColor.colorNameEmail),
|
||||
TextStyle(
|
||||
fontSize: 13,
|
||||
backgroundColor: AppColor.bgWordSearch,
|
||||
color: _presentationEmail.isUnReadEmail() ? AppColor.subjectEmailTextColorUnRead : AppColor.colorNameEmail)).build()
|
||||
: Text(
|
||||
'${_presentationEmail.getEmailTitle()}',
|
||||
maxLines: 1,
|
||||
overflow:TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 13, color: AppColor.colorNameEmail))
|
||||
),
|
||||
if (_searchStatus == SearchStatus.ACTIVE && _presentationEmail.mailboxName.isNotEmpty)
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 8),
|
||||
padding: EdgeInsets.only(left: 8, right: 8, top: 3, bottom: 3),
|
||||
constraints: BoxConstraints(maxWidth: 100),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: AppColor.backgroundCounterMailboxColor),
|
||||
child: Text(
|
||||
'${_presentationEmail.mailboxName}',
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 10, color: AppColor.mailboxTextColor, fontWeight: FontWeight.bold),
|
||||
)
|
||||
)
|
||||
],
|
||||
)),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: _searchStatus == SearchStatus.ACTIVE && _searchQuery != null && _searchQuery!.value.isNotEmpty
|
||||
? RichTextBuilder(
|
||||
'${_presentationEmail.getPartialContent()}',
|
||||
'${_searchQuery!.value}',
|
||||
TextStyle(fontSize: 13, color: AppColor.colorContentEmail),
|
||||
TextStyle(fontSize: 13, color: AppColor.colorContentEmail, backgroundColor: AppColor.bgWordSearch)).build()
|
||||
: Text(
|
||||
'${_presentationEmail.getPartialContent()}',
|
||||
maxLines: 1,
|
||||
overflow:TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 13, color: AppColor.colorContentEmail))
|
||||
),
|
||||
if (_presentationEmail.hasAttachment == true)
|
||||
(ButtonBuilder(_imagePaths.icShare)
|
||||
..padding(5)
|
||||
..size(20))
|
||||
.build(),
|
||||
(ButtonBuilder(_presentationEmail.isFlaggedEmail() ? _imagePaths.icFlagged : _imagePaths.icFlag)
|
||||
..padding(5)
|
||||
..size(20))
|
||||
.build(),
|
||||
(ButtonBuilder(_presentationEmail.isFlaggedEmail() ? _imagePaths.icFlagged : _imagePaths.icFlag)
|
||||
..padding(5)
|
||||
..size(20)
|
||||
..onPressActionClick(() {
|
||||
..size(20)
|
||||
..onPressActionClick(() {
|
||||
if (_onMarkAsStarEmailActionClick != null) {
|
||||
_onMarkAsStarEmailActionClick!(_presentationEmail);
|
||||
}
|
||||
}))
|
||||
.build(),
|
||||
.build(),
|
||||
],
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
)
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 8, right: 12),
|
||||
child: Divider(color: AppColor.lineItemListColor, height: 1, thickness: 0.2)),
|
||||
]),
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -269,21 +262,7 @@ class EmailTileBuilder {
|
||||
}
|
||||
|
||||
Color _getBackgroundColorItem() {
|
||||
if (_selectModeAll == SelectMode.ACTIVE) {
|
||||
if (_presentationEmail.selectMode == SelectMode.ACTIVE) {
|
||||
return AppColor.mailboxSelectedBackgroundColor;
|
||||
} else {
|
||||
return _responsiveUtils.isMobile(_context) ? AppColor.bgMailboxListMail : Colors.white;
|
||||
}
|
||||
} else {
|
||||
if (_responsiveUtils.isMobile(_context)) {
|
||||
return AppColor.bgMailboxListMail;
|
||||
} else if (_responsiveUtils.isDesktop(_context)) {
|
||||
return _selectMode == SelectMode.ACTIVE ? AppColor.mailboxSelectedBackgroundColor : Colors.white;
|
||||
} else {
|
||||
return Colors.white;
|
||||
}
|
||||
}
|
||||
return _responsiveUtils.isMobile(_context) ? AppColor.bgMailboxListMail : Colors.white;
|
||||
}
|
||||
|
||||
String _getInformationSender() {
|
||||
|
||||
Reference in New Issue
Block a user