buildLabel method

Widget? buildLabel()

Implementation

Widget? buildLabel() {
  if (widget.label == null) {
    return null;
  }

  return AntdBox(
    style: style.labelStyle,
    child: AntdRow(style: style.labelRowStyle, children: [
      if (required == true || existsRequired == true)
        Padding(
          padding: 2.right,
          child: CustomPaint(
            size: style.requireStyle?.size ?? const Size(5, 5),
            painter: _SnowflakePainter(
                color: style.requireStyle?.color ?? token.colorError),
          ),
        ),
      Expanded(
          child: Text.rich(TextSpan(children: [
        if (widget.label != null) WidgetSpan(child: widget.label!),
        if (widget.help != null)
          WidgetSpan(
              child: AntdPopover(
            mode: AntdPopoverMode.dark,
            builder: (close, ctx) {
              return AntdBox(
                child: widget.help,
              );
            },
            child: AntdIconWrap(
                style: style.helpIconStyle, child: widget.helpIcon),
          ))
      ])))
    ]),
  );
}