tuiBuild method

  1. @override
Widget tuiBuild(
  1. BuildContext context,
  2. TUIKitBuildValue value
)
override

Implementation

@override
Widget tuiBuild(BuildContext context, TUIKitBuildValue value) {
  final TUITheme theme = value.theme;

  BoxDecoration boxDecoration = !isChecked
      ? BoxDecoration(
          border: Border.all(color: hexToColor("888888")),
          shape: BoxShape.circle,
          color: Colors.white)
      : BoxDecoration(shape: BoxShape.circle, color: theme.primaryColor);

  if (disabled) {
    boxDecoration =
        const BoxDecoration(shape: BoxShape.circle, color: Colors.grey);
  }
  return Center(
      child: onlyShow
          ? Container(
              height: size ?? 22,
              width: size ?? 22,
              decoration: boxDecoration,
              child: Icon(
                Icons.check,
                size: size != null ? (size! / 2) : 11,
                color: Colors.white,
              ),
            )
          : InkWell(
              onTap: () {
                if (onChanged != null && !disabled) {
                  onChanged!(!isChecked);
                }
              },
              child: Container(
                height: size ?? 22,
                width: size ?? 22,
                decoration: boxDecoration,
                child: Icon(
                  Icons.check,
                  size: size != null ? (size! / 2) : 11,
                  color: Colors.white,
                ),
              ),
            ));
}