Implementation
final List<SelectionMenuItem> standardSelectionMenuItems = [
SelectionMenuItem(
getName: () => AppFlowyEditorL10n.current.text,
icon: (editorState, isSelected, style) => SelectionMenuIconWidget(
name: 'text',
isSelected: isSelected,
style: style,
),
keywords: ['text'],
handler: (editorState, _, __) {
insertNodeAfterSelection(editorState, paragraphNode());
},
),
SelectionMenuItem(
getName: () => AppFlowyEditorL10n.current.heading1,
icon: (editorState, isSelected, style) => SelectionMenuIconWidget(
name: 'h1',
isSelected: isSelected,
style: style,
),
keywords: ['heading 1, h1'],
handler: (editorState, _, __) {
insertHeadingAfterSelection(editorState, 1);
},
),
SelectionMenuItem(
getName: () => AppFlowyEditorL10n.current.heading2,
icon: (editorState, isSelected, style) => SelectionMenuIconWidget(
name: 'h2',
isSelected: isSelected,
style: style,
),
keywords: ['heading 2, h2'],
handler: (editorState, _, __) {
insertHeadingAfterSelection(editorState, 2);
},
),
SelectionMenuItem(
getName: () => AppFlowyEditorL10n.current.heading3,
icon: (editorState, isSelected, style) => SelectionMenuIconWidget(
name: 'h3',
isSelected: isSelected,
style: style,
),
keywords: ['heading 3, h3'],
handler: (editorState, _, __) {
insertHeadingAfterSelection(editorState, 3);
},
),
SelectionMenuItem(
getName: () => AppFlowyEditorL10n.current.image,
icon: (editorState, isSelected, style) => SelectionMenuIconWidget(
name: 'image',
isSelected: isSelected,
style: style,
),
keywords: ['image'],
handler: (editorState, menuService, context) {
final container = Overlay.of(context, rootOverlay: true);
showImageMenu(container, editorState, menuService);
},
),
SelectionMenuItem(
getName: () => AppFlowyEditorL10n.current.bulletedList,
icon: (editorState, isSelected, style) => SelectionMenuIconWidget(
name: 'bulleted_list',
isSelected: isSelected,
style: style,
),
keywords: ['bulleted list', 'list', 'unordered list'],
handler: (editorState, _, __) {
insertBulletedListAfterSelection(editorState);
},
),
SelectionMenuItem(
getName: () => AppFlowyEditorL10n.current.numberedList,
icon: (editorState, isSelected, style) => SelectionMenuIconWidget(
name: 'number',
isSelected: isSelected,
style: style,
),
keywords: ['numbered list', 'list', 'ordered list'],
handler: (editorState, _, __) {
insertNumberedListAfterSelection(editorState);
},
),
SelectionMenuItem(
getName: () => AppFlowyEditorL10n.current.checkbox,
icon: (editorState, isSelected, style) => SelectionMenuIconWidget(
name: 'checkbox',
isSelected: isSelected,
style: style,
),
keywords: ['todo list', 'list', 'checkbox list'],
handler: (editorState, _, __) {
insertCheckboxAfterSelection(editorState);
},
),
SelectionMenuItem(
getName: () => AppFlowyEditorL10n.current.quote,
icon: (editorState, isSelected, style) => SelectionMenuIconWidget(
name: 'quote',
isSelected: isSelected,
style: style,
),
keywords: ['quote', 'refer'],
handler: (editorState, _, __) {
insertQuoteAfterSelection(editorState);
},
),
dividerMenuItem,
tableMenuItem,
];