@@ -27,6 +27,12 @@ class InputText extends StatelessWidget {
27
27
final int ? minLines;
28
28
final int ? maxLines;
29
29
final InputBorderType inputBorder;
30
+ final TextAlign textAlign;
31
+ final double borderWidth;
32
+ final Color ? focusedBorderColor;
33
+ final Color ? inputColor;
34
+ final Color ? labelColor;
35
+ final Color ? enabledBorderColor;
30
36
final FocusNode ? focusNode;
31
37
32
38
const InputText ({
@@ -51,26 +57,34 @@ class InputText extends StatelessWidget {
51
57
this .minLines,
52
58
this .maxLines,
53
59
this .inputBorder = InputBorderType .outline,
60
+ this .textAlign = TextAlign .start,
61
+ this .borderWidth = 1 ,
62
+ this .focusedBorderColor,
63
+ this .inputColor,
64
+ this .labelColor,
65
+ this .enabledBorderColor,
54
66
this .focusNode,
55
67
});
56
68
57
69
@override
58
70
Widget build (BuildContext context) {
59
71
return TextFormField (
72
+ textAlign: textAlign,
60
73
decoration: InputDecoration (
61
74
contentPadding: padding,
62
75
border: getInputBorder (inputBorder, AppTheme .colors['black' ]! .shade400),
63
- enabledBorder: getInputBorder (inputBorder, AppTheme .colors['black' ]! .shade400),
76
+ enabledBorder:
77
+ getInputBorder (inputBorder, enabledBorderColor ?? AppTheme .colors['black' ]! .shade400),
64
78
disabledBorder: getInputBorder (inputBorder, AppTheme .colors['black' ]! .shade300),
65
- focusedBorder: getInputBorder (inputBorder, AppTheme .colors['black' ]! .shade400),
79
+ focusedBorder:
80
+ getInputBorder (inputBorder, focusedBorderColor ?? AppTheme .colors['black' ]! .shade400),
66
81
errorBorder: getInputBorder (inputBorder, AppTheme .colors['danger' ]! .shade400),
67
82
focusedErrorBorder: getInputBorder (inputBorder, AppTheme .colors['danger' ]! .shade400),
68
83
errorStyle: TextStyle (color: AppTheme .colors['danger' ]! .shade400),
69
84
hintText: label,
70
85
hintStyle: TextStyle (
71
86
fontSize: getFontSize (),
72
- color:
73
- isEnabled ? AppTheme .colors['black' ]! .shade400 : AppTheme .colors['black' ]! .shade300,
87
+ color: isEnabled ? labelColor : AppTheme .colors['black' ]! .shade300,
74
88
),
75
89
prefixIcon: prefixIcon != null
76
90
? InkWell (
@@ -118,7 +132,7 @@ class InputText extends StatelessWidget {
118
132
onChanged: onChanged,
119
133
style: TextStyle (
120
134
fontSize: getFontSize (),
121
- color: AppTheme .colors['black' ]! .shade400,
135
+ color: isEnabled ? inputColor : AppTheme .colors['black' ]! .shade400,
122
136
),
123
137
enabled: isEnabled,
124
138
autovalidateMode: autoValidateMode,
@@ -135,9 +149,9 @@ class InputText extends StatelessWidget {
135
149
136
150
case InputBorderType .underline:
137
151
return UnderlineInputBorder (
138
- borderRadius: BorderRadius .circular (borderRadius) ,
152
+ borderRadius: BorderRadius .zero ,
139
153
borderSide: BorderSide (
140
- width: 1 ,
154
+ width: borderWidth ,
141
155
color: color,
142
156
),
143
157
);
@@ -146,7 +160,7 @@ class InputText extends StatelessWidget {
146
160
return OutlineInputBorder (
147
161
borderRadius: BorderRadius .circular (borderRadius),
148
162
borderSide: BorderSide (
149
- width: 1 ,
163
+ width: borderWidth ,
150
164
color: color,
151
165
),
152
166
);
0 commit comments