inputTextEdit function
Widget
inputTextEdit({
- TextEditingController? controller,
- Color? textColor,
- double fontSize = 15,
- TextInputType keyboardType = TextInputType.text,
- TextInputAction? textInputAction,
- String? placeholderText,
- Color? placeholderTextColor,
- bool isPassword = false,
- bool autofocus = false,
- int maxLines = 1,
- int? maxLength,
- Widget? prefixWidget,
- BoxConstraints? prefixIconConstraints,
- Widget? suffixWidget,
- BoxConstraints? suffixIconConstraints,
- ValueChanged<
String> ? onChanged, - ValueChanged<
String> ? onSubmitted, - Color? backgroundColor,
- FocusNode? focusNode,
- EdgeInsetsGeometry? contentPadding,
- TextAlign textAlign = TextAlign.start,
- InputBorder? enabledBorder,
- InputBorder? focusedBorder,
- GestureTapCallback? onTap,
输入框
Implementation
Widget inputTextEdit({
TextEditingController? controller,
Color? textColor,
double fontSize = 15,
TextInputType keyboardType = TextInputType.text,
TextInputAction? textInputAction,
String? placeholderText,
Color? placeholderTextColor,
bool isPassword = false,
bool autofocus = false,
int maxLines = 1,
int? maxLength,
Widget? prefixWidget,
BoxConstraints? prefixIconConstraints,
Widget? suffixWidget,
BoxConstraints? suffixIconConstraints,
ValueChanged<String>? onChanged,
ValueChanged<String>? onSubmitted,
Color? backgroundColor,
FocusNode? focusNode,
EdgeInsetsGeometry? contentPadding,
TextAlign textAlign = TextAlign.start,
InputBorder? enabledBorder,
InputBorder? focusedBorder,
GestureTapCallback? onTap,
}) {
contentPadding ??= EdgeInsets.symmetric(horizontal: 13.w, vertical: 10.h);
return TextField(
autofocus: autofocus,
controller: controller,
keyboardType: keyboardType,
decoration: InputDecoration(
hintText: placeholderText,
hintStyle: TextStyle(
color: placeholderTextColor ??
(Theme.of(Get.context!).inputDecorationTheme.hintStyle?.color ??
Color(0XFF666666))),
contentPadding: contentPadding,
border: InputBorder.none,
prefixIcon: prefixWidget,
prefixIconConstraints: prefixIconConstraints,
suffixIcon: suffixWidget,
suffixIconConstraints: suffixIconConstraints,
fillColor: backgroundColor,
enabledBorder: enabledBorder,
focusedBorder: focusedBorder,
),
style: TextStyle(
color: textColor,
fontSize: fontSize.sp,
),
textAlign: textAlign,
maxLines: maxLines,
maxLength: maxLength,
autocorrect: false,
// 自动纠正
obscureText: isPassword,
// 隐藏输入内容, 密码框
onChanged: onChanged,
onSubmitted: onSubmitted,
textInputAction: textInputAction,
focusNode: focusNode,
onTap: onTap,
);
}