buttonLetter method

Widget buttonLetter(
  1. String letter
)

Implementation

Widget buttonLetter(String letter) {
  return ClipRRect(
    borderRadius: widget.borderRadius ?? BorderRadius.circular(0),
    child: Container(
      height: widget.height ?? height,
      width: widget.width ?? width,
      child: Material(
        type: MaterialType.button,
        color: widget.color,
        child: InkWell(
          highlightColor: widget.highlightColor,
          splashColor: widget.splashColor,
          onTap: () {
            HapticFeedback.heavyImpact();
            widget.controller?.text += letter;
            widget.controller?.selection = TextSelection.fromPosition(
                TextPosition(offset: widget.controller!.text.length));
          },
          onLongPress: () {
            if (widget.enableLongPressUppercase &&
                !widget.enableAllUppercase) {
              widget.controller?.text += letter.toUpperCase();
              widget.controller?.selection = TextSelection.fromPosition(
                  TextPosition(offset: widget.controller!.text.length));
            }
          },
          child: Center(
            child: Text(
              letter,
              style: widget.letterStyle,
            ),
          ),
        ),
      ),
    ),
  );
}