From 462daee934bcb1b30a601be8b19584e2d8ddc8c0 Mon Sep 17 00:00:00 2001 From: "Lucas.Xu" Date: Tue, 22 Nov 2022 20:06:54 +0800 Subject: [PATCH] fix: #1467 Editor's left and right margins is too rigid (#1471) --- .../app_flowy/lib/plugins/document/document_page.dart | 10 ++++++++-- .../app_flowy/lib/plugins/document/editor_styles.dart | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/frontend/app_flowy/lib/plugins/document/document_page.dart b/frontend/app_flowy/lib/plugins/document/document_page.dart index cc4b31f582..57dbcd1367 100644 --- a/frontend/app_flowy/lib/plugins/document/document_page.dart +++ b/frontend/app_flowy/lib/plugins/document/document_page.dart @@ -96,6 +96,7 @@ class _DocumentPageState extends State { Widget _renderAppFlowyEditor(EditorState editorState) { final theme = Theme.of(context); + final editorMaxWidth = MediaQuery.of(context).size.width * 0.6; final editor = AppFlowyEditor( editorState: editorState, autoFocus: editorState.document.isEmpty, @@ -112,8 +113,13 @@ class _DocumentPageState extends State { ]), ); return Expanded( - child: SizedBox.expand( - child: editor, + child: Center( + child: Container( + constraints: BoxConstraints( + maxWidth: editorMaxWidth, + ), + child: editor, + ), ), ); } diff --git a/frontend/app_flowy/lib/plugins/document/editor_styles.dart b/frontend/app_flowy/lib/plugins/document/editor_styles.dart index 00cbcb473e..0468542a51 100644 --- a/frontend/app_flowy/lib/plugins/document/editor_styles.dart +++ b/frontend/app_flowy/lib/plugins/document/editor_styles.dart @@ -8,6 +8,7 @@ EditorStyle customEditorTheme(BuildContext context) { ? EditorStyle.dark : EditorStyle.light; editorStyle = editorStyle.copyWith( + padding: const EdgeInsets.all(0), textStyle: editorStyle.textStyle?.copyWith( fontFamily: 'poppins', fontSize: _baseFontSize,