diff --git a/tdesign-component/lib/src/components/button/td_button_style.dart b/tdesign-component/lib/src/components/button/td_button_style.dart index 717b0cc9e..131674b13 100644 --- a/tdesign-component/lib/src/components/button/td_button_style.dart +++ b/tdesign-component/lib/src/components/button/td_button_style.dart @@ -6,25 +6,23 @@ import '../../../tdesign_flutter.dart'; class TDButtonStyle { /// 背景颜色 Color? backgroundColor; + /// 边框颜色 Color? frameColor; + /// 文字颜色 Color? textColor; + /// 边框宽度 double? frameWidth; + /// 自定义圆角 BorderRadiusGeometry? radius; - TDButtonStyle( - {this.backgroundColor, - this.frameColor, - this.textColor, - this.frameWidth, - this.radius}); + TDButtonStyle({this.backgroundColor, this.frameColor, this.textColor, this.frameWidth, this.radius}); /// 生成不同主题的填充按钮样式 - TDButtonStyle.generateFillStyleByTheme( - BuildContext context, TDButtonTheme? theme, TDButtonStatus status) { + TDButtonStyle.generateFillStyleByTheme(BuildContext context, TDButtonTheme? theme, TDButtonStatus status) { switch (theme) { case TDButtonTheme.primary: textColor = TDTheme.of(context).fontWhColor1; @@ -47,17 +45,18 @@ class TDButtonStyle { } /// 生成不同主题的描边按钮样式 - TDButtonStyle.generateOutlineStyleByTheme( - BuildContext context, TDButtonTheme? theme, TDButtonStatus status) { + TDButtonStyle.generateOutlineStyleByTheme(BuildContext context, TDButtonTheme? theme, TDButtonStatus status) { switch (theme) { case TDButtonTheme.primary: textColor = _getBrandColor(context, status); - backgroundColor = status == TDButtonStatus.active ? TDTheme.of(context).grayColor3 : TDTheme.of(context).whiteColor1; + backgroundColor = + status == TDButtonStatus.active ? TDTheme.of(context).grayColor3 : TDTheme.of(context).whiteColor1; frameColor = textColor; break; case TDButtonTheme.danger: textColor = _getErrorColor(context, status); - backgroundColor = status == TDButtonStatus.active ? TDTheme.of(context).grayColor3 : TDTheme.of(context).whiteColor1; + backgroundColor = + status == TDButtonStatus.active ? TDTheme.of(context).grayColor3 : TDTheme.of(context).whiteColor1; frameColor = textColor; break; case TDButtonTheme.light: @@ -75,8 +74,7 @@ class TDButtonStyle { } /// 生成不同主题的文本按钮样式 - TDButtonStyle.generateTextStyleByTheme( - BuildContext context, TDButtonTheme? theme, TDButtonStatus status) { + TDButtonStyle.generateTextStyleByTheme(BuildContext context, TDButtonTheme? theme, TDButtonStatus status) { switch (theme) { case TDButtonTheme.primary: textColor = _getBrandColor(context, status); @@ -99,26 +97,28 @@ class TDButtonStyle { } /// 生成不同主题的幽灵按钮样式 - TDButtonStyle.generateGhostStyleByTheme( - BuildContext context, TDButtonTheme? theme, TDButtonStatus status) { + TDButtonStyle.generateGhostStyleByTheme(BuildContext context, TDButtonTheme? theme, TDButtonStatus status) { switch (theme) { case TDButtonTheme.primary: - textColor = status == TDButtonStatus.disable ? TDTheme.of(context).fontWhColor4 : _getBrandColor(context, status); + textColor = + status == TDButtonStatus.disable ? TDTheme.of(context).fontWhColor4 : _getBrandColor(context, status); break; case TDButtonTheme.danger: - textColor = status == TDButtonStatus.disable ? TDTheme.of(context).fontWhColor4 :_getErrorColor(context, status); + textColor = + status == TDButtonStatus.disable ? TDTheme.of(context).fontWhColor4 : _getErrorColor(context, status); break; case TDButtonTheme.light: - textColor = status == TDButtonStatus.disable ? TDTheme.of(context).fontWhColor4 :_getBrandColor(context, status); + textColor = + status == TDButtonStatus.disable ? TDTheme.of(context).fontWhColor4 : _getBrandColor(context, status); break; case TDButtonTheme.defaultTheme: default: - switch(status){ + switch (status) { case TDButtonStatus.active: - textColor = TDTheme.of(context).fontWhColor2; + textColor = TDTheme.of(context).fontWhColor2; break; case TDButtonStatus.disable: - textColor = TDTheme.of(context).fontWhColor4; + textColor = TDTheme.of(context).fontWhColor4; break; default: textColor = TDTheme.of(context).fontWhColor1; @@ -130,7 +130,7 @@ class TDButtonStyle { } Color _getBrandColor(BuildContext context, TDButtonStatus status) { - switch(status){ + switch (status) { case TDButtonStatus.defaultState: return TDTheme.of(context).brandNormalColor; case TDButtonStatus.active: @@ -141,7 +141,7 @@ class TDButtonStyle { } Color _getLightColor(BuildContext context, TDButtonStatus status) { - switch(status){ + switch (status) { case TDButtonStatus.defaultState: case TDButtonStatus.disable: return TDTheme.of(context).brandLightColor; @@ -151,7 +151,7 @@ class TDButtonStyle { } Color _getErrorColor(BuildContext context, TDButtonStatus status) { - switch(status){ + switch (status) { case TDButtonStatus.defaultState: return TDTheme.of(context).errorNormalColor; case TDButtonStatus.active: @@ -162,7 +162,7 @@ class TDButtonStyle { } Color _getDefaultBgColor(BuildContext context, TDButtonStatus status) { - switch(status){ + switch (status) { case TDButtonStatus.defaultState: return TDTheme.of(context).grayColor3; case TDButtonStatus.active: @@ -173,7 +173,7 @@ class TDButtonStyle { } Color _getDefaultTextColor(BuildContext context, TDButtonStatus status) { - switch(status){ + switch (status) { case TDButtonStatus.defaultState: case TDButtonStatus.active: return TDTheme.of(context).fontGyColor1; @@ -183,7 +183,7 @@ class TDButtonStyle { } Color _getOutlineDefaultBgColor(BuildContext context, TDButtonStatus status) { - switch(status){ + switch (status) { case TDButtonStatus.defaultState: return TDTheme.of(context).whiteColor1; case TDButtonStatus.active: @@ -192,5 +192,4 @@ class TDButtonStyle { return TDTheme.of(context).grayColor2; } } - } diff --git a/tdesign-component/lib/src/components/dialog/td_alert_dialog.dart b/tdesign-component/lib/src/components/dialog/td_alert_dialog.dart index 3d73a7b6b..11ce3faef 100644 --- a/tdesign-component/lib/src/components/dialog/td_alert_dialog.dart +++ b/tdesign-component/lib/src/components/dialog/td_alert_dialog.dart @@ -178,6 +178,7 @@ class TDAlertDialog extends StatelessWidget { Widget btn = TDDialogButton( buttonText: value.title, buttonTextColor: value.titleColor, + buttonTextSize: value.titleSize, height: value.height, buttonTextFontWeight: value.fontWeight ?? FontWeight.w600, buttonStyle: value.style, diff --git a/tdesign-component/lib/src/components/dialog/td_dialog.dart b/tdesign-component/lib/src/components/dialog/td_dialog.dart index 966d69f79..ae83e03a1 100644 --- a/tdesign-component/lib/src/components/dialog/td_dialog.dart +++ b/tdesign-component/lib/src/components/dialog/td_dialog.dart @@ -28,6 +28,7 @@ class TDDialogButtonOptions { required this.title, required this.action, this.titleColor, + this.titleSize, this.style, this.type, this.theme, @@ -41,6 +42,9 @@ class TDDialogButtonOptions { /// 标题颜色 Color? titleColor; + /// 字体大小 + final double? titleSize; + /// 字体粗细 final FontWeight? fontWeight; diff --git a/tdesign-component/lib/src/components/dialog/td_dialog_widget.dart b/tdesign-component/lib/src/components/dialog/td_dialog_widget.dart index 93b0fdecf..021d98676 100644 --- a/tdesign-component/lib/src/components/dialog/td_dialog_widget.dart +++ b/tdesign-component/lib/src/components/dialog/td_dialog_widget.dart @@ -231,7 +231,8 @@ class HorizontalNormalButtons extends StatelessWidget { Expanded( child: TDDialogButton( buttonText: leftBtn.title, - buttonTextColor: leftBtn.titleColor ?? TDTheme.of(context).brandNormalColor, + buttonTextColor: leftBtn.titleColor, + buttonTextSize: leftBtn.titleSize, buttonStyle: leftBtn.style, buttonType: leftBtn.type, buttonTheme: leftBtn.theme, @@ -253,7 +254,8 @@ class HorizontalNormalButtons extends StatelessWidget { Expanded( child: TDDialogButton( buttonText: rightBtn.title, - buttonTextColor: rightBtn.titleColor ?? TDTheme.of(context).whiteColor1, + buttonTextColor: rightBtn.titleColor, + buttonTextSize: rightBtn.titleSize, buttonStyle: rightBtn.style, buttonType: rightBtn.type, buttonTheme: rightBtn.theme, @@ -300,7 +302,8 @@ class HorizontalTextButtons extends StatelessWidget { Expanded( child: TDDialogButton( buttonText: leftBtn.title, - buttonTextColor: leftBtn.titleColor ?? TDTheme.of(context).fontGyColor1, + buttonTextColor: leftBtn.titleColor, + buttonTextSize: leftBtn.titleSize, buttonStyle: leftBtn.style, buttonType: leftBtn.type ?? TDButtonType.text, buttonTheme: leftBtn.theme, @@ -322,7 +325,8 @@ class HorizontalTextButtons extends StatelessWidget { Expanded( child: TDDialogButton( buttonText: rightBtn.title, - buttonTextColor: rightBtn.titleColor ?? TDTheme.of(context).brandNormalColor, + buttonTextColor: rightBtn.titleColor, + buttonTextSize: rightBtn.titleSize, buttonStyle: leftBtn.style, buttonType: leftBtn.type ?? TDButtonType.text, buttonTheme: leftBtn.theme ?? TDButtonTheme.primary, @@ -350,6 +354,7 @@ class TDDialogButton extends StatelessWidget { Key? key, this.buttonText, this.buttonTextColor, + this.buttonTextSize, this.buttonTextFontWeight = FontWeight.w600, this.buttonStyle, this.buttonType, @@ -366,6 +371,9 @@ class TDDialogButton extends StatelessWidget { /// 按钮文字颜色 final Color? buttonTextColor; + /// 按钮文字大小 + final double? buttonTextSize; + /// 按钮文字粗细 final FontWeight? buttonTextFontWeight; @@ -398,7 +406,7 @@ class TDDialogButton extends StatelessWidget { type: buttonType ?? TDButtonType.fill, theme: buttonTheme, text: buttonText, - textStyle: TextStyle(fontWeight: buttonTextFontWeight, color: buttonTextColor), + textStyle: TextStyle(fontWeight: buttonTextFontWeight,color:buttonTextColor,fontSize: buttonTextSize), width: width, height: height, isBlock: isBlock, diff --git a/tdesign-component/lib/src/components/stepper/td_stepper.dart b/tdesign-component/lib/src/components/stepper/td_stepper.dart index d5cdff666..057326054 100644 --- a/tdesign-component/lib/src/components/stepper/td_stepper.dart +++ b/tdesign-component/lib/src/components/stepper/td_stepper.dart @@ -274,8 +274,11 @@ class _TDStepperState extends State { textAlign: TextAlign.center, textAlignVertical: TextAlignVertical.center, keyboardType: TextInputType.number, - decoration: - const InputDecoration(border: InputBorder.none), + decoration: InputDecoration( + border: InputBorder.none, + isDense: true, + contentPadding: EdgeInsets.zero, + ), inputFormatters: [ FilteringTextInputFormatter.digitsOnly, TextInputFormatter.withFunction((oldValue, newValue) {