TF-3627 Remove right padding editor scroll bar in composer

Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
dab246
2025-04-17 09:45:14 +07:00
committed by Dat H. Pham
parent b8b4557fd7
commit 3337a608be
10 changed files with 135 additions and 107 deletions
@@ -17,6 +17,7 @@ class ScrollbarListView extends StatelessWidget {
@override
Widget build(BuildContext context) {
return RawScrollbar(
thickness: 6,
thumbColor: AppColor.thumbScrollbarColor,
radius: const Radius.circular(10.0),
trackRadius: const Radius.circular(10.0),
@@ -213,38 +213,36 @@ class ComposerView extends GetWidget<ComposerController> {
Column(
children: [
Expanded(
child: Padding(
padding: ComposerStyle.mobileEditorPadding,
child: Obx(() => WebEditorView(
key: controller.responsiveContainerKey,
editorController: controller.richTextWebController!.editorController,
arguments: controller.composerArguments.value,
contentViewState: controller.emailContentsViewState.value,
currentWebContent: controller.textEditorWeb,
onInitial: controller.handleInitHtmlEditorWeb,
onChangeContent: controller.onChangeTextEditorWeb,
onFocus: controller.handleOnFocusHtmlEditorWeb,
onMouseDown: controller.handleOnMouseDownHtmlEditorWeb,
onEditorSettings: controller.richTextWebController!.onEditorSettingsChange,
onEditorTextSizeChanged: controller.richTextWebController!.onEditorTextSizeChanged,
height: constraints.maxHeight,
onDragEnter: controller.handleOnDragEnterHtmlEditorWeb,
onDragOver: controller.handleOnDragOverHtmlEditorWeb,
onPasteImageSuccessAction: (listFileUpload) => controller.handleOnPasteImageSuccessAction(
child: Obx(() => WebEditorView(
key: controller.responsiveContainerKey,
editorController: controller.richTextWebController!.editorController,
arguments: controller.composerArguments.value,
contentViewState: controller.emailContentsViewState.value,
currentWebContent: controller.textEditorWeb,
onInitial: controller.handleInitHtmlEditorWeb,
onChangeContent: controller.onChangeTextEditorWeb,
onFocus: controller.handleOnFocusHtmlEditorWeb,
onMouseDown: controller.handleOnMouseDownHtmlEditorWeb,
onEditorSettings: controller.richTextWebController!.onEditorSettingsChange,
onEditorTextSizeChanged: controller.richTextWebController!.onEditorTextSizeChanged,
height: constraints.maxHeight,
horizontalPadding: ComposerStyle.mobileEditorHorizontalPadding,
onDragEnter: controller.handleOnDragEnterHtmlEditorWeb,
onDragOver: controller.handleOnDragOverHtmlEditorWeb,
onPasteImageSuccessAction: (listFileUpload) => controller.handleOnPasteImageSuccessAction(
context: context,
maxWidth: constraintsEditor.maxWidth,
listFileUpload: listFileUpload
),
onPasteImageFailureAction: (listFileUpload, base64, uploadError) =>
controller.handleOnPasteImageFailureAction(
context: context,
maxWidth: constraintsEditor.maxWidth,
listFileUpload: listFileUpload
listFileUpload: listFileUpload,
base64: base64,
uploadError: uploadError
),
onPasteImageFailureAction: (listFileUpload, base64, uploadError) =>
controller.handleOnPasteImageFailureAction(
context: context,
listFileUpload: listFileUpload,
base64: base64,
uploadError: uploadError
),
onInitialContentLoadComplete: controller.onInitialContentLoadCompleteWeb,
)),
),
onInitialContentLoadComplete: controller.onInitialContentLoadCompleteWeb,
)),
),
Obx(() {
if (controller.uploadController.listUploadAttachments.isNotEmpty) {
@@ -497,40 +495,38 @@ class ComposerView extends GetWidget<ComposerController> {
child: Column(
children: [
Expanded(
child: Padding(
padding: ComposerStyle.desktopEditorPadding,
child: Obx(() {
return WebEditorView(
key: controller.responsiveContainerKey,
editorController: controller.richTextWebController!.editorController,
arguments: controller.composerArguments.value,
contentViewState: controller.emailContentsViewState.value,
currentWebContent: controller.textEditorWeb,
onInitial: controller.handleInitHtmlEditorWeb,
onChangeContent: controller.onChangeTextEditorWeb,
onFocus: controller.handleOnFocusHtmlEditorWeb,
onMouseDown: controller.handleOnMouseDownHtmlEditorWeb,
onEditorSettings: controller.richTextWebController?.onEditorSettingsChange,
onEditorTextSizeChanged: controller.richTextWebController?.onEditorTextSizeChanged,
height: constraints.maxHeight,
onDragEnter: controller.handleOnDragEnterHtmlEditorWeb,
onDragOver: controller.handleOnDragOverHtmlEditorWeb,
onPasteImageSuccessAction: (listFileUpload) => controller.handleOnPasteImageSuccessAction(
child: Obx(() {
return WebEditorView(
key: controller.responsiveContainerKey,
editorController: controller.richTextWebController!.editorController,
arguments: controller.composerArguments.value,
contentViewState: controller.emailContentsViewState.value,
currentWebContent: controller.textEditorWeb,
onInitial: controller.handleInitHtmlEditorWeb,
onChangeContent: controller.onChangeTextEditorWeb,
onFocus: controller.handleOnFocusHtmlEditorWeb,
onMouseDown: controller.handleOnMouseDownHtmlEditorWeb,
onEditorSettings: controller.richTextWebController?.onEditorSettingsChange,
onEditorTextSizeChanged: controller.richTextWebController?.onEditorTextSizeChanged,
height: constraints.maxHeight,
horizontalPadding: ComposerStyle.desktopEditorHorizontalPadding,
onDragEnter: controller.handleOnDragEnterHtmlEditorWeb,
onDragOver: controller.handleOnDragOverHtmlEditorWeb,
onPasteImageSuccessAction: (listFileUpload) => controller.handleOnPasteImageSuccessAction(
context: context,
maxWidth: constraintsEditor.maxWidth,
listFileUpload: listFileUpload
),
onPasteImageFailureAction: (listFileUpload, base64, uploadError) =>
controller.handleOnPasteImageFailureAction(
context: context,
maxWidth: constraintsEditor.maxWidth,
listFileUpload: listFileUpload
listFileUpload: listFileUpload,
base64: base64,
uploadError: uploadError
),
onPasteImageFailureAction: (listFileUpload, base64, uploadError) =>
controller.handleOnPasteImageFailureAction(
context: context,
listFileUpload: listFileUpload,
base64: base64,
uploadError: uploadError
),
onInitialContentLoadComplete: controller.onInitialContentLoadCompleteWeb,
);
}),
),
onInitialContentLoadComplete: controller.onInitialContentLoadCompleteWeb,
);
}),
),
Obx(() {
if (controller.uploadController.listUploadAttachments.isNotEmpty) {
@@ -810,38 +806,36 @@ class ComposerView extends GetWidget<ComposerController> {
child: Column(
children: [
Expanded(
child: Padding(
padding: ComposerStyle.tabletEditorPadding,
child: Obx(() => WebEditorView(
key: controller.responsiveContainerKey,
editorController: controller.richTextWebController!.editorController,
arguments: controller.composerArguments.value,
contentViewState: controller.emailContentsViewState.value,
currentWebContent: controller.textEditorWeb,
onInitial: controller.handleInitHtmlEditorWeb,
onChangeContent: controller.onChangeTextEditorWeb,
onFocus: controller.handleOnFocusHtmlEditorWeb,
onMouseDown: controller.handleOnMouseDownHtmlEditorWeb,
onEditorSettings: controller.richTextWebController!.onEditorSettingsChange,
onEditorTextSizeChanged: controller.richTextWebController!.onEditorTextSizeChanged,
height: constraints.maxHeight,
onDragEnter: controller.handleOnDragEnterHtmlEditorWeb,
onDragOver: controller.handleOnDragOverHtmlEditorWeb,
onPasteImageSuccessAction: (listFileUpload) => controller.handleOnPasteImageSuccessAction(
child: Obx(() => WebEditorView(
key: controller.responsiveContainerKey,
editorController: controller.richTextWebController!.editorController,
arguments: controller.composerArguments.value,
contentViewState: controller.emailContentsViewState.value,
currentWebContent: controller.textEditorWeb,
onInitial: controller.handleInitHtmlEditorWeb,
onChangeContent: controller.onChangeTextEditorWeb,
onFocus: controller.handleOnFocusHtmlEditorWeb,
onMouseDown: controller.handleOnMouseDownHtmlEditorWeb,
onEditorSettings: controller.richTextWebController!.onEditorSettingsChange,
onEditorTextSizeChanged: controller.richTextWebController!.onEditorTextSizeChanged,
height: constraints.maxHeight,
horizontalPadding: ComposerStyle.desktopEditorHorizontalPadding,
onDragEnter: controller.handleOnDragEnterHtmlEditorWeb,
onDragOver: controller.handleOnDragOverHtmlEditorWeb,
onPasteImageSuccessAction: (listFileUpload) => controller.handleOnPasteImageSuccessAction(
context: context,
maxWidth: constraintsBody.maxWidth,
listFileUpload: listFileUpload
),
onPasteImageFailureAction: (listFileUpload, base64, uploadError) =>
controller.handleOnPasteImageFailureAction(
context: context,
maxWidth: constraintsBody.maxWidth,
listFileUpload: listFileUpload
listFileUpload: listFileUpload,
base64: base64,
uploadError: uploadError
),
onPasteImageFailureAction: (listFileUpload, base64, uploadError) =>
controller.handleOnPasteImageFailureAction(
context: context,
listFileUpload: listFileUpload,
base64: base64,
uploadError: uploadError
),
onInitialContentLoadComplete: controller.onInitialContentLoadCompleteWeb,
)),
),
onInitialContentLoadComplete: controller.onInitialContentLoadCompleteWeb,
)),
),
Obx(() {
if (controller.uploadController.listUploadAttachments.isNotEmpty) {
@@ -17,6 +17,8 @@ class ComposerStyle {
static const double composerExpandMoreButtonMaxHeight = 52;
static const double padding = 16;
static const double space = 8;
static const double desktopEditorHorizontalPadding = 25;
static const double mobileEditorHorizontalPadding = 16;
static const Color borderColor = AppColor.colorLineComposer;
static const Color backgroundEditorColor = Colors.white;
@@ -29,12 +31,10 @@ class ComposerStyle {
static const EdgeInsetsGeometry desktopRecipientMargin = EdgeInsetsDirectional.only(start: 24);
static const EdgeInsetsGeometry desktopSubjectMargin = EdgeInsetsDirectional.only(start: 24);
static const EdgeInsetsGeometry desktopSubjectPadding = EdgeInsetsDirectional.only(end: 24);
static const EdgeInsetsGeometry desktopEditorPadding = EdgeInsetsDirectional.symmetric(horizontal: 20);
static const EdgeInsetsGeometry tabletRecipientPadding = EdgeInsetsDirectional.only(end: 24);
static const EdgeInsetsGeometry tabletRecipientMargin = EdgeInsetsDirectional.only(start: 24);
static const EdgeInsetsGeometry tabletSubjectMargin = EdgeInsetsDirectional.only(start: 24);
static const EdgeInsetsGeometry tabletSubjectPadding = EdgeInsetsDirectional.only(end: 24);
static const EdgeInsetsGeometry tabletEditorPadding = EdgeInsetsDirectional.symmetric(horizontal: 20);
static const EdgeInsetsGeometry mobileRecipientPadding = EdgeInsetsDirectional.only(end: 16);
static const EdgeInsetsGeometry mobileRecipientMargin = EdgeInsetsDirectional.only(start: 16);
static const EdgeInsetsGeometry mobileSubjectMargin = EdgeInsetsDirectional.only(start: 16);
@@ -28,6 +28,7 @@ class WebEditorView extends StatelessWidget with EditorViewMixin {
final OnEditorSettingsChange? onEditorSettings;
final OnEditorTextSizeChanged? onEditorTextSizeChanged;
final double? height;
final double? horizontalPadding;
final OnDragEnterListener? onDragEnter;
final OnDragOverListener? onDragOver;
final OnPasteImageSuccessAction? onPasteImageSuccessAction;
@@ -48,6 +49,7 @@ class WebEditorView extends StatelessWidget with EditorViewMixin {
this.onEditorSettings,
this.onEditorTextSizeChanged,
this.height,
this.horizontalPadding,
this.onDragEnter,
this.onDragOver,
this.onPasteImageSuccessAction,
@@ -77,6 +79,7 @@ class WebEditorView extends StatelessWidget with EditorViewMixin {
onEditorSettings: onEditorSettings,
onEditorTextSizeChanged: onEditorTextSizeChanged,
height: height,
horizontalPadding: horizontalPadding,
onDragEnter: onDragEnter,
onDragOver: onDragOver,
onPasteImageSuccessAction: onPasteImageSuccessAction,
@@ -106,6 +109,7 @@ class WebEditorView extends StatelessWidget with EditorViewMixin {
onEditorSettings: onEditorSettings,
onEditorTextSizeChanged: onEditorTextSizeChanged,
height: height,
horizontalPadding: horizontalPadding,
onDragEnter: onDragEnter,
onDragOver: onDragOver,
onPasteImageSuccessAction: onPasteImageSuccessAction,
@@ -137,6 +141,7 @@ class WebEditorView extends StatelessWidget with EditorViewMixin {
onEditorSettings: onEditorSettings,
onEditorTextSizeChanged: onEditorTextSizeChanged,
height: height,
horizontalPadding: horizontalPadding,
onDragEnter: onDragEnter,
onDragOver: onDragOver,
onPasteImageSuccessAction: onPasteImageSuccessAction,
@@ -174,6 +179,7 @@ class WebEditorView extends StatelessWidget with EditorViewMixin {
onEditorSettings: onEditorSettings,
onEditorTextSizeChanged: onEditorTextSizeChanged,
height: height,
horizontalPadding: horizontalPadding,
onDragEnter: onDragEnter,
onDragOver: onDragOver,
onPasteImageSuccessAction: onPasteImageSuccessAction,
@@ -206,6 +212,7 @@ class WebEditorView extends StatelessWidget with EditorViewMixin {
onEditorSettings: onEditorSettings,
onEditorTextSizeChanged: onEditorTextSizeChanged,
height: height,
horizontalPadding: horizontalPadding,
onDragEnter: onDragEnter,
onDragOver: onDragOver,
onPasteImageSuccessAction: onPasteImageSuccessAction,
@@ -228,6 +235,7 @@ class WebEditorView extends StatelessWidget with EditorViewMixin {
onEditorSettings: onEditorSettings,
onEditorTextSizeChanged: onEditorTextSizeChanged,
height: height,
horizontalPadding: horizontalPadding,
onDragEnter: onDragEnter,
onDragOver: onDragOver,
onPasteImageSuccessAction: onPasteImageSuccessAction,
@@ -35,6 +35,7 @@ class WebEditorWidget extends StatefulWidget {
final OnEditorSettingsChange? onEditorSettings;
final OnEditorTextSizeChanged? onEditorTextSizeChanged;
final double? height;
final double? horizontalPadding;
final OnDragEnterListener? onDragEnter;
final OnDragOverListener? onDragOver;
final OnPasteImageSuccessAction? onPasteImageSuccessAction;
@@ -54,6 +55,7 @@ class WebEditorWidget extends StatefulWidget {
this.onEditorSettings,
this.onEditorTextSizeChanged,
this.height,
this.horizontalPadding,
this.onDragEnter,
this.onDragOver,
this.onPasteImageSuccessAction,
@@ -118,7 +120,10 @@ class _WebEditorState extends State<WebEditorWidget> {
hint: '',
darkMode: false,
initialText: widget.content,
customBodyCssStyle: HtmlUtils.customCssStyleHtmlEditor(direction: widget.direction),
customBodyCssStyle: HtmlUtils.customCssStyleHtmlEditor(
direction: widget.direction,
horizontalPadding: widget.horizontalPadding,
),
customInternalCSS: HtmlTemplate.customInternalStyleCSS,
spellCheck: true,
disableDragAndDrop: true,