PasswordField constructor
PasswordField({
- Key? key,
- String text = "",
- required TextEditingController controller,
- String hintText = "",
- bool singleLine = true,
- TextStyle? titleStyle,
- TextStyle? textStyle,
- TextStyle? hintStyle,
- Color? color,
- Color? borderColor,
- double borderWidth = 1,
- double radius = 10.0,
- TextStyle? errorStyle,
- Color? iconColor,
- bool error = false,
- String? errorText,
- dynamic onChanged,
- Color? enabledColor,
- Color? focusedColor,
- String? labelText,
- TextStyle? labelStyle,
- bool isUnderline = true,
- bool expands = false,
- double? width,
- double? height,
- TextInputType textInputType = TextInputType.text,
- Color? bacgroundColor,
- EdgeInsetsGeometry? padding = EdgeInsets.zero,
- EdgeInsetsGeometry? innerPadding,
- bool noInputBorder = false,
- 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;
}