buildOptionButton static method

Widget buildOptionButton(
  1. int index,
  2. bool isSelected,
  3. String letter,
  4. bool enable,
  5. dynamic onOptionSelected(
    1. int index
    ),
)

Implementation

static Widget buildOptionButton(
  int index,
  bool isSelected,
  String letter,
  bool enable,
  Function(int index) onOptionSelected,
) {
  return SizedBox(
    width: 40.w,
    height: 40.w,
    child: TextButton(
      style: TextButton.styleFrom(
        backgroundColor: isSelected ? const Color(0xff006CFF) : Colors.white,
        shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(3),
          side: BorderSide(
            color:
                isSelected
                    ? const Color(0xff006CFF)
                    : const Color(0xffD8E7FF),
            width: 2.w,
          ),
        ),
        splashFactory: InkRipple.splashFactory,
      ),
      onPressed: enable ? () => onOptionSelected(index) : null,
      child: Text(
        letter,
        style: TextStyle(
          fontSize: 18.sp,
          color: isSelected ? Colors.white : Color(0xff393939),
        ),
      ),
    ),
  );
}