inputFieldWidgetWithLabel static method
Widget
inputFieldWidgetWithLabel(
- BuildContext context,
- String keyName,
- String labelName,
- String hintText,
- Function onValidate,
- Function onSaved, {
- String initialValue = "",
- dynamic obscureText = false,
- double labelFontSize = 20,
- bool labelBold = true,
- double fontSize = 18,
- double hintFontSize = 15,
- double paddingLeft = 20,
- double paddingRight = 20,
- double paddingTop = 0,
- double paddingBottom = 0,
- Widget? suffixIcon,
- Icon? prefixIcon,
- double borderRadius = 30,
- Color borderColor = Colors.redAccent,
- Color borderFocusColor = Colors.redAccent,
- double borderWidth = 2,
- double focusedBorderWidth = 2,
- double enabledBorderWidth = 1,
- bool showPrefixIcon = false,
- Color prefixIconColor = Colors.redAccent,
- double prefixIconPaddingLeft = 30,
- double prefixIconPaddingRight = 10,
- double prefixIconPaddingTop = 0,
- double prefixIconPaddingBottom = 0,
- double containerHeight = 60,
- double containerWidth = 0,
- bool isMultiline = false,
- Function? onChange,
- Color textColor = Colors.black,
- Color hintColor = Colors.black,
- Color validationColor = Colors.redAccent,
- double contentPadding = 6,
- int multilineRows = 4,
- bool isNumeric = false,
- Color backgroundColor = Colors.transparent,
- Color borderErrorColor = Colors.redAccent,
- Color borderFocusedErrorColor = Colors.redAccent,
- double errorBorderWidth = 2,
- double focusedErrorBorderWidth = 2,
- bool isReadonly = false,
- Color labelFontColor = Colors.black,
Implementation
static Widget inputFieldWidgetWithLabel(
BuildContext context,
String keyName,
String labelName,
String hintText,
Function onValidate,
Function onSaved, {
String initialValue = "",
obscureText: false,
double labelFontSize: 20,
bool labelBold = true,
double fontSize = 18,
double hintFontSize = 15,
double paddingLeft = 20,
double paddingRight = 20,
double paddingTop = 0,
double paddingBottom = 0,
Widget? suffixIcon,
Icon? prefixIcon,
double borderRadius = 30,
Color borderColor = Colors.redAccent,
Color borderFocusColor = Colors.redAccent,
double borderWidth = 2,
double focusedBorderWidth = 2,
double enabledBorderWidth = 1,
bool showPrefixIcon = false,
Color prefixIconColor = Colors.redAccent,
double prefixIconPaddingLeft = 30,
double prefixIconPaddingRight = 10,
double prefixIconPaddingTop = 0,
double prefixIconPaddingBottom = 0,
double containerHeight = 60,
double containerWidth = 0,
bool isMultiline = false,
Function? onChange,
Color textColor = Colors.black,
Color hintColor = Colors.black,
Color validationColor = Colors.redAccent,
double contentPadding = 6,
int multilineRows = 4,
bool isNumeric = false,
Color backgroundColor = Colors.transparent,
Color borderErrorColor = Colors.redAccent,
Color borderFocusedErrorColor = Colors.redAccent,
double errorBorderWidth = 2,
double focusedErrorBorderWidth = 2,
bool isReadonly = false,
Color labelFontColor = Colors.black,
}) {
return Container(
padding: EdgeInsets.only(left: 0, right: 0),
child: Column(
children: <Widget>[
new Padding(
padding: EdgeInsets.only(
left: 0,
right: 0,
top: 10,
bottom: 10,
),
child: Align(
alignment: Alignment.topLeft,
child: Text(
labelName,
textAlign: TextAlign.left,
style: TextStyle(
fontSize: labelFontSize,
fontWeight: labelBold ? FontWeight.bold : null,
color: labelFontColor,
),
),
),
),
inputFieldWidget(
context,
keyName,
hintText,
onValidate,
onSaved,
initialValue: initialValue,
obscureText: obscureText,
fontSize: fontSize,
hintFontSize: hintFontSize,
paddingLeft: paddingLeft,
paddingRight: paddingRight,
paddingTop: paddingTop,
paddingBottom: paddingBottom,
prefixIcon: prefixIcon,
suffixIcon: suffixIcon,
borderRadius: borderRadius,
borderColor: borderColor,
borderFocusColor: borderFocusColor,
borderWidth: borderWidth,
enabledBorderWidth: enabledBorderWidth,
focusedBorderWidth: focusedBorderWidth,
showPrefixIcon: showPrefixIcon,
prefixIconColor: prefixIconColor,
prefixIconPaddingLeft: prefixIconPaddingLeft,
prefixIconPaddingRight: prefixIconPaddingRight,
prefixIconPaddingTop: prefixIconPaddingTop,
prefixIconPaddingBottom: prefixIconPaddingBottom,
onChange: onChange,
isMultiline: isMultiline,
textColor: textColor,
hintColor: hintColor,
validationColor: validationColor,
multilineRows: multilineRows,
contentPadding: contentPadding,
isNumeric: isNumeric,
backgroundColor: backgroundColor,
borderErrorColor: borderErrorColor,
borderFocusedErrorColor: borderFocusedErrorColor,
errorBorderWidth: errorBorderWidth,
focusedErrorBorderWidth: focusedErrorBorderWidth,
isReadonly: isReadonly,
),
],
),
);
}