Fix display content full screen in Email Detailed
This commit is contained in:
@@ -13,10 +13,8 @@ import 'package:tmail_ui_user/features/composer/presentation/extensions/prefix_e
|
||||
import 'package:tmail_ui_user/features/email/presentation/email_controller.dart';
|
||||
import 'package:tmail_ui_user/features/email/presentation/widgets/app_bar_mail_widget_builder.dart';
|
||||
import 'package:tmail_ui_user/features/email/presentation/widgets/attachment_file_tile_builder.dart';
|
||||
import 'package:tmail_ui_user/features/email/presentation/widgets/attachments_place_holder_loading_widget.dart';
|
||||
import 'package:tmail_ui_user/features/email/presentation/widgets/bottom_bar_mail_widget_builder.dart';
|
||||
import 'package:tmail_ui_user/features/email/presentation/widgets/email_action_cupertino_action_sheet_action_builder.dart';
|
||||
import 'package:tmail_ui_user/features/email/presentation/widgets/email_content_place_holder_loading_widget.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/user_setting_popup_menu_mixin.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
import 'package:filesize/filesize.dart';
|
||||
@@ -197,8 +195,8 @@ class EmailView extends GetView with UserSettingPopupMenuMixin, NetworkConnectio
|
||||
padding: EdgeInsets.only(right: 16),
|
||||
child: SelectableText(
|
||||
'${emailController.mailboxDashBoardController.selectedEmail.value?.getEmailTitle()}',
|
||||
maxLines: 3,
|
||||
minLines: 1,
|
||||
maxLines: kIsWeb ? 3 : null,
|
||||
minLines: kIsWeb ? 1 : null,
|
||||
cursorColor: AppColor.colorTextButton,
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
@@ -237,6 +235,7 @@ class EmailView extends GetView with UserSettingPopupMenuMixin, NetworkConnectio
|
||||
Expanded(child: _buildEmailContent(context, constraints))
|
||||
else
|
||||
_buildEmailContent(context, constraints),
|
||||
SizedBox(height: 16),
|
||||
],
|
||||
);
|
||||
})
|
||||
@@ -398,7 +397,7 @@ class EmailView extends GetView with UserSettingPopupMenuMixin, NetworkConnectio
|
||||
(failure) => SizedBox.shrink(),
|
||||
(success) {
|
||||
if (success is LoadingState) {
|
||||
return AttachmentsPlaceHolderLoading(responsiveUtils: responsiveUtils);
|
||||
return SizedBox.shrink();
|
||||
} else {
|
||||
final attachments = emailController.attachments.listAttachmentsDisplayedOutSide;
|
||||
return attachments.isNotEmpty
|
||||
@@ -412,9 +411,9 @@ class EmailView extends GetView with UserSettingPopupMenuMixin, NetworkConnectio
|
||||
if (responsiveUtils.isMobileDevice(context)) {
|
||||
return 2;
|
||||
} else if (responsiveUtils.isTablet(context)) {
|
||||
return 4;
|
||||
} else {
|
||||
return 3;
|
||||
} else {
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -439,7 +438,7 @@ class EmailView extends GetView with UserSettingPopupMenuMixin, NetworkConnectio
|
||||
key: Key('list_attachment'),
|
||||
primary: false,
|
||||
shrinkWrap: true,
|
||||
padding: EdgeInsets.only(top: isExpand ? 0 : 16),
|
||||
padding: EdgeInsets.only(top: isExpand ? 0 : 16, bottom: 16),
|
||||
itemCount: countAttachments,
|
||||
gridDelegate: SliverGridDelegateFixedHeight(
|
||||
height: 60,
|
||||
@@ -523,26 +522,27 @@ class EmailView extends GetView with UserSettingPopupMenuMixin, NetworkConnectio
|
||||
(failure) => SizedBox.shrink(),
|
||||
(success) {
|
||||
if (success is LoadingState) {
|
||||
return EmailContentPlaceHolderLoading(responsiveUtils: responsiveUtils);
|
||||
return Padding(
|
||||
padding: EdgeInsets.all(16),
|
||||
child: SizedBox(
|
||||
width: 30,
|
||||
height: 30,
|
||||
child: CupertinoActivityIndicator(color: AppColor.colorLoading)));
|
||||
} else {
|
||||
if (emailController.emailContents.isNotEmpty) {
|
||||
final allEmailContents = emailController.emailContents
|
||||
.map((emailContent) => emailContent.asHtml)
|
||||
.toList()
|
||||
.join('<br>');
|
||||
final allEmailContents = emailController.emailContents.asHtmlString;
|
||||
|
||||
if (kIsWeb) {
|
||||
return HtmlContentViewerOnWeb(
|
||||
widthContent: constraints.maxWidth,
|
||||
heightContent: MediaQuery.of(context).size.height,
|
||||
heightContent: responsiveUtils.getSizeScreenHeight(context),
|
||||
contentHtml: allEmailContents,
|
||||
controller: HtmlViewerControllerForWeb(),
|
||||
mailtoDelegate: (uri) => emailController.openMailToLink(uri));
|
||||
} else {
|
||||
return HtmlContentViewer(
|
||||
widthContent: MediaQuery.of(context).size.width,
|
||||
heightContent: responsiveUtils.getSizeScreenHeight(context),
|
||||
contentHtml: allEmailContents,
|
||||
loadingWidget: EmailContentPlaceHolderLoading(responsiveUtils: responsiveUtils),
|
||||
mailtoDelegate: (uri) async => emailController.openMailToLink(uri));
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
|
||||
import 'package:core/core.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:model/model.dart';
|
||||
|
||||
class EmailContentItemBuilder {
|
||||
|
||||
final BuildContext _context;
|
||||
final EmailContent _emailContent;
|
||||
final Widget? loadingWidget;
|
||||
final BoxConstraints _constraints;
|
||||
|
||||
EmailContentItemBuilder(
|
||||
this._context,
|
||||
this._emailContent,
|
||||
this._constraints,
|
||||
{
|
||||
this.loadingWidget
|
||||
}
|
||||
);
|
||||
|
||||
Widget build() {
|
||||
return Theme(
|
||||
data: ThemeData(
|
||||
splashColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent),
|
||||
child: MediaQuery(
|
||||
data: MediaQueryData(padding: EdgeInsets.zero),
|
||||
child: _buildItem()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildItem() {
|
||||
switch(_emailContent.type) {
|
||||
case EmailContentType.textHtml:
|
||||
if (kIsWeb) {
|
||||
return HtmlContentViewerOnWeb(
|
||||
widthContent: _constraints.maxWidth,
|
||||
heightContent: MediaQuery.of(_context).size.height,
|
||||
contentHtml: _emailContent.content,
|
||||
controller: HtmlViewerControllerForWeb());
|
||||
} else {
|
||||
return HtmlContentViewer(
|
||||
widthContent: MediaQuery.of(_context).size.width,
|
||||
contentHtml: _emailContent.content,
|
||||
loadingWidget: loadingWidget);
|
||||
}
|
||||
case EmailContentType.textPlain:
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(top: 20),
|
||||
child: SelectableText(
|
||||
_emailContent.content,
|
||||
style: TextStyle(fontSize: 14, color: AppColor.colorNameEmail, fontWeight: FontWeight.normal)));
|
||||
case EmailContentType.other:
|
||||
return SizedBox.shrink();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -253,44 +253,51 @@ class EmailTileBuilder {
|
||||
paddingIconSelect: EdgeInsets.all(5)),
|
||||
),
|
||||
if (_selectModeAll == SelectMode.INACTIVE) SizedBox(width: 10),
|
||||
Container(width: 180, child: _isSearchEnabled
|
||||
? 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,
|
||||
style: TextStyle(fontSize: 15, color: AppColor.colorNameEmail, fontWeight: FontWeight.w600)),
|
||||
Container(
|
||||
width: 160,
|
||||
child: _isSearchEnabled
|
||||
? 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: kIsWeb ? null : TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 15, color: AppColor.colorNameEmail, fontWeight: FontWeight.w600)),
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
SizedBox(width: 24),
|
||||
Expanded(child: _buildSubjectAndContent()),
|
||||
SizedBox(width: 10),
|
||||
SizedBox(width: 16),
|
||||
if (_searchStatus == SearchStatus.ACTIVE && _presentationEmail.mailboxName.isNotEmpty)
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 8),
|
||||
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 3),
|
||||
constraints: BoxConstraints(maxWidth: 100),
|
||||
constraints: BoxConstraints(maxWidth: 80),
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(10), color: AppColor.backgroundCounterMailboxColor),
|
||||
child: Text('${_presentationEmail.mailboxName}',
|
||||
maxLines: 1,
|
||||
overflow: kIsWeb ? null : TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 10, color: AppColor.mailboxTextColor, fontWeight: FontWeight.bold),
|
||||
)
|
||||
),
|
||||
if (_presentationEmail.hasAttachment == true)
|
||||
Padding(padding: EdgeInsets.only(left: 8),
|
||||
child: (ButtonBuilder(_imagePaths.icAttachment)
|
||||
..paddingIcon(EdgeInsets.zero)
|
||||
..size(16))
|
||||
.build()),
|
||||
Padding(padding: EdgeInsets.only(right: 20, left: 8),
|
||||
child: Text('${_presentationEmail.getReceivedAt(Localizations.localeOf(_context).toLanguageTag())}',
|
||||
maxLines: 1,
|
||||
style: TextStyle(fontSize: 13, color: AppColor.colorContentEmail, fontWeight: FontWeight.normal))),
|
||||
child: (ButtonBuilder(_imagePaths.icAttachment)
|
||||
..paddingIcon(EdgeInsets.zero)
|
||||
..size(16))
|
||||
.build()),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(right: 20, left: 8),
|
||||
child: Text('${_presentationEmail.getReceivedAt(Localizations.localeOf(_context).toLanguageTag())}',
|
||||
maxLines: 1,
|
||||
textAlign: TextAlign.right,
|
||||
overflow: kIsWeb ? null : TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 13, color: AppColor.colorContentEmail, fontWeight: FontWeight.normal))),
|
||||
]),
|
||||
if (_selectModeAll == SelectMode.INACTIVE)
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 10, bottom: 10, left: 70),
|
||||
padding: EdgeInsets.only(top: 7.5, bottom: 7.5, left: 70),
|
||||
child: Divider(color: AppColor.lineItemListColor, height: 1, thickness: 0.2)),
|
||||
]),
|
||||
);
|
||||
@@ -299,24 +306,24 @@ class EmailTileBuilder {
|
||||
Widget _buildSubjectAndContent() {
|
||||
return LayoutBuilder(builder: (context, constraints) {
|
||||
log('EmailTileBuilder::_buildSubjectAndContent(): maxWidth(Subject+Content): ${constraints.maxWidth}');
|
||||
return Row(
|
||||
children: [
|
||||
Flexible(
|
||||
child: Container(
|
||||
constraints: BoxConstraints(maxWidth: constraints.maxWidth / 2),
|
||||
child: _isSearchEnabled
|
||||
? RichTextBuilder(
|
||||
'${_presentationEmail.getEmailTitle()}',
|
||||
'${_searchQuery!.value}',
|
||||
TextStyle(fontSize: 13, color: AppColor.colorNameEmail, fontWeight: FontWeight.w600),
|
||||
TextStyle(fontSize: 13, backgroundColor: AppColor.bgWordSearch, color: AppColor.colorNameEmail)).build()
|
||||
: Text('${_presentationEmail.getEmailTitle()}',
|
||||
maxLines: 1,
|
||||
style: TextStyle(fontSize: 13, color: AppColor.colorNameEmail, fontWeight: FontWeight.w600))
|
||||
)
|
||||
),
|
||||
if (_presentationEmail.getEmailTitle().isNotEmpty) SizedBox(width: 12),
|
||||
Expanded(child: _isSearchEnabled
|
||||
return Row(children: [
|
||||
Container(
|
||||
constraints: BoxConstraints(maxWidth: constraints.maxWidth / 2),
|
||||
child: _isSearchEnabled
|
||||
? RichTextBuilder(
|
||||
'${_presentationEmail.getEmailTitle()}',
|
||||
'${_searchQuery!.value}',
|
||||
TextStyle(fontSize: 13, color: AppColor.colorNameEmail, fontWeight: FontWeight.w600),
|
||||
TextStyle(fontSize: 13, backgroundColor: AppColor.bgWordSearch, color: AppColor.colorNameEmail)).build()
|
||||
: Text('${_presentationEmail.getEmailTitle()}',
|
||||
maxLines: 1,
|
||||
overflow: kIsWeb ? null : TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 13, color: AppColor.colorNameEmail, fontWeight: FontWeight.w600))
|
||||
),
|
||||
if (_presentationEmail.getEmailTitle().isNotEmpty) SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Container(
|
||||
child: _isSearchEnabled
|
||||
? RichTextBuilder(
|
||||
'${_presentationEmail.getPartialContent()}',
|
||||
'${_searchQuery!.value}',
|
||||
@@ -324,9 +331,11 @@ class EmailTileBuilder {
|
||||
TextStyle(fontSize: 13, color: AppColor.colorContentEmail, backgroundColor: AppColor.bgWordSearch)).build()
|
||||
: Text('${_presentationEmail.getPartialContent()}',
|
||||
maxLines: 1,
|
||||
style: TextStyle(fontSize: 13, color: AppColor.colorContentEmail, fontWeight: FontWeight.normal))),
|
||||
]
|
||||
);
|
||||
overflow: kIsWeb ? null : TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 13, color: AppColor.colorContentEmail, fontWeight: FontWeight.normal))
|
||||
)
|
||||
),
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user