Last active
December 4, 2023 14:30
-
-
Save flutter-devs/b164e1e459c39e1e88bb69a1e40de346 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:event_hire/utils/styles.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter/services.dart'; | |
class CustomTextField extends StatelessWidget { | |
final String hint; | |
final TextEditingController textEditingController; | |
final TextInputType keyboardType; | |
final errorText; | |
final bool obscureText; | |
final TextCapitalization textCapitalization; | |
final FormFieldValidator<String> validator; | |
final List<TextInputFormatter> inputFormatters; | |
final int maxLength; | |
final int maxLines; | |
final TextStyle hintStyle; | |
CustomTextField( | |
{this.textEditingController, | |
this.hint, | |
this.keyboardType = TextInputType.text, | |
this.errorText = 'Please enter some text', | |
this.textCapitalization = TextCapitalization.none, | |
this.validator, | |
this.obscureText = false, | |
this.inputFormatters, | |
this.maxLength, | |
this.maxLines, this.hintStyle}); | |
@override | |
Widget build(BuildContext context) { | |
return Column( | |
children: <Widget>[ | |
TextFormField( | |
controller: textEditingController, | |
autovalidate: false, | |
maxLength: maxLength, | |
maxLines: maxLines, | |
textCapitalization: TextCapitalization.words, | |
maxLengthEnforced: false, | |
keyboardType: keyboardType, | |
inputFormatters: inputFormatters, | |
obscureText: obscureText, | |
validator: validator ?? | |
(value) { | |
if (value.isEmpty) { | |
return errorText; | |
} | |
}, | |
decoration: InputDecoration( | |
fillColor: Styles.whiteColor, | |
filled: true, | |
hintText: hint,hintStyle: hintStyle, | |
border: OutlineInputBorder( | |
borderRadius: BorderRadius.circular(10), | |
borderSide: BorderSide(color: Colors.grey, width: 0.0)), | |
), | |
), | |
SizedBox( | |
height: 25, | |
) | |
], | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Issue: analyze: unsupported import package:event_hire/utils/styles.dart