render method

  1. @override
Widget render(
  1. BuildContext context,
  2. AntdSelectorOptionStyle style
)
override

Implementation

@override
Widget render(BuildContext context, AntdSelectorOptionStyle style) {
  var badge = CustomPaint(
    size: style.badge.size,
    painter: _TrianglePainter(
      color: style.badge.color,
    ),
  );
  var checkIcon = CustomPaint(
    size: style.checkIcon.size,
    painter: _CheckMarkPainter(
      color: style.checkIcon.color,
    ),
  );
  return AntdBox(
      style: style.bodyStyle,
      disabled: disabled,
      onTap: () {
        handleHapticFeedback(hapticFeedback);
        onChange?.call(!check);
      },
      child: Stack(
        children: [
          AntdBox(
            style: (check ? style.activeItemStyle : style.itemStyle),
            child: Column(
              children: [
                AntdBox(
                  style: style.labelStyle,
                  child: label,
                ),
                if (description != null)
                  AntdBox(
                    style: style.descriptionStyle,
                    child: description!,
                  )
              ],
            ),
          ),
          if (check) Positioned(right: 0, bottom: 0, child: badge),
          if (check)
            Positioned(
                right:
                    (style.badge.size.width - style.checkIcon.size.width) / 8,
                bottom:
                    (style.badge.size.height - style.checkIcon.size.height) /
                        6,
                child: checkIcon)
        ],
      ));
}