buttonWidget method Null safety

Widget buttonWidget(
  1. CowGroup? group
)

Implementation

Widget buttonWidget(CowGroup? group) {
  return InkWell(
    onTap: () {
      cowGroupState.changeCurrentGroup(group);
      LogManager().addLog("${group?.name == null ? "전체" : group?.name} 그룹 버튼 선택", action: LogConstants.menuTap);
      Navigator.of(context, rootNavigator: true).pop();
      if (widget.onTap != null) widget.onTap!(group);
    },
    child: Ink(
      child: Container(
        padding: EdgeInsets.symmetric(horizontal: 24, vertical: 12),
        child: Row(
          children: [
            Flexible(
              child: Container(
                alignment: Alignment.centerLeft,
                child: Text(
                  group == null ? "전체" : group.name,
                  style: TextStyle(fontWeight: FontWeight.bold, color: (group == cowGroupState.currentCowGroup) ? CustomColors.emerald : Colors.black),
                  textAlign: TextAlign.center,
                ),
              ),
            ),
            if (group == cowGroupState.currentCowGroup) Icon(Icons.check, color: CustomColors.emerald, size: 20),
          ],
        ),
      ),
    ),
  );
}