getElementWidget static method
Returns a padded widget that displays the KP element, or rarely null.
Implementation
static Widget? getElementWidget({
required KnowledgePanelElement knowledgePanelElement,
required Product product,
required bool isInitiallyExpanded,
required bool isClickable,
required bool isTextSelectable,
required int position,
required bool simplified,
}) {
final Widget? result = knowledgePanelElement.getElementWidget(
product: product,
isInitiallyExpanded: isInitiallyExpanded,
isClickable: isClickable,
isTextSelectable: isTextSelectable,
position: position,
simplified: simplified,
);
if (result == null) {
return null;
}
if (<KnowledgePanelElementType>[
KnowledgePanelElementType.PANEL,
KnowledgePanelElementType.PANEL_GROUP,
].contains(knowledgePanelElement.elementType)) {
return result;
}
if (result is KnowledgePanelTextCard ||
knowledgePanelElement.elementType == KnowledgePanelElementType.TABLE) {
return result;
}
return Padding(
padding: const EdgeInsetsDirectional.symmetric(horizontal: SMALL_SPACE),
child: result,
);
}