linkItem top-level property
Implementation
final linkItem = ToolbarItem(
id: _kLinkItemId,
group: 4,
isActive: onlyShowInSingleSelectionAndTextType,
builder: (context, editorState, highlightColor, iconColor, tooltipBuilder) {
final selection = editorState.selection!;
final nodes = editorState.getNodesInSelection(selection);
final isHref = nodes.allSatisfyInSelection(selection, (delta) {
return delta.everyAttributes(
(attributes) => attributes[AppFlowyRichTextKeys.href] != null,
);
});
final child = SVGIconItemWidget(
iconName: 'toolbar/link',
isHighlight: isHref,
highlightColor: highlightColor,
iconColor: iconColor,
onPressed: () {
showLinkMenu(context, editorState, selection, isHref);
},
);
if (tooltipBuilder != null) {
return tooltipBuilder(
context,
_kLinkItemId,
AppFlowyEditorL10n.current.link,
child,
);
}
return child;
},
);