|
|
|
@ -39,7 +39,8 @@ class NumberTextInputFormatter extends TextInputFormatter {
|
|
|
|
final _mobileFormatter = NumberTextInputFormatter();
|
|
|
|
final _mobileFormatter = NumberTextInputFormatter();
|
|
|
|
|
|
|
|
|
|
|
|
class TextFields extends StatefulWidget {
|
|
|
|
class TextFields extends StatefulWidget {
|
|
|
|
TextFields({Key key,
|
|
|
|
TextFields({
|
|
|
|
|
|
|
|
Key key,
|
|
|
|
this.type,
|
|
|
|
this.type,
|
|
|
|
this.hintText,
|
|
|
|
this.hintText,
|
|
|
|
this.suffixIcon,
|
|
|
|
this.suffixIcon,
|
|
|
|
@ -76,8 +77,9 @@ class TextFields extends StatefulWidget {
|
|
|
|
this.borderWidth = 1.5,
|
|
|
|
this.borderWidth = 1.5,
|
|
|
|
this.fieldTextColor,
|
|
|
|
this.fieldTextColor,
|
|
|
|
this.textAlign = TextAlign.start,
|
|
|
|
this.textAlign = TextAlign.start,
|
|
|
|
this.borderRadius})
|
|
|
|
this.borderRadius,
|
|
|
|
: super(key: key);
|
|
|
|
this.obscureText,
|
|
|
|
|
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
|
|
final String hintText;
|
|
|
|
final String hintText;
|
|
|
|
final String initialValue;
|
|
|
|
final String initialValue;
|
|
|
|
@ -116,6 +118,7 @@ class TextFields extends StatefulWidget {
|
|
|
|
final double borderWidth;
|
|
|
|
final double borderWidth;
|
|
|
|
final Color fieldTextColor;
|
|
|
|
final Color fieldTextColor;
|
|
|
|
final TextAlign textAlign;
|
|
|
|
final TextAlign textAlign;
|
|
|
|
|
|
|
|
final bool obscureText;
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
_TextFieldsState createState() => _TextFieldsState();
|
|
|
|
_TextFieldsState createState() => _TextFieldsState();
|
|
|
|
@ -162,9 +165,7 @@ class _TextFieldsState extends State<TextFields> {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
child: Icon(EvaIcons.eye,
|
|
|
|
child: Icon(EvaIcons.eye,
|
|
|
|
size: 24.0, color: Theme
|
|
|
|
size: 24.0, color: Theme.of(context).primaryColor))
|
|
|
|
.of(context)
|
|
|
|
|
|
|
|
.primaryColor))
|
|
|
|
|
|
|
|
: InkWell(
|
|
|
|
: InkWell(
|
|
|
|
onTap: () {
|
|
|
|
onTap: () {
|
|
|
|
this.setState(() {
|
|
|
|
this.setState(() {
|
|
|
|
@ -218,9 +219,7 @@ class _TextFieldsState extends State<TextFields> {
|
|
|
|
blurRadius: focus ? 34.0 : 12.0)
|
|
|
|
blurRadius: focus ? 34.0 : 12.0)
|
|
|
|
]),
|
|
|
|
]),
|
|
|
|
child: TextFormField(
|
|
|
|
child: TextFormField(
|
|
|
|
keyboardAppearance: Theme
|
|
|
|
keyboardAppearance: Theme.of(context).brightness,
|
|
|
|
.of(context)
|
|
|
|
|
|
|
|
.brightness,
|
|
|
|
|
|
|
|
scrollPhysics: BouncingScrollPhysics(),
|
|
|
|
scrollPhysics: BouncingScrollPhysics(),
|
|
|
|
autovalidate: widget.autoValidate,
|
|
|
|
autovalidate: widget.autoValidate,
|
|
|
|
onTap: widget.onTap,
|
|
|
|
onTap: widget.onTap,
|
|
|
|
@ -248,11 +247,7 @@ class _TextFieldsState extends State<TextFields> {
|
|
|
|
autofocus: widget.autoFocus ?? false,
|
|
|
|
autofocus: widget.autoFocus ?? false,
|
|
|
|
validator: widget.validator,
|
|
|
|
validator: widget.validator,
|
|
|
|
onSaved: widget.onSaved,
|
|
|
|
onSaved: widget.onSaved,
|
|
|
|
style: Theme
|
|
|
|
style: Theme.of(context).textTheme.body2.copyWith(
|
|
|
|
.of(context)
|
|
|
|
|
|
|
|
.textTheme
|
|
|
|
|
|
|
|
.body2
|
|
|
|
|
|
|
|
.copyWith(
|
|
|
|
|
|
|
|
fontSize: widget.fontSize,
|
|
|
|
fontSize: widget.fontSize,
|
|
|
|
fontWeight: widget.fontWeight,
|
|
|
|
fontWeight: widget.fontWeight,
|
|
|
|
color: widget.color),
|
|
|
|
color: widget.color),
|
|
|
|
@ -268,9 +263,7 @@ class _TextFieldsState extends State<TextFields> {
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
fontSize: widget.fontSize,
|
|
|
|
fontSize: widget.fontSize,
|
|
|
|
fontWeight: widget.fontWeight,
|
|
|
|
fontWeight: widget.fontWeight,
|
|
|
|
color: Theme
|
|
|
|
color: Theme.of(context).hintColor),
|
|
|
|
.of(context)
|
|
|
|
|
|
|
|
.hintColor),
|
|
|
|
|
|
|
|
contentPadding: widget.padding != null
|
|
|
|
contentPadding: widget.padding != null
|
|
|
|
? widget.padding
|
|
|
|
? widget.padding
|
|
|
|
: EdgeInsets.symmetric(
|
|
|
|
: EdgeInsets.symmetric(
|
|
|
|
@ -281,9 +274,7 @@ class _TextFieldsState extends State<TextFields> {
|
|
|
|
? Colors.transparent
|
|
|
|
? Colors.transparent
|
|
|
|
: widget.fieldTextColor != null
|
|
|
|
: widget.fieldTextColor != null
|
|
|
|
? widget.fieldTextColor
|
|
|
|
? widget.fieldTextColor
|
|
|
|
: Theme
|
|
|
|
: Theme.of(context).backgroundColor,
|
|
|
|
.of(context)
|
|
|
|
|
|
|
|
.backgroundColor,
|
|
|
|
|
|
|
|
suffixIcon: _buildSuffixIcon(),
|
|
|
|
suffixIcon: _buildSuffixIcon(),
|
|
|
|
prefixIcon: widget.type != "search"
|
|
|
|
prefixIcon: widget.type != "search"
|
|
|
|
? widget.prefixIcon != null
|
|
|
|
? widget.prefixIcon != null
|
|
|
|
@ -304,8 +295,7 @@ class _TextFieldsState extends State<TextFields> {
|
|
|
|
height: widget.borderOnlyError ? 0.0 : null),
|
|
|
|
height: widget.borderOnlyError ? 0.0 : null),
|
|
|
|
errorBorder: OutlineInputBorder(
|
|
|
|
errorBorder: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(
|
|
|
|
borderSide: BorderSide(
|
|
|
|
color: Theme
|
|
|
|
color: Theme.of(context)
|
|
|
|
.of(context)
|
|
|
|
|
|
|
|
.errorColor
|
|
|
|
.errorColor
|
|
|
|
.withOpacity(widget.bare ? 0.0 : 0.5),
|
|
|
|
.withOpacity(widget.bare ? 0.0 : 0.5),
|
|
|
|
width: widget.borderWidth),
|
|
|
|
width: widget.borderWidth),
|
|
|
|
@ -316,8 +306,7 @@ class _TextFieldsState extends State<TextFields> {
|
|
|
|
: BorderRadius.circular(widget.borderRadiusValue)),
|
|
|
|
: BorderRadius.circular(widget.borderRadiusValue)),
|
|
|
|
focusedErrorBorder: OutlineInputBorder(
|
|
|
|
focusedErrorBorder: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(
|
|
|
|
borderSide: BorderSide(
|
|
|
|
color: Theme
|
|
|
|
color: Theme.of(context)
|
|
|
|
.of(context)
|
|
|
|
|
|
|
|
.errorColor
|
|
|
|
.errorColor
|
|
|
|
.withOpacity(widget.bare ? 0.0 : 0.5),
|
|
|
|
.withOpacity(widget.bare ? 0.0 : 0.5),
|
|
|
|
width: widget.borderWidth),
|
|
|
|
width: widget.borderWidth),
|
|
|
|
@ -328,8 +317,7 @@ class _TextFieldsState extends State<TextFields> {
|
|
|
|
: BorderRadius.circular(widget.borderRadiusValue)),
|
|
|
|
: BorderRadius.circular(widget.borderRadiusValue)),
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(
|
|
|
|
borderSide: BorderSide(
|
|
|
|
color: Theme
|
|
|
|
color: Theme.of(context)
|
|
|
|
.of(context)
|
|
|
|
|
|
|
|
.dividerColor
|
|
|
|
.dividerColor
|
|
|
|
.withOpacity(widget.bare ? 0.0 : 1.0),
|
|
|
|
.withOpacity(widget.bare ? 0.0 : 1.0),
|
|
|
|
width: widget.borderWidth),
|
|
|
|
width: widget.borderWidth),
|
|
|
|
@ -339,18 +327,10 @@ class _TextFieldsState extends State<TextFields> {
|
|
|
|
? widget.borderRadius
|
|
|
|
? widget.borderRadius
|
|
|
|
: BorderRadius.circular(widget.borderRadiusValue)),
|
|
|
|
: BorderRadius.circular(widget.borderRadiusValue)),
|
|
|
|
disabledBorder:
|
|
|
|
disabledBorder:
|
|
|
|
OutlineInputBorder(borderSide: BorderSide(color: Theme
|
|
|
|
OutlineInputBorder(borderSide: BorderSide(color: Theme.of(context).dividerColor.withOpacity(widget.bare ? 0.0 : 1.0), width: widget.borderWidth), borderRadius: widget.bare ? BorderRadius.circular(0.0) : widget.borderRadius != null ? widget.borderRadius : BorderRadius.circular(widget.borderRadiusValue)),
|
|
|
|
.of(context)
|
|
|
|
|
|
|
|
.dividerColor
|
|
|
|
|
|
|
|
.withOpacity(widget.bare ? 0.0 : 1.0),
|
|
|
|
|
|
|
|
width: widget.borderWidth),
|
|
|
|
|
|
|
|
borderRadius: widget.bare ? BorderRadius.circular(0.0) : widget
|
|
|
|
|
|
|
|
.borderRadius != null ? widget.borderRadius : BorderRadius
|
|
|
|
|
|
|
|
.circular(widget.borderRadiusValue)),
|
|
|
|
|
|
|
|
enabledBorder: OutlineInputBorder(
|
|
|
|
enabledBorder: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(
|
|
|
|
borderSide: BorderSide(
|
|
|
|
color: Theme
|
|
|
|
color: Theme.of(context)
|
|
|
|
.of(context)
|
|
|
|
|
|
|
|
.dividerColor
|
|
|
|
.dividerColor
|
|
|
|
.withOpacity(widget.bare ? 0.0 : 1.0),
|
|
|
|
.withOpacity(widget.bare ? 0.0 : 1.0),
|
|
|
|
width: widget.borderWidth),
|
|
|
|
width: widget.borderWidth),
|
|
|
|
|