Skip to content

Commit 967e3e8

Browse files
committed
fix: required named parameter 'onLiveTextInput' must be provided
1 parent a0ff609 commit 967e3e8

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

example/lib/pages/mobile_editor.dart

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,18 @@ class _MobileEditorState extends State<MobileEditor> {
5555
child: MobileFloatingToolbar(
5656
editorState: editorState,
5757
editorScrollController: editorScrollController,
58+
toolbarBuilder: (context, anchor) {
59+
return AdaptiveTextSelectionToolbar.editable(
60+
clipboardStatus: ClipboardStatus.pasteable,
61+
onCopy: () => copyCommand.execute(editorState),
62+
onCut: () => cutCommand.execute(editorState),
63+
onPaste: () => pasteCommand.execute(editorState),
64+
onSelectAll: () => selectAllCommand.execute(editorState),
65+
anchors: TextSelectionToolbarAnchors(
66+
primaryAnchor: anchor,
67+
),
68+
);
69+
},
5870
child: AppFlowyEditor(
5971
editorStyle: editorStyle,
6072
editorState: editorState,
@@ -128,6 +140,11 @@ class _MobileEditorState extends State<MobileEditor> {
128140
fontWeight: FontWeight.w600,
129141
),
130142
);
143+
map[ParagraphBlockKeys.type] = TextBlockComponentBuilder(
144+
configuration: BlockComponentConfiguration(
145+
placeholderText: (node) => 'Type something...',
146+
),
147+
);
131148
return map;
132149
}
133150
}

lib/src/editor/toolbar/mobile/mobile_floating_toolbar/mobile_floating_toolbar.dart

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ class MobileFloatingToolbar extends StatefulWidget {
1919
required this.editorState,
2020
required this.editorScrollController,
2121
required this.child,
22+
required this.toolbarBuilder,
2223
});
2324

2425
final EditorState editorState;
2526
final EditorScrollController editorScrollController;
2627
final Widget child;
28+
final Widget Function(BuildContext context, Offset anchor) toolbarBuilder;
2729

2830
@override
2931
State<MobileFloatingToolbar> createState() => _MobileFloatingToolbarState();
@@ -149,18 +151,9 @@ class _MobileFloatingToolbarState extends State<MobileFloatingToolbar>
149151

150152
Widget _buildToolbar(
151153
BuildContext context,
152-
Offset? offset,
154+
Offset offset,
153155
) {
154-
return AdaptiveTextSelectionToolbar.editable(
155-
clipboardStatus: ClipboardStatus.pasteable,
156-
onCopy: () => copyCommand.execute(editorState),
157-
onCut: () => cutCommand.execute(editorState),
158-
onPaste: () => pasteCommand.execute(editorState),
159-
onSelectAll: () => selectAllCommand.execute(editorState),
160-
anchors: TextSelectionToolbarAnchors(
161-
primaryAnchor: offset ?? Offset.zero,
162-
),
163-
);
156+
return widget.toolbarBuilder(context, offset);
164157
}
165158

166159
Rect _findSuitableRect(Iterable<Rect> rects) {

0 commit comments

Comments
 (0)