TF-528 Update size for responsive on tablet and landscape mobile
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import 'package:core/core.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -32,9 +31,12 @@ class ThreadView extends GetWidget<ThreadController> with AppLoaderMixin {
|
||||
onTap: () => FocusManager.instance.primaryFocus?.unfocus(),
|
||||
child: Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
backgroundColor: _responsiveUtils.isDesktop(context) ? AppColor.colorBgDesktop : Colors.white,
|
||||
backgroundColor: BuildUtils.isWeb && _responsiveUtils.isDesktop(context)
|
||||
? AppColor.colorBgDesktop
|
||||
: Colors.white,
|
||||
body: Row(children: [
|
||||
if ((!kIsWeb && !_responsiveUtils.isMobile(context)) || (kIsWeb && _responsiveUtils.isTabletLarge(context)))
|
||||
if ((!BuildUtils.isWeb && _responsiveUtils.isDesktop(context) && _responsiveUtils.isTabletLarge(context))
|
||||
|| (BuildUtils.isWeb && _responsiveUtils.isTabletLarge(context)))
|
||||
const VerticalDivider(color: AppColor.lineItemListColor, width: 1, thickness: 0.2),
|
||||
Expanded(child: SafeArea(
|
||||
right: _responsiveUtils.isLandscapeMobile(context),
|
||||
@@ -42,26 +44,33 @@ class ThreadView extends GetWidget<ThreadController> with AppLoaderMixin {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Obx(() => !controller.isSearchActive() && !_responsiveUtils.isDesktop(context)
|
||||
Obx(() => !controller.isSearchActive()
|
||||
&& ((!_responsiveUtils.isDesktop(context) && BuildUtils.isWeb) || !BuildUtils.isWeb)
|
||||
? _buildAppBarNormal(context)
|
||||
: const SizedBox.shrink()),
|
||||
_buildSearchInputFormForMobile(context),
|
||||
Container(
|
||||
color: kIsWeb ? AppColor.colorBgDesktop : Colors.white,
|
||||
color: BuildUtils.isWeb ? AppColor.colorBgDesktop : Colors.white,
|
||||
padding: EdgeInsets.zero,
|
||||
child: _buildSearchButtonViewForMobile(context)),
|
||||
Obx(() => controller.isMailboxTrash && controller.emailList.isNotEmpty && !controller.isSearchActive()
|
||||
? _buildEmptyTrashButton(context)
|
||||
: const SizedBox.shrink()),
|
||||
Expanded(child: Container(
|
||||
color: kIsWeb ? AppColor.colorBgDesktop : Colors.white,
|
||||
padding: _responsiveUtils.isDesktop(context) ? const EdgeInsets.only(left: 32, right: 24, top: 16, bottom: 24) : EdgeInsets.zero,
|
||||
color: BuildUtils.isWeb ? AppColor.colorBgDesktop : Colors.white,
|
||||
padding: BuildUtils.isWeb && _responsiveUtils.isDesktop(context)
|
||||
? const EdgeInsets.only(left: 32, right: 24, top: 16, bottom: 24)
|
||||
: EdgeInsets.zero,
|
||||
child: Stack(children: [
|
||||
Container(
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: _responsiveUtils.isDesktop(context) ? BorderRadius.circular(20) : null,
|
||||
border: _responsiveUtils.isDesktop(context) ? Border.all(color: AppColor.colorBorderBodyThread, width: 1) : null,
|
||||
borderRadius: BuildUtils.isWeb && _responsiveUtils.isDesktop(context)
|
||||
? BorderRadius.circular(20)
|
||||
: null,
|
||||
border: BuildUtils.isWeb && _responsiveUtils.isDesktop(context)
|
||||
? Border.all(color: AppColor.colorBorderBodyThread, width: 1)
|
||||
: null,
|
||||
color: Colors.white),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -112,12 +121,13 @@ class ThreadView extends GetWidget<ThreadController> with AppLoaderMixin {
|
||||
|
||||
Widget _buildSearchButtonViewForMobile(BuildContext context) {
|
||||
return Obx(() {
|
||||
if (!controller.isSearchActive() && !_responsiveUtils.isDesktop(context)) {
|
||||
if (!controller.isSearchActive() &&
|
||||
((!_responsiveUtils.isDesktop(context) && BuildUtils.isWeb) || !BuildUtils.isWeb)) {
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
padding: const EdgeInsets.only(left: 16, right: 16, bottom: 10),
|
||||
child: (SearchBarView(_imagePaths)
|
||||
..hintTextSearch(kIsWeb ? AppLocalizations.of(context).search_emails : AppLocalizations.of(context).hint_search_emails)
|
||||
..hintTextSearch(BuildUtils.isWeb ? AppLocalizations.of(context).search_emails : AppLocalizations.of(context).hint_search_emails)
|
||||
..addOnOpenSearchViewAction(() => controller.enableSearch(context)))
|
||||
.build());
|
||||
} else {
|
||||
@@ -128,7 +138,8 @@ class ThreadView extends GetWidget<ThreadController> with AppLoaderMixin {
|
||||
|
||||
Widget _buildSearchInputFormForMobile(BuildContext context) {
|
||||
return Obx(() {
|
||||
if (controller.isSearchActive() && !_responsiveUtils.isDesktop(context)) {
|
||||
if (controller.isSearchActive() &&
|
||||
((!_responsiveUtils.isDesktop(context) && BuildUtils.isWeb) || !BuildUtils.isWeb)) {
|
||||
return Column(children: [
|
||||
_buildSearchForm(context),
|
||||
const Divider(color: AppColor.lineItemListColor, height: 1, thickness: 0.2),
|
||||
@@ -172,7 +183,7 @@ class ThreadView extends GetWidget<ThreadController> with AppLoaderMixin {
|
||||
..addOnEmailSelectionAction((actionType, selectionEmail) =>
|
||||
controller.pressEmailSelectionAction(context, actionType, selectionEmail))
|
||||
..addOnFilterEmailAction((filterMessageOption, position) =>
|
||||
_responsiveUtils.isMobileDevice(context)
|
||||
_responsiveUtils.isScreenWithShortestSide(context)
|
||||
? controller.openContextMenuAction(
|
||||
context,
|
||||
_filterMessagesCupertinoActionTile(context, filterMessageOption))
|
||||
@@ -186,9 +197,12 @@ class ThreadView extends GetWidget<ThreadController> with AppLoaderMixin {
|
||||
|
||||
Widget _buildFloatingButtonCompose(BuildContext context) {
|
||||
return Obx(() {
|
||||
if (!controller.isSearchActive() && !_responsiveUtils.isDesktop(context)) {
|
||||
if (!controller.isSearchActive()
|
||||
&& (!BuildUtils.isWeb || (BuildUtils.isWeb && !_responsiveUtils.isDesktop(context)))) {
|
||||
return Container(
|
||||
padding: EdgeInsets.zero,
|
||||
padding: BuildUtils.isWeb
|
||||
? EdgeInsets.zero
|
||||
: controller.isSelectionEnabled() ? const EdgeInsets.only(bottom: 70) : EdgeInsets.zero,
|
||||
child: Align(
|
||||
alignment: Alignment.bottomRight,
|
||||
child: ScrollingFloatingButtonAnimated(
|
||||
@@ -317,7 +331,7 @@ class ThreadView extends GetWidget<ThreadController> with AppLoaderMixin {
|
||||
|
||||
Widget _buildListEmail(BuildContext context) {
|
||||
return Container(
|
||||
margin: _responsiveUtils.isDesktop(context)
|
||||
margin: BuildUtils.isWeb && _responsiveUtils.isDesktop(context)
|
||||
? EdgeInsets.symmetric(vertical: controller.isSelectionEnabled() ? 4 : 12, horizontal: 4)
|
||||
: EdgeInsets.only(top: controller.isSearchActive() ? 8 : 0),
|
||||
alignment: Alignment.center,
|
||||
@@ -381,7 +395,7 @@ class ThreadView extends GetWidget<ThreadController> with AppLoaderMixin {
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
key: const PageStorageKey('list_presentation_email_in_threads'),
|
||||
itemCount: listPresentationEmail.length,
|
||||
padding: EdgeInsets.only(top: kIsWeb && !_responsiveUtils.isDesktop(context) ? 10 : 0),
|
||||
padding: EdgeInsets.only(top: BuildUtils.isWeb && !_responsiveUtils.isDesktop(context) ? 10 : 0),
|
||||
itemBuilder: (context, index) => Obx(() => (EmailTileBuilder(
|
||||
context,
|
||||
listPresentationEmail[index],
|
||||
@@ -434,7 +448,7 @@ class ThreadView extends GetWidget<ThreadController> with AppLoaderMixin {
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 24),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: _responsiveUtils.isDesktop(context)
|
||||
borderRadius: BuildUtils.isWeb && _responsiveUtils.isDesktop(context)
|
||||
? const BorderRadius.only(topLeft: Radius.circular(20), topRight: Radius.circular(20))
|
||||
: null,
|
||||
color: AppColor.bgStatusResultSearch),
|
||||
@@ -456,10 +470,10 @@ class ThreadView extends GetWidget<ThreadController> with AppLoaderMixin {
|
||||
border: Border.all(color: AppColor.colorLineLeftEmailView),
|
||||
color: Colors.white),
|
||||
margin: EdgeInsets.only(
|
||||
left: _responsiveUtils.isDesktop(context) ? 32 : 16,
|
||||
right: _responsiveUtils.isDesktop(context) ? 20 : 16,
|
||||
bottom: _responsiveUtils.isDesktop(context) ? 0 : 16,
|
||||
top: _responsiveUtils.isDesktop(context) ? 16 : 0),
|
||||
left: BuildUtils.isWeb && _responsiveUtils.isDesktop(context) ? 32 : 16,
|
||||
right: BuildUtils.isWeb && _responsiveUtils.isDesktop(context) ? 20 : 16,
|
||||
bottom: BuildUtils.isWeb && _responsiveUtils.isDesktop(context) ? 0 : 16,
|
||||
top: BuildUtils.isWeb && _responsiveUtils.isDesktop(context) ? 16 : 0),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
child: Row(children: [
|
||||
Padding(
|
||||
|
||||
@@ -148,7 +148,7 @@ class AppBarThreadWidgetBuilder {
|
||||
padding: const EdgeInsets.only(left: 40, right: 40),
|
||||
child: _buildContentCenterAppBar()),
|
||||
Transform(
|
||||
transform: Matrix4.translationValues(_responsiveUtils.isDesktop(_context) ? -2.0 : -16.0, -8.0, 0.0),
|
||||
transform: Matrix4.translationValues(_getXTranslationValues(), -8.0, 0.0),
|
||||
child: Text(
|
||||
_filterMessageOption.getTitle(_context),
|
||||
style: const TextStyle(fontSize: 11, color: AppColor.colorContentEmail)))
|
||||
@@ -213,7 +213,7 @@ class AppBarThreadWidgetBuilder {
|
||||
padding: const EdgeInsets.only(left: 16, right: 16),
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
if (_onFilterEmailAction != null && _responsiveUtils.isMobileDevice(_context)) {
|
||||
if (_onFilterEmailAction != null && _responsiveUtils.isScreenWithShortestSide(_context)) {
|
||||
_onFilterEmailAction!.call(_filterMessageOption, null);
|
||||
}
|
||||
},
|
||||
@@ -224,7 +224,7 @@ class AppBarThreadWidgetBuilder {
|
||||
: AppColor.colorFilterMessageEnabled,
|
||||
fit: BoxFit.fill),
|
||||
onTapDown: (detail) {
|
||||
if (_onFilterEmailAction != null && !_responsiveUtils.isMobileDevice(_context)) {
|
||||
if (_onFilterEmailAction != null && !_responsiveUtils.isScreenWithShortestSide(_context)) {
|
||||
final screenSize = MediaQuery.of(_context).size;
|
||||
final offset = detail.globalPosition;
|
||||
final position = RelativeRect.fromLTRB(
|
||||
@@ -309,4 +309,12 @@ class AppBarThreadWidgetBuilder {
|
||||
final maxWidth = width > widthSiblingsWidget ? width - widthSiblingsWidget : 0.0;
|
||||
return maxWidth;
|
||||
}
|
||||
|
||||
double _getXTranslationValues() {
|
||||
if (BuildUtils.isWeb) {
|
||||
return _responsiveUtils.isDesktop(_context) && BuildUtils.isWeb ? -2.0 : -16.0;
|
||||
} else {
|
||||
return _responsiveUtils.isTabletLarge(_context) ? 0.0 : -16.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,14 +6,12 @@ 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';
|
||||
import 'package:tmail_ui_user/features/thread/presentation/model/search_status.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
|
||||
typedef OnPressEmailActionClick = void Function(EmailActionType, PresentationEmail);
|
||||
typedef OnMoreActionClick = void Function(PresentationEmail, RelativeRect?);
|
||||
|
||||
class EmailTileBuilder {
|
||||
|
||||
final _responsiveUtils = Get.find<ResponsiveUtils>();
|
||||
final _imagePaths = Get.find<ImagePaths>();
|
||||
|
||||
final PresentationEmail _presentationEmail;
|
||||
@@ -50,254 +48,125 @@ class EmailTileBuilder {
|
||||
return Theme(
|
||||
key: const Key('thread_tile'),
|
||||
data: ThemeData(splashColor: Colors.transparent, highlightColor: Colors.transparent),
|
||||
child: ResponsiveWidget(
|
||||
responsiveUtils: _responsiveUtils,
|
||||
mobile: _wrapContainerForTile(_buildListTile()),
|
||||
desktop: _wrapContainerForTile(_buildListTileForDesktop()),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Widget _wrapContainerForTile(Widget tile) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(left: 16, right: 16, bottom: 4),
|
||||
child: tile);
|
||||
}
|
||||
|
||||
Widget _buildListTile() {
|
||||
return Column(children: [
|
||||
ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
onTap: () => _emailActionClick?.call(EmailActionType.preview, _presentationEmail),
|
||||
onLongPress: () => _emailActionClick?.call(EmailActionType.selection, _presentationEmail),
|
||||
leading: GestureDetector(
|
||||
onTap: () => _emailActionClick?.call(
|
||||
_selectModeAll == SelectMode.ACTIVE ? EmailActionType.selection : EmailActionType.preview,
|
||||
_presentationEmail),
|
||||
child: Container(
|
||||
width: 56,
|
||||
height: 56,
|
||||
color: Colors.transparent,
|
||||
alignment: Alignment.center,
|
||||
child: _buildAvatarIcon()),
|
||||
),
|
||||
title: Row(
|
||||
children: [
|
||||
if (!_presentationEmail.hasRead)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 5),
|
||||
child: SvgPicture.asset(_imagePaths.icUnreadStatus, width: 9, height: 9, fit: BoxFit.fill)),
|
||||
Expanded(
|
||||
child: _searchStatus == SearchStatus.ACTIVE && _searchQuery != null && _searchQuery!.value.isNotEmpty
|
||||
? RichTextBuilder(
|
||||
_getInformationSender(),
|
||||
_searchQuery!.value,
|
||||
const TextStyle(fontSize: 15, color: AppColor.colorNameEmail, fontWeight: FontWeight.w600),
|
||||
TextStyle(fontSize: 15, color: _buildTextColorForReadEmail(), backgroundColor: AppColor.bgWordSearch, fontWeight: _buildFontForReadEmail())).build()
|
||||
: Text(
|
||||
_getInformationSender(),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 16, right: 16, bottom: 4),
|
||||
child: Column(children: [
|
||||
ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
onTap: () => _emailActionClick?.call(EmailActionType.preview, _presentationEmail),
|
||||
onLongPress: () => _emailActionClick?.call(EmailActionType.selection, _presentationEmail),
|
||||
leading: GestureDetector(
|
||||
onTap: () => _emailActionClick?.call(
|
||||
_selectModeAll == SelectMode.ACTIVE ? EmailActionType.selection : EmailActionType.preview,
|
||||
_presentationEmail),
|
||||
child: Container(
|
||||
width: 56,
|
||||
height: 56,
|
||||
color: Colors.transparent,
|
||||
alignment: Alignment.center,
|
||||
child: _buildAvatarIcon()),
|
||||
),
|
||||
title: Row(
|
||||
children: [
|
||||
if (!_presentationEmail.hasRead)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 5),
|
||||
child: SvgPicture.asset(_imagePaths.icUnreadStatus, width: 9, height: 9, fit: BoxFit.fill)),
|
||||
Expanded(
|
||||
child: _searchStatus == SearchStatus.ACTIVE && _searchQuery != null && _searchQuery!.value.isNotEmpty
|
||||
? RichTextBuilder(
|
||||
_getInformationSender(),
|
||||
_searchQuery!.value,
|
||||
const TextStyle(fontSize: 15, color: AppColor.colorNameEmail, fontWeight: FontWeight.w600),
|
||||
TextStyle(fontSize: 15, color: _buildTextColorForReadEmail(), backgroundColor: AppColor.bgWordSearch, fontWeight: _buildFontForReadEmail())).build()
|
||||
: Text(
|
||||
_getInformationSender(),
|
||||
maxLines: 1,
|
||||
overflow:TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 15, color: _buildTextColorForReadEmail(), fontWeight: _buildFontForReadEmail()))
|
||||
),
|
||||
if (_presentationEmail.hasAttachment == true)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8),
|
||||
child: SvgPicture.asset(_imagePaths.icAttachment, width: 16, height: 16, fit: BoxFit.fill)),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 4, left: 8),
|
||||
child: Text(
|
||||
_presentationEmail.getReceivedAt(Localizations.localeOf(_context).toLanguageTag()),
|
||||
maxLines: 1,
|
||||
overflow:TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 15, color: _buildTextColorForReadEmail(), fontWeight: _buildFontForReadEmail()))
|
||||
style: TextStyle(fontSize: 13, color: _buildTextColorForReadEmail(), fontWeight: _buildFontForReadEmail()))),
|
||||
SvgPicture.asset(_imagePaths.icChevron, width: 16, height: 16, fit: BoxFit.fill),
|
||||
],
|
||||
),
|
||||
if (_presentationEmail.hasAttachment == true)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8),
|
||||
child: SvgPicture.asset(_imagePaths.icAttachment, width: 16, height: 16, fit: BoxFit.fill)),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 4, left: 8),
|
||||
child: Text(
|
||||
_presentationEmail.getReceivedAt(Localizations.localeOf(_context).toLanguageTag()),
|
||||
maxLines: 1,
|
||||
overflow:TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 13, color: _buildTextColorForReadEmail(), fontWeight: _buildFontForReadEmail()))),
|
||||
SvgPicture.asset(_imagePaths.icChevron, width: 16, height: 16, fit: BoxFit.fill),
|
||||
],
|
||||
),
|
||||
subtitle: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 6),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Expanded(child: _searchStatus == SearchStatus.ACTIVE && _searchQuery != null && _searchQuery!.value.isNotEmpty
|
||||
? RichTextBuilder(
|
||||
_presentationEmail.getEmailTitle(),
|
||||
_searchQuery!.value,
|
||||
TextStyle(fontSize: 13, color: _buildTextColorForReadEmail(), fontWeight: _buildFontForReadEmail()),
|
||||
TextStyle(fontSize: 13, backgroundColor: AppColor.bgWordSearch, color: _buildTextColorForReadEmail(), fontWeight: _buildFontForReadEmail())).build()
|
||||
: Text(
|
||||
_presentationEmail.getEmailTitle(),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 13, color: _buildTextColorForReadEmail(), fontWeight: _buildFontForReadEmail()))
|
||||
),
|
||||
if (_searchStatus == SearchStatus.ACTIVE && _presentationEmail.mailboxName.isNotEmpty)
|
||||
Container(
|
||||
margin: const EdgeInsets.only(left: 8),
|
||||
padding: const EdgeInsets.only(left: 8, right: 8, top: 3, bottom: 3),
|
||||
constraints: const BoxConstraints(maxWidth: 100),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: AppColor.backgroundCounterMailboxColor),
|
||||
child: Text(
|
||||
_presentationEmail.mailboxName,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontSize: 10, color: AppColor.mailboxTextColor, fontWeight: FontWeight.bold),
|
||||
)
|
||||
subtitle: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 6),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Expanded(child: _searchStatus == SearchStatus.ACTIVE && _searchQuery != null && _searchQuery!.value.isNotEmpty
|
||||
? RichTextBuilder(
|
||||
_presentationEmail.getEmailTitle(),
|
||||
_searchQuery!.value,
|
||||
TextStyle(fontSize: 13, color: _buildTextColorForReadEmail(), fontWeight: _buildFontForReadEmail()),
|
||||
TextStyle(fontSize: 13, backgroundColor: AppColor.bgWordSearch, color: _buildTextColorForReadEmail(), fontWeight: _buildFontForReadEmail())).build()
|
||||
: Text(
|
||||
_presentationEmail.getEmailTitle(),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 13, color: _buildTextColorForReadEmail(), fontWeight: _buildFontForReadEmail()))
|
||||
),
|
||||
if (_searchStatus == SearchStatus.ACTIVE && _presentationEmail.mailboxName.isNotEmpty)
|
||||
Container(
|
||||
margin: const EdgeInsets.only(left: 8),
|
||||
padding: const EdgeInsets.only(left: 8, right: 8, top: 3, bottom: 3),
|
||||
constraints: const BoxConstraints(maxWidth: 100),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: AppColor.backgroundCounterMailboxColor),
|
||||
child: Text(
|
||||
_presentationEmail.mailboxName,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontSize: 10, color: AppColor.mailboxTextColor, fontWeight: FontWeight.bold),
|
||||
)
|
||||
),
|
||||
if (_presentationEmail.hasStarred)
|
||||
SvgPicture.asset(_imagePaths.icStar, width: 15, height: 15, fit: BoxFit.fill)
|
||||
],
|
||||
)),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 6),
|
||||
child: Row(children: [
|
||||
Expanded(child: _searchStatus == SearchStatus.ACTIVE && _searchQuery != null && _searchQuery!.value.isNotEmpty
|
||||
? RichTextBuilder(
|
||||
_presentationEmail.getPartialContent(),
|
||||
_searchQuery!.value,
|
||||
const TextStyle(fontSize: 13, color: AppColor.colorContentEmail),
|
||||
const TextStyle(fontSize: 13, color: AppColor.colorContentEmail, backgroundColor: AppColor.bgWordSearch)).build()
|
||||
: Text(
|
||||
_presentationEmail.getPartialContent(),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontSize: 13, color: AppColor.colorContentEmail))
|
||||
),
|
||||
if (_presentationEmail.hasStarred)
|
||||
SvgPicture.asset(_imagePaths.icStar, width: 15, height: 15, fit: BoxFit.fill)
|
||||
],
|
||||
)),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 6),
|
||||
child: Row(children: [
|
||||
Expanded(child: _searchStatus == SearchStatus.ACTIVE && _searchQuery != null && _searchQuery!.value.isNotEmpty
|
||||
? RichTextBuilder(
|
||||
_presentationEmail.getPartialContent(),
|
||||
_searchQuery!.value,
|
||||
const TextStyle(fontSize: 13, color: AppColor.colorContentEmail),
|
||||
const TextStyle(fontSize: 13, color: AppColor.colorContentEmail, backgroundColor: AppColor.bgWordSearch)).build()
|
||||
: Text(
|
||||
_presentationEmail.getPartialContent(),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontSize: 13, color: AppColor.colorContentEmail))
|
||||
),
|
||||
])
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(top: 4),
|
||||
child: Divider(color: AppColor.lineItemListColor, height: 1, thickness: 0.2)),
|
||||
]);
|
||||
}
|
||||
|
||||
Widget _buildListTileForDesktop() {
|
||||
return GestureDetector(
|
||||
onTap: () => _emailActionClick?.call(EmailActionType.preview, _presentationEmail),
|
||||
onLongPress: () => _emailActionClick?.call(EmailActionType.selection, _presentationEmail),
|
||||
child: Column(children: [
|
||||
Row(children: [
|
||||
Container(
|
||||
alignment: Alignment.center,
|
||||
child: !_presentationEmail.hasRead
|
||||
? SvgPicture.asset(_imagePaths.icUnreadStatus, width: 9, height: 9, fit: BoxFit.fill)
|
||||
: const SizedBox(width: 9)),
|
||||
buildIconWeb(
|
||||
icon: SvgPicture.asset(
|
||||
_presentationEmail.hasStarred ? _imagePaths.icStar : _imagePaths.icUnStar,
|
||||
width: 20,
|
||||
height: 20,
|
||||
fit: BoxFit.fill),
|
||||
tooltip: _presentationEmail.hasStarred ? AppLocalizations.of(_context).starred : AppLocalizations.of(_context).not_starred,
|
||||
onTap: () => _emailActionClick?.call(
|
||||
_presentationEmail.hasStarred ? EmailActionType.unMarkAsStarred : EmailActionType.markAsStarred,
|
||||
_presentationEmail)),
|
||||
GestureDetector(
|
||||
onTap: () => _emailActionClick?.call(
|
||||
_selectModeAll == SelectMode.ACTIVE ? EmailActionType.selection : EmailActionType.preview,
|
||||
_presentationEmail),
|
||||
child: Container(
|
||||
width: 40,
|
||||
height: 56,
|
||||
color: Colors.transparent,
|
||||
alignment: Alignment.center,
|
||||
child: _buildAvatarIcon(
|
||||
iconSize: 40,
|
||||
textStyle: const TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white))
|
||||
])
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
SizedBox(
|
||||
width: 160,
|
||||
child: _isSearchEnabled
|
||||
? RichTextBuilder(
|
||||
_getInformationSender(),
|
||||
_searchQuery!.value,
|
||||
const TextStyle(fontSize: 15, color: AppColor.colorNameEmail, fontWeight: FontWeight.w600),
|
||||
const TextStyle(fontSize: 15, color: AppColor.colorNameEmail, backgroundColor: AppColor.bgWordSearch, fontWeight: FontWeight.w600)).build()
|
||||
: Text(_getInformationSender(),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontSize: 15, color: AppColor.colorNameEmail, fontWeight: FontWeight.w600)),
|
||||
),
|
||||
const SizedBox(width: 24),
|
||||
Expanded(child: _buildSubjectAndContent()),
|
||||
const SizedBox(width: 16),
|
||||
if (_searchStatus == SearchStatus.ACTIVE && _presentationEmail.mailboxName.isNotEmpty)
|
||||
Container(
|
||||
margin: const EdgeInsets.only(left: 8),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 3),
|
||||
constraints: const BoxConstraints(maxWidth: 80),
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(10), color: AppColor.backgroundCounterMailboxColor),
|
||||
child: Text(_presentationEmail.mailboxName,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontSize: 10, color: AppColor.mailboxTextColor, fontWeight: FontWeight.bold),
|
||||
)
|
||||
),
|
||||
if (_presentationEmail.hasAttachment == true)
|
||||
Padding(padding: const EdgeInsets.only(left: 8),
|
||||
child: SvgPicture.asset(_imagePaths.icAttachment, width: 16, height: 16, fit: BoxFit.fill)),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 20, left: 8),
|
||||
child: Text(_presentationEmail.getReceivedAt(Localizations.localeOf(_context).toLanguageTag()),
|
||||
maxLines: 1,
|
||||
textAlign: TextAlign.right,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontSize: 13, color: AppColor.colorContentEmail, fontWeight: FontWeight.normal))),
|
||||
]),
|
||||
if (_selectModeAll == SelectMode.INACTIVE)
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(left: 85),
|
||||
padding: EdgeInsets.only(top: 4),
|
||||
child: Divider(color: AppColor.lineItemListColor, height: 1, thickness: 0.2)),
|
||||
]),
|
||||
]),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSubjectAndContent() {
|
||||
return LayoutBuilder(builder: (context, constraints) {
|
||||
return Row(children: [
|
||||
Container(
|
||||
constraints: BoxConstraints(maxWidth: constraints.maxWidth / 2),
|
||||
child: _isSearchEnabled
|
||||
? RichTextBuilder(
|
||||
_presentationEmail.getEmailTitle(),
|
||||
_searchQuery!.value,
|
||||
const TextStyle(fontSize: 13, color: AppColor.colorNameEmail, fontWeight: FontWeight.w600),
|
||||
const TextStyle(fontSize: 13, backgroundColor: AppColor.bgWordSearch, color: AppColor.colorNameEmail)).build()
|
||||
: Text(_presentationEmail.getEmailTitle(),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontSize: 13, color: AppColor.colorNameEmail, fontWeight: FontWeight.w600))
|
||||
),
|
||||
if (_presentationEmail.getEmailTitle().isNotEmpty) const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Container(
|
||||
child: _isSearchEnabled
|
||||
? RichTextBuilder(
|
||||
_presentationEmail.getPartialContent(),
|
||||
_searchQuery!.value,
|
||||
const TextStyle(fontSize: 13, color: AppColor.colorContentEmail, fontWeight: FontWeight.normal),
|
||||
const TextStyle(fontSize: 13, color: AppColor.colorContentEmail, backgroundColor: AppColor.bgWordSearch)).build()
|
||||
: Text(_presentationEmail.getPartialContent(),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontSize: 13, color: AppColor.colorContentEmail, fontWeight: FontWeight.normal))
|
||||
)
|
||||
),
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
Widget _buildAvatarIcon({
|
||||
double? iconSize,
|
||||
TextStyle? textStyle
|
||||
@@ -334,13 +203,11 @@ class EmailTileBuilder {
|
||||
}
|
||||
|
||||
FontWeight _buildFontForReadEmail() {
|
||||
if (!_presentationEmail.hasRead) return FontWeight.w600;
|
||||
return FontWeight.normal;
|
||||
return !_presentationEmail.hasRead ? FontWeight.w600 : FontWeight.normal;
|
||||
}
|
||||
|
||||
Color _buildTextColorForReadEmail() {
|
||||
if (_presentationEmail.hasRead) return AppColor.colorContentEmail;
|
||||
return AppColor.colorNameEmail;
|
||||
return _presentationEmail.hasRead ? AppColor.colorContentEmail : AppColor.colorNameEmail;
|
||||
}
|
||||
|
||||
String _getInformationSender() {
|
||||
@@ -351,8 +218,4 @@ class EmailTileBuilder {
|
||||
}
|
||||
return _presentationEmail.getSenderName();
|
||||
}
|
||||
|
||||
bool get _isSearchEnabled => _searchStatus == SearchStatus.ACTIVE
|
||||
&& _searchQuery != null
|
||||
&& _searchQuery!.value.isNotEmpty;
|
||||
}
|
||||
Reference in New Issue
Block a user