-
I've tried several widgets from forui and it feels great. But i find it hard when I try to add a style to a button. I.e i want to just add a custom color but the class seems to have to define all the other things. Do you mind sharing the example? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Just to clarify, do you want to extend a For the latter, it depends on the specific part of the button you want to customize. For example, to customize a outline button's background color based on an existing style: final buttonStyle = FButtonStyles.inherit(
colorScheme: context.theme.colorScheme,
typography: context.theme.typography,
style: context.theme.style,
).outline.copyWith(
enabledBoxDecoration: BoxDecoration(
border: Border.all(color: context.theme.colorScheme.primary),
borderRadius: context.theme.style.borderRadius,
),
enabledHoverBoxDecoration: BoxDecoration(
border: Border.all(color: context.theme.colorScheme.primary),
borderRadius: context.theme.style.borderRadius,
color: context.theme.colorScheme.secondary,
),
); Then, either pass it to a |
Beta Was this translation helpful? Give feedback.
Yes, it’s quite verbose atm. The reason it’s so verbose is because we expose the button’s decoration rather than color. This allows a greater degree of customisability at the cost of being slightly more verbose.
It's also worth mentioning that this example modifies not just the color, but the border and border radius as well for both the normal & hovered states. It also takes into account the fact that you might want to modify the typography etc.
If you're interested in modifying only the color, it can be shorten to: