t static method
Widget
t({
- FormFieldValidator<
String> ? validator, - AutovalidateMode? autovalidateMode,
- String? error_text = "Missed",
- String? hint_text,
- Color? text_color,
- double? fontSize,
- Color? hint_color,
- bool isRemoveUnderline = false,
- bool? isShowBoarder,
- Color? background_color,
- Decoration? decoration,
- EdgeInsets? padding,
- EdgeInsets? margin,
- TextEditingController? controller,
- ValueChanged<
String> ? onChanged, - TextInputType? keyboardType,
- bool obscureText = false,
- double? width,
- int? maxLength,
- int? maxLines,
- int? minLines,
- TextAlign? textAlign,
- FocusNode? focusNode,
- Widget? prefixIcon,
Implementation
static Widget t(
{
// validate
FormFieldValidator<String>? validator,
AutovalidateMode? autovalidateMode,
String? error_text = "Missed",
//text and hint
String? hint_text,
Color? text_color,
double? fontSize,
Color? hint_color,
//boarder and underline
bool isRemoveUnderline = false,
bool? isShowBoarder,
//background
Color? background_color,
Decoration? decoration, //at the Container
//spaces
EdgeInsets? padding,
EdgeInsets? margin,
//controller
TextEditingController? controller,
ValueChanged<String>? onChanged,
//input content type
TextInputType? keyboardType,
bool obscureText = false,
//size and max/min
double? width,
int? maxLength,
int? maxLines,
int? minLines,
//other
TextAlign? textAlign ,
FocusNode? focusNode,
Widget? prefixIcon //example "icon" left of textField
}) {
//padding default
padding ??= EdgeInsets.zero;
//hint color
hint_color ??= DSColor.ds_textfield_hint;
//text color
text_color ??= DSColor.ds_textfield_text;
//text size
fontSize ??= DSDimen.text_level_2;
//align
textAlign ??= TextAlign.start;
//password
bool isPass = keyboardType != null && keyboardType == TextInputType.visiblePassword;
if( isPass) {
obscureText = true;
}
//get tf
TextFormField tf = _getTextFourmField(obscureText, autovalidateMode, error_text,
validator, text_color, fontSize, hint_color, isShowBoarder,
padding, hint_text, keyboardType, controller, onChanged,
textAlign , maxLength, focusNode, maxLines , minLines,
isRemoveUnderline, prefixIcon);
//fix textfield not materail
var materialApp = Material(
child: tf,
color: background_color,
);
//ct
var ct = TextFieldTemplateBase.getContainer( materialApp, width, margin, decoration);
return ct;
}