t static method

Widget t({
  1. FormFieldValidator<String>? validator,
  2. AutovalidateMode? autovalidateMode,
  3. String? error_text = "Missed",
  4. String? hint_text,
  5. Color? text_color,
  6. double? fontSize,
  7. Color? hint_color,
  8. bool isRemoveUnderline = false,
  9. bool? isShowBoarder,
  10. Color? background_color,
  11. Decoration? decoration,
  12. EdgeInsets? padding,
  13. EdgeInsets? margin,
  14. TextEditingController? controller,
  15. ValueChanged<String>? onChanged,
  16. TextInputType? keyboardType,
  17. bool obscureText = false,
  18. double? width,
  19. int? maxLength,
  20. int? maxLines,
  21. int? minLines,
  22. TextAlign? textAlign,
  23. FocusNode? focusNode,
  24. 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;
}