Skip to content

Commit 04b78d4

Browse files
authored
Merge pull request #36 from webreinvent/feature/Task-7971-InputText-align-width-color
Feature -> Develop | Task 7971 Updated border color, width, text align, label & text color
2 parents 351b304 + 8766085 commit 04b78d4

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

lib/vaahextendflutter/widgets/atoms/input_text.dart

+22-8
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ class InputText extends StatelessWidget {
2727
final int? minLines;
2828
final int? maxLines;
2929
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;
3036
final FocusNode? focusNode;
3137

3238
const InputText({
@@ -51,26 +57,34 @@ class InputText extends StatelessWidget {
5157
this.minLines,
5258
this.maxLines,
5359
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,
5466
this.focusNode,
5567
});
5668

5769
@override
5870
Widget build(BuildContext context) {
5971
return TextFormField(
72+
textAlign: textAlign,
6073
decoration: InputDecoration(
6174
contentPadding: padding,
6275
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),
6478
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),
6681
errorBorder: getInputBorder(inputBorder, AppTheme.colors['danger']!.shade400),
6782
focusedErrorBorder: getInputBorder(inputBorder, AppTheme.colors['danger']!.shade400),
6883
errorStyle: TextStyle(color: AppTheme.colors['danger']!.shade400),
6984
hintText: label,
7085
hintStyle: TextStyle(
7186
fontSize: getFontSize(),
72-
color:
73-
isEnabled ? AppTheme.colors['black']!.shade400 : AppTheme.colors['black']!.shade300,
87+
color: isEnabled ? labelColor : AppTheme.colors['black']!.shade300,
7488
),
7589
prefixIcon: prefixIcon != null
7690
? InkWell(
@@ -118,7 +132,7 @@ class InputText extends StatelessWidget {
118132
onChanged: onChanged,
119133
style: TextStyle(
120134
fontSize: getFontSize(),
121-
color: AppTheme.colors['black']!.shade400,
135+
color: isEnabled ? inputColor : AppTheme.colors['black']!.shade400,
122136
),
123137
enabled: isEnabled,
124138
autovalidateMode: autoValidateMode,
@@ -135,9 +149,9 @@ class InputText extends StatelessWidget {
135149

136150
case InputBorderType.underline:
137151
return UnderlineInputBorder(
138-
borderRadius: BorderRadius.circular(borderRadius),
152+
borderRadius: BorderRadius.zero,
139153
borderSide: BorderSide(
140-
width: 1,
154+
width: borderWidth,
141155
color: color,
142156
),
143157
);
@@ -146,7 +160,7 @@ class InputText extends StatelessWidget {
146160
return OutlineInputBorder(
147161
borderRadius: BorderRadius.circular(borderRadius),
148162
borderSide: BorderSide(
149-
width: 1,
163+
width: borderWidth,
150164
color: color,
151165
),
152166
);

0 commit comments

Comments
 (0)