Change order of attachment and mail body on mobile
Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
@@ -3,10 +3,8 @@ import 'package:core/presentation/resources/image_paths.dart';
|
||||
import 'package:core/presentation/utils/responsive_utils.dart';
|
||||
import 'package:core/presentation/utils/theme_utils.dart';
|
||||
import 'package:core/presentation/views/button/tmail_button_widget.dart';
|
||||
import 'package:core/utils/platform_info.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:tmail_ui_user/features/email/presentation/styles/email_attachments_styles.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
|
||||
class AttachmentsInfo extends StatelessWidget {
|
||||
@@ -17,7 +15,6 @@ class AttachmentsInfo extends StatelessWidget {
|
||||
required this.totalSizeInfo,
|
||||
required this.responsiveUtils,
|
||||
this.onTapShowAllAttachmentFile,
|
||||
this.downloadAllEnabled = false,
|
||||
this.onTapDownloadAllButton,
|
||||
});
|
||||
|
||||
@@ -26,75 +23,97 @@ class AttachmentsInfo extends StatelessWidget {
|
||||
final String totalSizeInfo;
|
||||
final ResponsiveUtils responsiveUtils;
|
||||
final VoidCallback? onTapShowAllAttachmentFile;
|
||||
final bool downloadAllEnabled;
|
||||
final VoidCallback? onTapDownloadAllButton;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
List<Widget> attachmentsAmountAndSize = [
|
||||
SvgPicture.asset(
|
||||
imagePaths.icAttachment,
|
||||
width: EmailAttachmentsStyles.headerIconSize,
|
||||
height: EmailAttachmentsStyles.headerIconSize,
|
||||
colorFilter: EmailAttachmentsStyles.headerIconColor.asFilter(),
|
||||
fit: BoxFit.fill
|
||||
),
|
||||
const SizedBox(width: EmailAttachmentsStyles.headerSpace),
|
||||
Text(
|
||||
AppLocalizations.of(context).titleHeaderAttachment(
|
||||
numberOfAttachments,
|
||||
totalSizeInfo,
|
||||
),
|
||||
style: ThemeUtils.defaultTextStyleInterFont.copyWith(
|
||||
fontSize: EmailAttachmentsStyles.headerTextSize,
|
||||
fontWeight: EmailAttachmentsStyles.headerFontWeight,
|
||||
color: EmailAttachmentsStyles.headerTextColor
|
||||
)
|
||||
),
|
||||
];
|
||||
|
||||
final showAllAttachments = (numberOfAttachments > 2)
|
||||
? TMailButtonWidget(
|
||||
text: AppLocalizations.of(context).showAll,
|
||||
backgroundColor: Colors.transparent,
|
||||
borderRadius: EmailAttachmentsStyles.buttonBorderRadius,
|
||||
padding: EmailAttachmentsStyles.buttonPadding,
|
||||
textStyle: ThemeUtils.defaultTextStyleInterFont.copyWith(
|
||||
fontSize: EmailAttachmentsStyles.buttonTextSize,
|
||||
color: EmailAttachmentsStyles.buttonTextColor,
|
||||
fontWeight: EmailAttachmentsStyles.buttonFontWeight
|
||||
),
|
||||
onTapActionCallback: onTapShowAllAttachmentFile,
|
||||
)
|
||||
: const SizedBox.shrink();
|
||||
|
||||
List<Widget> downloadAllAttachments = downloadAllEnabled && !responsiveUtils.isMobile(context)
|
||||
? [
|
||||
const Spacer(),
|
||||
TMailButtonWidget(
|
||||
text: AppLocalizations.of(context).downloadAll,
|
||||
icon: imagePaths.icDownloadAll,
|
||||
iconAlignment: TextDirection.rtl,
|
||||
backgroundColor: Colors.transparent,
|
||||
borderRadius: EmailAttachmentsStyles.buttonBorderRadius,
|
||||
padding: EmailAttachmentsStyles.buttonPadding,
|
||||
textStyle: ThemeUtils.defaultTextStyleInterFont.copyWith(
|
||||
fontSize: EmailAttachmentsStyles.buttonTextSize,
|
||||
color: EmailAttachmentsStyles.buttonTextColor,
|
||||
fontWeight: EmailAttachmentsStyles.buttonFontWeight
|
||||
),
|
||||
onTapActionCallback: onTapDownloadAllButton,
|
||||
),
|
||||
]
|
||||
: const [];
|
||||
|
||||
return Row(
|
||||
children: [
|
||||
...attachmentsAmountAndSize,
|
||||
if (!PlatformInfo.isWeb) const Spacer(),
|
||||
showAllAttachments,
|
||||
...downloadAllAttachments,
|
||||
],
|
||||
final iconAttachment = SvgPicture.asset(
|
||||
imagePaths.icAttachment,
|
||||
width: 14,
|
||||
height: 14,
|
||||
colorFilter: AppColor.gray959DAD.asFilter(),
|
||||
fit: BoxFit.fill,
|
||||
);
|
||||
|
||||
final titleHeaderAttachment = Text(
|
||||
AppLocalizations.of(context).titleHeaderAttachment(
|
||||
numberOfAttachments,
|
||||
totalSizeInfo,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: ThemeUtils.textStyleInter400.copyWith(
|
||||
fontSize: 15,
|
||||
height: 20 / 15,
|
||||
color: AppColor.gray99A2AD,
|
||||
),
|
||||
);
|
||||
|
||||
final showAllButton = TMailButtonWidget.fromText(
|
||||
text: AppLocalizations.of(context).showAll,
|
||||
backgroundColor: Colors.transparent,
|
||||
textStyle: ThemeUtils.textStyleBodyBody1().copyWith(
|
||||
color: AppColor.steelGray400,
|
||||
),
|
||||
borderRadius: 5,
|
||||
maxLines: 1,
|
||||
maxWidth: 120,
|
||||
padding: const EdgeInsets.symmetric(vertical: 3, horizontal: 5),
|
||||
onTapActionCallback: onTapShowAllAttachmentFile,
|
||||
);
|
||||
|
||||
if (responsiveUtils.isMobile(context)) {
|
||||
return Row(
|
||||
children: [
|
||||
iconAttachment,
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsetsDirectional.only(start: 8, end: 3),
|
||||
child: titleHeaderAttachment,
|
||||
),
|
||||
),
|
||||
if (numberOfAttachments > 3) showAllButton,
|
||||
],
|
||||
);
|
||||
} else {
|
||||
return Row(
|
||||
children: [
|
||||
iconAttachment,
|
||||
Expanded(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Flexible(
|
||||
child: Padding(
|
||||
padding: const EdgeInsetsDirectional.only(start: 8, end: 3),
|
||||
child: titleHeaderAttachment,
|
||||
),
|
||||
),
|
||||
if (numberOfAttachments > 4) showAllButton,
|
||||
],
|
||||
),
|
||||
),
|
||||
if (onTapDownloadAllButton != null)
|
||||
TMailButtonWidget(
|
||||
text: AppLocalizations.of(context).archiveAndDownload,
|
||||
icon: imagePaths.icDownloadAll,
|
||||
iconSize: 20,
|
||||
iconColor: AppColor.steelGrayA540,
|
||||
iconAlignment: TextDirection.rtl,
|
||||
backgroundColor: Colors.transparent,
|
||||
borderRadius: 5,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
flexibleText: true,
|
||||
maxLines: 1,
|
||||
maxWidth: 300,
|
||||
padding: const EdgeInsets.symmetric(vertical: 3, horizontal: 5),
|
||||
textStyle: ThemeUtils.textStyleBodyBody1().copyWith(
|
||||
color: AppColor.steelGray400,
|
||||
),
|
||||
onTapActionCallback: onTapDownloadAllButton,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user