ThemeBGButton constructor
ThemeBGButton({})
Implementation
ThemeBGButton({
Key? key,
double? width,
double? height,
ThemeBGType? bgColorType,
Color? bgColor, // 不设置 bgColor 的时候要设置 bgColorType
Color? textColor, // 不设置 textColor 的时候要设置 bgColorType
bool needHighlight = false, // 是否需要高亮样式(默认false)
required String title,
TextStyle? titleStyle,
Image? imageWidget, // 图片
double imageTitleGap = 5, // 图片和文字之间的距离(imageWidget存在的时候才有效)
double? cornerRadius,
bool enable = true,
VoidCallback? onPressed, // null时候会自动透传事件
}) : assert(bgColorType != null || bgColor != null),
assert(bgColorType != null || textColor != null),
super(
key: key,
width: width,
height: height,
childBuider: (bSelected) {
return ButtonChildWidget(
title: title,
titleStyle: titleStyle,
imageWidget: imageWidget,
imageTitleGap: imageTitleGap,
);
},
enable: enable,
selected: false,
onPressed: onPressed,
cornerRadius: cornerRadius ?? 5.0,
normalBGColor: bgColor != null ? bgColor : themeColor(bgColorType),
normalTextColor:
textColor != null ? textColor : themeOppositeColor(bgColorType),
normalBorderWidth: 0.0,
normalBorderColor:
textColor != null ? textColor : themeOppositeColor(bgColorType),
// normalHighlightColor: Colors.yellow,
highlightOpacity: needHighlight ? 0.7 : 1.0,
);