CQTSThemeStateButton constructor

CQTSThemeStateButton({
  1. Key? key,
  2. double? width,
  3. double? height,
  4. required CQTSThemeBGType normalBGColorType,
  5. bool needHighlight = false,
  6. double cornerRadius = 5.0,
  7. required String normalTitle,
  8. String? selectedTitle,
  9. TextStyle? titleStyle,
  10. bool enable = true,
  11. bool selected = false,
  12. required void onPressed(),
})

Implementation

CQTSThemeStateButton({
  Key? key,
  double? width,
  double? height,
  required CQTSThemeBGType normalBGColorType,
  bool needHighlight = false, // 是否需要高亮样式(默认false)
  double cornerRadius = 5.0,
  required String normalTitle,
  String? selectedTitle,
  TextStyle? titleStyle,
  bool enable = true,
  bool selected = false,
  required void Function() onPressed,
}) : super(
        key: key,
        width: width,
        height: height,
        childBuider: (bSelected) {
          String _currentTitle = normalTitle;
          if (selected) {
            _currentTitle = selectedTitle ?? normalTitle;
          }

          return Text(
            _currentTitle,
            style: titleStyle ?? TextStyle(fontSize: 13.0),
          );
        },
        enable: enable,
        selected: selected,
        onPressed: () {
          onPressed();
        },
        cornerRadius: cornerRadius,
        themeColor: themeColor(normalBGColorType),
        themeOppositeColor: themeOppositeColor(normalBGColorType),
        normalBorderWidth: 0.0,
        selectedBorderWidth: 1.0,
        // normalBackgroundHighlightColor: Colors.yellow,
        // selectedBackgroundHighlightColor: Colors.pink,
        highlightOpacity: needHighlight ? 0.7 : 1.0,
      );