TF-3601 Fix content gone blank in composer on IOS

Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
dab246
2025-04-03 15:27:55 +07:00
committed by Dat H. Pham
parent d6711ba93b
commit 0703d14761
16 changed files with 274 additions and 88 deletions
@@ -0,0 +1,82 @@
import 'package:core/presentation/extensions/color_extension.dart';
import 'package:core/presentation/resources/image_paths.dart';
import 'package:core/presentation/views/button/tmail_button_widget.dart';
import 'package:core/presentation/views/html_viewer/ios_html_content_viewer_widget.dart';
import 'package:flutter/material.dart';
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
import 'package:tmail_ui_user/main/routes/route_navigation.dart';
import 'package:tmail_ui_user/main/utils/app_utils.dart';
class EditorFullscreenDialogView extends StatelessWidget {
final String content;
final ImagePaths imagePaths;
final String? subject;
const EditorFullscreenDialogView({
super.key,
required this.imagePaths,
required this.content,
this.subject,
});
@override
Widget build(BuildContext context) {
return Dialog(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topRight: Radius.circular(16),
topLeft: Radius.circular(16),
),
),
insetPadding: EdgeInsets.zero,
alignment: Alignment.center,
backgroundColor: Colors.white,
child: Container(
decoration: const BoxDecoration(
borderRadius: BorderRadius.only(
topRight: Radius.circular(16),
topLeft: Radius.circular(16),
),
),
width: double.infinity,
height: double.infinity,
clipBehavior: Clip.antiAlias,
child: Column(
children: [
SizedBox(
height: 52,
child: Row(
children: [
const SizedBox(width: 40),
Expanded(child: Text(
subject ?? AppLocalizations.of(context).compose_email,
style: Theme.of(context).textTheme.titleLarge?.copyWith(
color: Colors.black,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
)),
TMailButtonWidget.fromIcon(
icon: imagePaths.icComposerClose,
backgroundColor: Colors.transparent,
margin: const EdgeInsetsDirectional.only(end: 12),
onTapActionCallback: popBack,
)
],
),
),
const Divider(color: AppColor.colorDivider, height: 1),
Expanded(
child: IosHtmlContentViewerWidget(
contentHtml: content,
useDefaultFont: true,
direction: AppUtils.getCurrentDirection(context),
),
),
],
),
),
);
}
}
@@ -18,6 +18,7 @@ class MobileEditorView extends StatelessWidget with EditorViewMixin {
final Either<Failure, Success>? contentViewState;
final OnCreatedEditorAction onCreatedEditorAction;
final OnLoadCompletedEditorAction onLoadCompletedEditorAction;
final OnEditorContentHeightChanged? onEditorContentHeightChanged;
const MobileEditorView({
super.key,
@@ -25,6 +26,7 @@ class MobileEditorView extends StatelessWidget with EditorViewMixin {
required this.onLoadCompletedEditorAction,
this.arguments,
this.contentViewState,
this.onEditorContentHeightChanged,
});
@override
@@ -41,7 +43,8 @@ class MobileEditorView extends StatelessWidget with EditorViewMixin {
content: HtmlExtension.editorStartTags,
direction: AppUtils.getCurrentDirection(context),
onCreatedEditorAction: onCreatedEditorAction,
onLoadCompletedEditorAction: onLoadCompletedEditorAction
onLoadCompletedEditorAction: onLoadCompletedEditorAction,
onEditorContentHeightChanged: onEditorContentHeightChanged,
);
case EmailActionType.editDraft:
case EmailActionType.editSendingEmail:
@@ -58,7 +61,8 @@ class MobileEditorView extends StatelessWidget with EditorViewMixin {
content: HtmlExtension.editorStartTags,
direction: AppUtils.getCurrentDirection(context),
onCreatedEditorAction: onCreatedEditorAction,
onLoadCompletedEditorAction: onLoadCompletedEditorAction
onLoadCompletedEditorAction: onLoadCompletedEditorAction,
onEditorContentHeightChanged: onEditorContentHeightChanged,
),
(success) {
if (success is GetEmailContentLoading) {
@@ -77,7 +81,8 @@ class MobileEditorView extends StatelessWidget with EditorViewMixin {
content: newContent,
direction: AppUtils.getCurrentDirection(context),
onCreatedEditorAction: onCreatedEditorAction,
onLoadCompletedEditorAction: onLoadCompletedEditorAction
onLoadCompletedEditorAction: onLoadCompletedEditorAction,
onEditorContentHeightChanged: onEditorContentHeightChanged,
);
}
}
@@ -102,7 +107,8 @@ class MobileEditorView extends StatelessWidget with EditorViewMixin {
content: emailContentQuoted,
direction: AppUtils.getCurrentDirection(context),
onCreatedEditorAction: onCreatedEditorAction,
onLoadCompletedEditorAction: onLoadCompletedEditorAction
onLoadCompletedEditorAction: onLoadCompletedEditorAction,
onEditorContentHeightChanged: onEditorContentHeightChanged,
);
},
(success) {
@@ -122,7 +128,8 @@ class MobileEditorView extends StatelessWidget with EditorViewMixin {
content: emailContentQuoted,
direction: AppUtils.getCurrentDirection(context),
onCreatedEditorAction: onCreatedEditorAction,
onLoadCompletedEditorAction: onLoadCompletedEditorAction
onLoadCompletedEditorAction: onLoadCompletedEditorAction,
onEditorContentHeightChanged: onEditorContentHeightChanged,
);
}
}
@@ -132,7 +139,8 @@ class MobileEditorView extends StatelessWidget with EditorViewMixin {
content: HtmlExtension.editorStartTags,
direction: AppUtils.getCurrentDirection(context),
onCreatedEditorAction: onCreatedEditorAction,
onLoadCompletedEditorAction: onLoadCompletedEditorAction
onLoadCompletedEditorAction: onLoadCompletedEditorAction,
onEditorContentHeightChanged: onEditorContentHeightChanged,
);
}
}