xSch_TextFormField_Builder<T> method
Widget
xSch_TextFormField_Builder<T>({
- required BuildContext context,
- required XCol xCol,
- dynamic onChanged()?,
- dynamic onSubmitted()?,
- String? hintText,
- List<
TextInputFormatter> ? inputFormatters, - TextInputType? keyboardType,
- bool editable = true,
- bool label_Visible = true,
- bool autoFocus = false,
- String? value,
- bool? selectText,
- bool? multiLines,
- double? height,
- int? maxLines,
- Color? borderColor,
- Color? borderColor_Disabled,
- Color? labelColor_Disabled,
- Color? backgorundColor,
- Color? backgorundColor_Disabled,
- TextEditingController? controller,
- dynamic onBefore_Edit()?,
Implementation
Widget xSch_TextFormField_Builder<T>({
required BuildContext context,
required XCol xCol,
Function(String)? onChanged,
Function(String)? onSubmitted,
String? hintText,
List<TextInputFormatter>? inputFormatters,
TextInputType? keyboardType,
bool editable = true,
bool label_Visible = true,
bool autoFocus = false,
String? value,
bool? selectText,
bool? multiLines,
double? height,
int? maxLines,
Color? borderColor,
Color? borderColor_Disabled,
Color? labelColor_Disabled,
Color? backgorundColor,
Color? backgorundColor_Disabled,
TextEditingController? controller,
Function()? onBefore_Edit,
}) {
return XTextFormField(
controller: value != null ? null : controller,
border: OutlineInputBorder(borderSide: BorderSide(color: editable.not() ? (borderColor ?? Colors.grey[600]!) : (borderColor_Disabled ?? Colors.grey[700]!), width: 1)),
disabledBorder: OutlineInputBorder(borderSide: BorderSide(color: editable.not() ? (borderColor ?? Colors.grey[600]!) : (borderColor_Disabled ?? Colors.grey[700]!), width: 1)),
enabledBorder: OutlineInputBorder(borderSide: BorderSide(color: editable.not() ? (borderColor ?? Colors.grey[600]!) : (borderColor_Disabled ?? Colors.grey[700]!), width: 1)),
label: label_Visible ? (xCol.colCaption + (xCol.format == "C" ? " €" : "")) : "",
onChanged: onChanged,
onFieldSubmitted: (value) {
onSubmitted == null ? null : onSubmitted(value!);
},
autoFocus: autoFocus,
onTap: () {
if (controller != null) {
if (xCol.dataType == String) {
} else {
controller.selection = TextSelection(baseOffset: 0, extentOffset: controller.text.length);
}
}
onBefore_Edit!();
},
initialValue: controller != null ? null : value,
// borderVisible: editable.not(),
maxLines: maxLines,
isCollapsed: false,
enabled: editable.not(),
height: null,
fillColor: editable ? Colors.transparent : XSchedaState.color_CellBackGorundDisabled,
filled: XSchedaState.color_CellBackGorundDisabled != null ? true : false,
multiLines: (xCol.colCaption.toLowerCase().contains("email") || (xCol.colKey.contains("sconti") || xCol.colKey.contains("sconto")) || xCol.colCaption.toLowerCase().contains("inidrizzo") || xCol.colCaption.toLowerCase().contains("ind"))
? false
: ((xCol.colCaption.toLowerCase().contains("cell")) || (xCol.colCaption.toLowerCase().contains("tel")))
? false
: multiLines ?? false,
contentPadding: EdgeInsets.only(top: 7, left: 5, bottom: 7),
textStyle: XStyles.xStyleText(colorText: XSchedaState.color_Text),
textAlign: TextAlign.left,
labelStyle: XStyles.xStyTextForLabel(editable.not() ? (XSchedaState.color_LabelText) : (labelColor_Disabled ?? borderColor_Disabled ?? Colors.grey[700]!)), //XSchedaState.colorOfHintText
keyboardType: keyboardType ??
((xCol.colCaption.toLowerCase().contains("email"))
? TextInputType.emailAddress
: ((xCol.colCaption.toLowerCase().contains("cell")) || (xCol.colCaption.toLowerCase().contains("tel")))
? TextInputType.phone
: (xCol.colKey.contains("sconti") || xCol.colKey.contains("sconto"))
? TextInputType.number
: TextInputType.text),
textCapitalization: (xCol.dataType == String && xCol.colKey.startsWith("li").not())
? TextCapitalization.sentences //
: TextCapitalization.none,
hintText: editable ? "..." : (hintText ?? "inserisci.."),
inputFormatters: inputFormatters ?? [],
);
}