TF-2537 Fix app crash when user trying attach file to composer in web app

Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
dab246
2024-02-21 08:31:40 +07:00
committed by Dat H. Pham
parent 20fe348672
commit 7e96d09f52
9 changed files with 96 additions and 52 deletions
@@ -1,5 +1,6 @@
import 'package:core/presentation/resources/image_paths.dart';
import 'package:core/presentation/views/button/tmail_button_widget.dart';
import 'package:core/utils/platform_info.dart';
import 'package:extended_text/extended_text.dart';
import 'package:filesize/filesize.dart';
import 'package:flutter/material.dart';
@@ -58,18 +59,25 @@ class AttachmentItemComposerWidget extends StatelessWidget with AppLoaderMixin {
),
const SizedBox(width: AttachmentItemComposerWidgetStyle.space),
Expanded(
child: ExtendedText(
fileState.fileName,
maxLines: 1,
overflowWidget: const TextOverflowWidget(
position: TextOverflowPosition.middle,
child: Text(
'...',
style: AttachmentItemComposerWidgetStyle.dotsLabelTextStyle,
),
),
style: AttachmentItemComposerWidgetStyle.labelTextStyle,
),
child: PlatformInfo.isCanvasKit
? ExtendedText(
fileState.fileName,
maxLines: 1,
overflowWidget: const TextOverflowWidget(
position: TextOverflowPosition.middle,
child: Text(
'...',
style: AttachmentItemComposerWidgetStyle.dotsLabelTextStyle,
),
),
style: AttachmentItemComposerWidgetStyle.labelTextStyle,
)
: Text(
fileState.fileName,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: AttachmentItemComposerWidgetStyle.labelTextStyle,
)
),
const SizedBox(width: AttachmentItemComposerWidgetStyle.space),
Text(
@@ -57,7 +57,7 @@ class RecipientTagItemWidget extends StatelessWidget {
Flexible(
child: Padding(
padding: EdgeInsetsDirectional.only(
top: PlatformInfo.isWebMobile ? 0 : 8
top: !PlatformInfo.isCanvasKit ? 0 : 8
),
child: InkWell(
onTap: () => isCollapsed
@@ -158,10 +158,10 @@ class RecipientTagItemWidget extends StatelessWidget {
}
EdgeInsetsGeometry? get _counterMargin {
if (PlatformInfo.isWebMobile) {
return RecipientTagItemWidgetStyle.webMobileCounterMargin;
} else if (PlatformInfo.isWeb) {
return RecipientTagItemWidgetStyle.webCounterMargin;
if (PlatformInfo.isWeb) {
return PlatformInfo.isCanvasKit
? RecipientTagItemWidgetStyle.webCounterMargin
: RecipientTagItemWidgetStyle.webMobileCounterMargin;
} else {
return RecipientTagItemWidgetStyle.counterMargin;
}