PasswordField constructor

PasswordField({
  1. Key? key,
  2. String text = "",
  3. required TextEditingController controller,
  4. String hintText = "",
  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. TextStyle? errorStyle,
  14. Color? iconColor,
  15. bool error = false,
  16. String? errorText,
  17. dynamic onChanged,
  18. Color? enabledColor,
  19. Color? focusedColor,
  20. String? labelText,
  21. TextStyle? labelStyle,
  22. bool isUnderline = true,
  23. bool expands = false,
  24. double? width,
  25. double? height,
  26. TextInputType textInputType = TextInputType.text,
  27. Color? bacgroundColor,
  28. EdgeInsetsGeometry? padding = EdgeInsets.zero,
  29. EdgeInsetsGeometry? innerPadding,
  30. bool noInputBorder = false,
  31. int flex = 1,
})

Implementation

PasswordField(
    {Key? key,
    this.text = "",
    required this.controller,
    this.hintText = "",
    this.singleLine = true,
    this.titleStyle,
    this.textStyle,
    this.hintStyle,
    this.color,
    this.borderColor,
    this.borderWidth = 1,
    this.radius = 10.0,
    this.errorStyle,
    this.iconColor,
    this.error = false,
    this.errorText,
    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.bacgroundColor,
    this.padding = EdgeInsets.zero,
    this.innerPadding,
    this.noInputBorder = false,
    this.flex = 1})
    : super(key: key) {
  innerPadding ??= const EdgeInsets.symmetric(horizontal: 10);
  titleStyle ??= Get.find<AppSettings>().anyMobile
      ? Get.find<AppFonts>().S(fontWeight: FontWeight.w600)
      : Get.find<AppFonts>().M(fontWeight: FontWeight.w600);
  iconColor ??= Get.find<AppColors>().iconColor;
  textStyle ??= Get.find<AppFonts>().M();
  labelStyle ??= Get.find<AppFonts>().M();
  errorStyle ??= Get.find<AppFonts>().S(color: Colors.red);
  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;
}