Skip to content

Commit

Permalink
Force a color for Price buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
g123k committed Jan 5, 2025
1 parent 1f861d1 commit 0d27f7e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions packages/smooth_app/lib/pages/prices/price_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,31 @@ class PriceButton extends StatelessWidget {
Widget build(BuildContext context) {
final Widget widget;

ButtonStyle? buttonStyleOverride;
if (buttonStyle != null && buttonStyle!.foregroundColor != null) {
buttonStyleOverride = buttonStyle!.copyWith(
iconColor: buttonStyle!.foregroundColor,
);
}

if (iconData == null) {
widget = ElevatedButton(
onPressed: onPressed,
style: buttonStyle,
style: buttonStyleOverride ?? buttonStyle,
child: Text(title!),
);
} else if (title == null) {
widget = ElevatedButton(
onPressed: onPressed,
style: buttonStyle,
style: buttonStyleOverride ?? buttonStyle,
child: Icon(iconData),
);
} else {
widget = ElevatedButton.icon(
onPressed: onPressed,
icon: Icon(iconData),
label: Text(title!),
style: buttonStyle,
style: buttonStyleOverride ?? buttonStyle,
);
}

Expand Down

0 comments on commit 0d27f7e

Please sign in to comment.