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,
  15. bool isCompact = false,
})

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,
  bool isCompact = false,
}) {
  Widget? toIconWidget(dynamic ic) {
    if (ic is IconData) return Icon(ic);
    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,
    isCompact: isCompact,
  );
}