getDefaultStyle method
AntdButtonStyle
getDefaultStyle(
- BuildContext context,
- AntdTheme theme,
- AntdMapToken token
override
Implementation
@override
AntdButtonStyle getDefaultStyle(
BuildContext context, AntdTheme theme, AntdMapToken token) {
var setColor = color?.getColor(token);
TextStyle textStyle = switch (size) {
AntdSize.mini => token.font.sm,
AntdSize.small => token.font.md,
AntdSize.middle => token.font.xl,
AntdSize.large => token.font.xxl,
};
EdgeInsets verticalPadding = switch (size) {
AntdSize.mini => token.size.xs.vertical,
AntdSize.small => token.size.xs.vertical,
AntdSize.middle => token.size.ms.vertical,
AntdSize.large => token.size.lg.vertical,
};
var style = AntdBoxStyle(
width: block == true ? double.infinity : null,
padding: verticalPadding.marge(token.size.lg.horizontal),
feedbackStyle: AntdBoxStyle(color: token.colorFill.tertiary),
textStyle: textStyle.copyWith(color: setColor ?? token.colorText),
radius: BorderRadius.circular(
shape == AntdButtonShape.rounded ? 9999 : token.radius.seed),
border: fill != AntdButtonFill.none
? Border.all(color: setColor ?? token.border.color, width: 1)
: null,
);
if (fill == AntdButtonFill.solid && setColor != null) {
style = style.copyFrom(AntdBoxStyle(
feedbackStyle: AntdBoxStyle(color: color?.getActiveColor(token)),
color: setColor,
textStyle: textStyle.copyWith(color: token.colorWhite)));
}
return AntdButtonStyle(
buttonStyle: style,
loadingWidget: AntdLoading(
spinning: true,
text: const Text("加载中"),
style: AntdLoadingStyle(
color: style.textStyle?.color,
textStyle: AntdBoxStyle(textStyle: style.textStyle)),
),
iconStyle: AntdIconStyle(
color: style.textStyle?.color,
size: token.size.xl.roundToDouble(),
bodyStyle: AntdBoxStyle(
padding: child != null ? token.size.seed.right : 0.all)));
}