suffixView method

Widget? suffixView()

Suffix widget to show

Implementation

Widget? suffixView() {
  final List<Widget> children = [];
  final String tempValue = controller!.text;
  final double tempSize = math.min(widget.height / 2, 24);
  final Color tempColor =
      widget.suffixColor ?? Theme.of(context).iconTheme.color ?? Colors.black;

  // Clear Button
  if (widget.clear && focusNode!.hasFocus && (tempValue.isNotEmpty)) {
    children.add(GestureDetector(
      onTap: clear,
      child: Icon(
        Icons.clear,
        size: tempSize,
        color: tempColor,
      ),
    ));
  }

  // Password Button
  if (widget.isPassword) {
    if (children.isNotEmpty) {
      children.add(const SizedBox(width: 8));
    }
    children.add(GestureDetector(
      onTap: togglePwd,
      child: Icon(
        obscureText ? Icons.visibility : Icons.visibility_off,
        size: tempSize,
        color: tempColor,
      ),
    ));
  }

  if (children.isNotEmpty) {
    if (widget.borderType == VxTextFieldBorderType.roundLine) {
      children.add(const SizedBox(width: 8));
    }
    return Row(
      mainAxisSize: MainAxisSize.min,
      mainAxisAlignment: MainAxisAlignment.end,
      children: children,
    );
  }
  return null;
}