textFieldEmail function
Widget
textFieldEmail(
- dynamic Item,
- Map<String, dynamic> map,
- dynamic pType, {
- dynamic row,
- dynamic minLines = 1,
- dynamic show = false,
})
Implementation
Widget textFieldEmail(Item, Map<String, dynamic> map, pType, {row,minLines=1,show=false}) {
printO("Contains ${Item["key"]} ${map.containsKey(Item["key"])}");
TextEditingController _texteditController=new TextEditingController(text: map[Item["key"]]);
return
Padding(
padding: const EdgeInsets.only(left: 8, right: 8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Flexible(
flex: 1,
fit: FlexFit.loose,
child: Text(Item["label"])),
const SizedBox(height: 5),
TextFormField(
// name: Item["key"],
// initialValue: map.containsKey(Item["key"]) ? map[Item["key"]].toString(): null,
readOnly: show,
keyboardType: TextInputType.emailAddress,
maxLines: 100,
minLines: 1,
controller: _texteditController,
style: ThemeApp!.headline2,
onSaved: (value) {
if (value != null)
map[Item["key"]] = value;
},
decoration: InputDecoration(
hintText: Item['hideLabel'] != null && Item['hideLabel']
? ''
: Item["label"],
hintStyle: ThemeApp!.hintStyle,
border: OutlineInputBorder(
borderSide: BorderSide(color: ThemeApp!.borderColor, width: 1),
borderRadius: BorderRadius.all(Radius.circular(10)))
// ,fillColor: Color(0xfff0f0f5),
),
validator: FormBuilderValidators.compose([
if (Item['validate'] != null &&
Item['validate']['required'] != null &&
Item['validate']['required'])
FormBuilderValidators.required(errorText: Item['validate']['customMessage']??'Field is Required'),
FormBuilderValidators.email(errorText: 'Not Email ')
// FormBuilderValidators.numeric(context, errorText: 'La edad debe ser numérica.'),
// FormBuilderValidators.max(context, 70),
// (val){
// if(val < 0)
// return 'We cannot have a negative age';
// return null;
// }
]),
),
],
),
//)
);
}