from static method

XButtonParams from(
  1. XButton widget,
  2. SSRBuildContext context
)

Implementation

static XButtonParams from(
  XButton widget,
  SSRBuildContext context,
) {
  final child = _cookWidget(widget.child, context);

  return XButtonParams(
    child: child ?? const EmptyWidget(),
    onPressed: widget.onPressed.buildHandler(context),
    state: widget.state.toButtonState(),
    width: widget.width.toExtent(isDimension: true),
    height: widget.height.toExtent(isDimension: true),
    size: widget.size.toButtonSize(),
    isGhost: widget.isGhost,
    isOutlined: widget.isOutlined,
    tapEvent: widget.hasEventOnPress()
        ? ButtonTapEvent(
            name: widget.eventOnPress?.name ?? 'button',
            id: widget.eventOnPress?.id,
            properties: (widget.eventOnPress?.props.toProto3Json()
                    as Map<String, dynamic>?) ??
                {},
          )
        : null,
  );
}