CLTextField.rightLeftIcon constructor

CLTextField.rightLeftIcon({
  1. Key? key,
  2. required TextEditingController controller,
  3. required String labelText,
  4. required dynamic leftIcon,
  5. required dynamic rightIcon,
  6. GestureTapCallback? onTap,
  7. FocusNode? focusNode,
  8. Future onChanged(
    1. String value
    )?,
  9. bool isRequired = false,
  10. bool isRounded = false,
  11. bool isEnabled = true,
  12. String? initValue,
  13. bool isReadOnly = false,
  14. List<FormFieldValidator<String>>? validators,
})

Implementation

factory CLTextField.rightLeftIcon({
  Key? key,
  required TextEditingController controller,
  required String labelText,
  required dynamic leftIcon,
  required dynamic rightIcon,
  GestureTapCallback? onTap,
  FocusNode? focusNode,
  Future Function(String value)? onChanged,
  bool isRequired = false,
  bool isRounded = false,
  bool isEnabled = true,
  String? initValue,
  bool isReadOnly = false,
  List<FormFieldValidator<String>>? validators,
}) {
  Widget? toIconWidget(dynamic ic) {
    if (ic is IconData) return Icon(ic, size: 16, color: Colors.grey);
    return ic as Widget;
  }
  return CLTextField(
    key: key, controller: controller, labelText: labelText,
    prefixIcon: toIconWidget(leftIcon), suffixIcon: toIconWidget(rightIcon),
    onChanged: onChanged, focusNode: focusNode, onTap: onTap,
    isReadOnly: isReadOnly, isRounded: isRounded, isEnabled: isEnabled,
    validators: validators, initValue: initValue,
  );
}