from static method

XExpansionPanelParams? from(
  1. XExpansionPanel widget,
  2. SSRBuildContext context,
  3. WidgetMetadata metadata
)

Implementation

static XExpansionPanelParams? from(
  XExpansionPanel widget,
  SSRBuildContext context,
  WidgetMetadata metadata,
) {
  final children = _buildChildren(widget.children, context);

  if (metadata.vanish && children.isNotEmpty) {
    return null;
  }

  return XExpansionPanelParams(
    children: children,
    title: _cookWidget(widget.title, context) ?? const EmptyWidget(),
    isExpanded: widget.isExpanded ?? false,
    leading: _cookWidget(widget.leading, context) ?? const EmptyWidget(),
    backgroundColor: widget.backgroundColor?.toHubbleColor(),
    collapsedBackgroundColor:
        widget.collapsedBackgroundColor?.toHubbleColor(),
    subtitle: _cookWidget(widget.subtitle, context),
    iconColor: widget.iconColor?.toHubbleColor(),
    tilePadding: widget.tilePadding?.toEdgeInsets(),
    childrenPadding: widget.childrenPadding?.toEdgeInsets(),
    crossAxisAlignment: widget.crossAxisAlignment?.toCrossAxisAlignment(),
    collapsedIconColor: widget.collapsedIconColor?.toHubbleColor(),
    collapsedTextColor: widget.collapsedTextColor?.toHubbleColor(),
    textColor: widget.textColor?.toHubbleColor(),
    trailing: _cookWidget(widget.trailing, context),
  );
}