TDButtonStyle.generateTextStyleByTheme constructor

TDButtonStyle.generateTextStyleByTheme(
  1. BuildContext context,
  2. TDButtonTheme? theme,
  3. TDButtonStatus status
)

生成不同主题的文本按钮样式

Implementation

TDButtonStyle.generateTextStyleByTheme(
    BuildContext context, TDButtonTheme? theme, TDButtonStatus status) {
  switch (theme) {
    case TDButtonTheme.primary:
      textColor = _getBrandColor(context, status);
      backgroundColor = status == TDButtonStatus.active ? TDTheme.of(context).grayColor3 : Colors.transparent;
      break;
    case TDButtonTheme.danger:
      textColor = _getErrorColor(context, status);
      backgroundColor = status == TDButtonStatus.active ? TDTheme.of(context).grayColor3 : Colors.transparent;
      break;
    case TDButtonTheme.light:
      textColor = _getBrandColor(context, status);
      backgroundColor = status == TDButtonStatus.active ? TDTheme.of(context).grayColor3 : Colors.transparent;
      break;
    case TDButtonTheme.defaultTheme:
    default:
      textColor = _getDefaultTextColor(context, status);
      backgroundColor = status == TDButtonStatus.active ? TDTheme.of(context).grayColor3 : Colors.transparent;
  }
  frameColor = backgroundColor;
}