Skip to content

Commit ff155ef

Browse files
authored
Merge pull request #39 from webreinvent/revert-30-feature/Task-7797-update-button-text-with-icon
Revert "Feature->Develop | Task 7797 update button text with icon"
2 parents 35dd72a + 383cf83 commit ff155ef

File tree

3 files changed

+21
-41
lines changed

3 files changed

+21
-41
lines changed

lib/vaahextendflutter/widgets/atoms/buttons.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ class ButtonText extends StatelessWidget {
297297
class ButtonTextWithIcon extends StatelessWidget {
298298
final OnPressed onPressed;
299299
final String text;
300-
final Widget leading;
300+
final IconData? iconData;
301301
final ButtonStyle? style;
302302
final ButtonType? buttonType;
303303
final Color? foregroundColor;
@@ -310,7 +310,7 @@ class ButtonTextWithIcon extends StatelessWidget {
310310
Key? key,
311311
required this.onPressed,
312312
required this.text,
313-
required this.leading,
313+
required this.iconData,
314314
this.style,
315315
this.buttonType,
316316
this.foregroundColor,
@@ -341,7 +341,10 @@ class ButtonTextWithIcon extends StatelessWidget {
341341
fontSize: fontSize,
342342
),
343343
),
344-
icon: leading,
344+
icon: FaIcon(
345+
iconData,
346+
size: iconSize,
347+
),
345348
);
346349
}
347350
}

lib/vaahextendflutter/widgets/atoms/input_text.dart

Lines changed: 14 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ class InputText extends StatelessWidget {
2626
final Function()? suffixOnTap;
2727
final int? minLines;
2828
final int? maxLines;
29-
final InputBorderType inputBorder;
3029

3130
const InputText({
3231
super.key,
@@ -49,20 +48,19 @@ class InputText extends StatelessWidget {
4948
this.suffixOnTap,
5049
this.minLines,
5150
this.maxLines,
52-
this.inputBorder = InputBorderType.outline,
5351
});
5452

5553
@override
5654
Widget build(BuildContext context) {
5755
return TextFormField(
5856
decoration: InputDecoration(
5957
contentPadding: padding,
60-
border: getInputBorder(inputBorder, AppTheme.colors['black']!.shade400),
61-
enabledBorder: getInputBorder(inputBorder, AppTheme.colors['black']!.shade400),
62-
disabledBorder: getInputBorder(inputBorder, AppTheme.colors['black']!.shade400),
63-
focusedBorder: getInputBorder(inputBorder, AppTheme.colors['black']!.shade400),
64-
errorBorder: getInputBorder(inputBorder, AppTheme.colors['black']!.shade400),
65-
focusedErrorBorder: getInputBorder(inputBorder, AppTheme.colors['black']!.shade400),
58+
border: border(AppTheme.colors['black']!.shade400),
59+
enabledBorder: border(AppTheme.colors['black']!.shade400),
60+
disabledBorder: border(AppTheme.colors['black']!.shade300),
61+
focusedBorder: border(AppTheme.colors['black']!.shade400),
62+
errorBorder: border(AppTheme.colors['danger']!.shade400),
63+
focusedErrorBorder: border(AppTheme.colors['danger']!.shade400),
6664
errorStyle: TextStyle(color: AppTheme.colors['danger']!.shade400),
6765
hintText: label,
6866
hintStyle: TextStyle(
@@ -125,29 +123,14 @@ class InputText extends StatelessWidget {
125123
);
126124
}
127125

128-
InputBorder getInputBorder(InputBorderType inputBorderType, Color color) {
129-
switch (inputBorderType) {
130-
case InputBorderType.none:
131-
return InputBorder.none;
132-
133-
case InputBorderType.underline:
134-
return UnderlineInputBorder(
135-
borderRadius: BorderRadius.circular(borderRadius),
136-
borderSide: BorderSide(
137-
width: 1,
138-
color: color,
139-
),
140-
);
141-
142-
case InputBorderType.outline:
143-
return OutlineInputBorder(
144-
borderRadius: BorderRadius.circular(borderRadius),
145-
borderSide: BorderSide(
146-
width: 1,
147-
color: color,
148-
),
149-
);
150-
}
126+
OutlineInputBorder border(Color color) {
127+
return OutlineInputBorder(
128+
borderRadius: BorderRadius.circular(borderRadius),
129+
borderSide: BorderSide(
130+
width: 1,
131+
color: color,
132+
),
133+
);
151134
}
152135

153136
double getFontSize() {
@@ -165,9 +148,3 @@ class InputText extends StatelessWidget {
165148
}
166149
}
167150
}
168-
169-
enum InputBorderType {
170-
underline,
171-
outline,
172-
none,
173-
}

lib/views/pages/ui/components/buttons/icon_and_label.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class ButtonIconLabelPreview extends StatelessWidget {
3434
ButtonTextWithIcon(
3535
onPressed: () {},
3636
text: "Icon Button",
37-
leading: const Icon(FontAwesomeIcons.user),
37+
iconData: FontAwesomeIcons.user,
3838
),
3939
],
4040
),

0 commit comments

Comments
 (0)