Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
feat: only show text direction toolbar item when RTL is enabled
Lucas.Xuf762a564b5a9
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dartindex f86d82657a..51401758ef 100644--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart@@ -76,7 +76,6 @@ class _AppFlowyEditorPageState extends State<AppFlowyEditorPage> {buildTextColorItem(),buildHighlightColorItem(),customizeFontToolbarItem,- ...textDirectionItems,];late final List<SelectionMenuItem> slashMenuItems;@@ -151,11 +150,32 @@ class _AppFlowyEditorPageState extends State<AppFlowyEditorPage> {super.dispose();}+ @override+ void reassemble() {+ super.reassemble();+ }+@overrideWidget build(BuildContext context) {final (bool autoFocus, Selection? selection) =_computeAutoFocusParameters();+ final isRTL =+ context.read<AppearanceSettingsCubit>().state.layoutDirection ==+ LayoutDirection.rtlLayout;+ final layoutDirection = isRTL ? TextDirection.rtl : TextDirection.ltr;++ // only show the rtl item when the layout direction is ltr.+ for (final item in textDirectionItems) {+ if (isRTL) {+ if (toolbarItems.every((element) => element.id != item.id)) {+ toolbarItems.add(item);+ }+ } else {+ toolbarItems.removeWhere((element) => element.id == item.id);+ }+ }+final editorScrollController = EditorScrollController(editorState: widget.editorState,shrinkWrap: widget.shrinkWrap,@@ -181,12 +201,6 @@ class _AppFlowyEditorPageState extends State<AppFlowyEditorPage> {footer: const VSpace(200),);- final layoutDirection =- context.read<AppearanceSettingsCubit>().state.layoutDirection ==- LayoutDirection.rtlLayout- ? TextDirection.rtl- : TextDirection.ltr;-return Center(child: FloatingToolbar(style: styleCustomizer.floatingToolbarStyleBuilder(),