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(),
|
buildTextColorItem(),
|
||||||
buildHighlightColorItem(),
|
buildHighlightColorItem(),
|
||||||
customizeFontToolbarItem,
|
customizeFontToolbarItem,
|
||||||
...textDirectionItems,
|
|
||||||
];
|
];
|
||||||
|
|
||||||
late final List<SelectionMenuItem> slashMenuItems;
|
late final List<SelectionMenuItem> slashMenuItems;
|
||||||
@ -151,11 +150,32 @@ class _AppFlowyEditorPageState extends State<AppFlowyEditorPage> {
|
|||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void reassemble() {
|
||||||
|
super.reassemble();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final (bool autoFocus, Selection? selection) =
|
final (bool autoFocus, Selection? selection) =
|
||||||
_computeAutoFocusParameters();
|
_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(
|
final editorScrollController = EditorScrollController(
|
||||||
editorState: widget.editorState,
|
editorState: widget.editorState,
|
||||||
shrinkWrap: widget.shrinkWrap,
|
shrinkWrap: widget.shrinkWrap,
|
||||||
@ -181,12 +201,6 @@ class _AppFlowyEditorPageState extends State<AppFlowyEditorPage> {
|
|||||||
footer: const VSpace(200),
|
footer: const VSpace(200),
|
||||||
);
|
);
|
||||||
|
|
||||||
final layoutDirection =
|
|
||||||
context.read<AppearanceSettingsCubit>().state.layoutDirection ==
|
|
||||||
LayoutDirection.rtlLayout
|
|
||||||
? TextDirection.rtl
|
|
||||||
: TextDirection.ltr;
|
|
||||||
|
|
||||||
return Center(
|
return Center(
|
||||||
child: FloatingToolbar(
|
child: FloatingToolbar(
|
||||||
style: styleCustomizer.floatingToolbarStyleBuilder(),
|
style: styleCustomizer.floatingToolbarStyleBuilder(),
|
||||||
|
Loading…
Reference in New Issue
Block a user