feat: optimize the performance (#442)

This commit is contained in:
Lucas.Xu 2023-09-11 15:03:14 +08:00 • committed by GitHub
commit 19f999f422
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -47,6 +47,13 @@ class TestableEditor {
if (withFloatingToolbar) {
scrollController ??= ScrollController();
}
final editorScrollController = EditorScrollController(
editorState: editorState,
shrinkWrap: shrinkWrap,
scrollController: scrollController,
);
Widget editor = Builder(
builder: (context) {
return AppFlowyEditor(
@ -54,7 +61,7 @@ class TestableEditor {
editable: editable,
autoFocus: autoFocus,
shrinkWrap: shrinkWrap,
scrollController: scrollController,
editorScrollController: editorScrollController,
commandShortcutEvents: [
...standardCommandShortcutEvents,
...TestableFindAndReplaceCommands(context: context)
@ -66,6 +73,7 @@ class TestableEditor {
);
},
);
if (withFloatingToolbar) {
if (inMobile) {
final items = [
@ -83,7 +91,6 @@ class TestableEditor {
child: AppFlowyEditor(
editorStyle: const EditorStyle.mobile(),
editorState: editorState,
scrollController: scrollController,
),
),
MobileToolbar(
@ -106,7 +113,7 @@ class TestableEditor {
buildHighlightColorItem()
],
editorState: editorState,
scrollController: scrollController!,
editorScrollController: editorScrollController,
child: editor,
);
}