render method

  1. @override
Widget render(
  1. BuildContext context
)
override

Implementation

@override
Widget render(BuildContext context) {
  var defaultIcon = AntdIconWrap(
    style: style.iconStyle,
    child: style.icon,
  );
  var activeIcon = AntdIconWrap(
    style: style.activeIconStyle,
    child: style.activeIcon,
  );

  Widget getIcon() {
    if (widget.disabled == true && style.disableIcon != null) {
      return AntdIconWrap(
        style: style.disableIconStyle,
        child: style.disableIcon,
      );
    }
    if (value == true) {
      if (widget.indeterminate == true) {
        return AntdIconWrap(
          style: style.iconStyle,
          child: AntdBox(
            style: style.indeterminateStyle,
          ),
        );
      }
      return activeIcon;
    }
    return defaultIcon;
  }

  return AntdBox(
      style: style.bodyStyle,
      onTap: () {
        changeValue(() {
          handleHapticFeedback(widget.hapticFeedback);
          return !(value == true);
        });
      },
      disabled: widget.disabled,
      child: AntdRow(
        style: style.rowStyle,
        children: [
          getIcon(),
          if (widget.extra != null)
            AntdBox(
              style: style.extraStyle,
              child: widget.extra,
            )
        ],
      ));
}