mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: only show text direction toolbar item when RTL is enabled
This commit is contained in:
parent
57b78ee3c6
commit
f762a564b5
@ -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();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget 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(),
|
||||
|
Loading…
Reference in New Issue
Block a user