SmartTextField constructor

SmartTextField({
  1. Key? key,
  2. String text = "",
  3. required String hintText,
  4. required TextEditingController controller,
  5. bool singleLine = true,
  6. TextStyle? titleStyle,
  7. TextStyle? textStyle,
  8. TextStyle? hintStyle,
  9. Color? color,
  10. Color? borderColor,
  11. double borderWidth = 1,
  12. double radius = 10.0,
  13. dynamic onChanged,
  14. Color? enabledColor,
  15. Color? focusedColor,
  16. String? labelText,
  17. TextStyle? labelStyle,
  18. bool isUnderline = true,
  19. bool expands = false,
  20. double? width,
  21. double? height,
  22. TextInputType textInputType = TextInputType.text,
  23. Widget? prefixIcon,
  24. Color? backgroundColor,
  25. EdgeInsetsGeometry? padding = EdgeInsets.zero,
  26. EdgeInsetsGeometry? innerPadding,
  27. bool noInputBorder = false,
  28. int flex = 1,
})

Implementation

SmartTextField(
    {Key? key,
    this.text = "",
    required this.hintText,
    required this.controller,
    this.singleLine = true,
    this.titleStyle,
    this.textStyle,
    this.hintStyle,
    this.color,
    this.borderColor,
    this.borderWidth = 1,
    this.radius = 10.0,
    this.onChanged,
    this.enabledColor,
    this.focusedColor,
    this.labelText,
    this.labelStyle,
    this.isUnderline = true,
    this.expands = false,
    this.width,
    this.height,
    this.textInputType = TextInputType.text,
    this.prefixIcon,
    this.backgroundColor,
    this.padding = EdgeInsets.zero,
    this.innerPadding,
    this.noInputBorder = false,
    this.flex = 1})
    : super(key: key) {
  innerPadding ??= EdgeInsets.symmetric(horizontal: 10);
  titleStyle ??= Get.find<AppSettings>().anyMobile
      ? Get.find<AppFonts>().S(fontWeight: FontWeight.w600)
      : Get.find<AppFonts>().M(fontWeight: FontWeight.w600);
  textStyle ??= Get.find<AppFonts>().M();
  labelStyle ??= Get.find<AppFonts>().M();
  hintStyle ??=
      Get.find<AppFonts>().M(color: Get.find<AppColors>().hintColor);
  enabledColor ??= Get.find<AppColors>().textColor;
  focusedColor ??= Colors.cyan;
  if (!noInputBorder) {
    if (isUnderline) {
      enabledBorder = UnderlineInputBorder(
        borderSide: BorderSide(color: enabledColor!),
      );
      focusedBorder = UnderlineInputBorder(
        borderSide: BorderSide(color: focusedColor!),
      );
    } else {
      enabledBorder = OutlineInputBorder(
          borderSide: BorderSide(color: enabledColor!),
          borderRadius: BorderRadius.circular(radius));
      focusedBorder = OutlineInputBorder(
          borderSide: BorderSide(color: focusedColor!),
          borderRadius: BorderRadius.circular(radius));
    }
  }
  border = borderColor != null
      ? Border.all(width: borderWidth, color: borderColor!)
      : null;
}