buildDefaultIcon method

Widget buildDefaultIcon(
  1. BuildContext context,
  2. TDCheckboxGroupState? groupState,
  3. bool isChecked
)

默认的checkBox icon

Implementation

Widget buildDefaultIcon(
    BuildContext context, TDCheckboxGroupState? groupState, bool isChecked) {
  if (cardMode == true) {
    return Container();
  }
  Widget current;
  var size = 24.0;
  final style =
      this.style ?? groupState?.widget.style ?? TDCheckboxStyle.circle;
  final theme = TDTheme.of(context);
  final deSelectedColor =
      style == TDCheckboxStyle.check ? Colors.transparent : theme.grayColor4;
  current = Icon(
    style == TDCheckboxStyle.circle
        ? isChecked
            ? TDIcons.check_circle_filled
            : TDIcons.circle
        : style == TDCheckboxStyle.square
            ? isChecked
                ? TDIcons.check_rectangle_filled
                : TDIcons.rectangle
            : isChecked
                ? TDIcons.check
                : TDIcons.check,
    size: size,
    color: !enable
        ? (isChecked ? theme.brandDisabledColor : deSelectedColor)
        : isChecked
            ? theme.brandNormalColor
            : deSelectedColor,
  );
  return current;
}