diff --git a/lib/buttons/as_button.dart b/lib/buttons/as_button.dart index a1c4a0c..67bd89e 100644 --- a/lib/buttons/as_button.dart +++ b/lib/buttons/as_button.dart @@ -94,21 +94,21 @@ class ASButton extends StatefulWidget { textColor = kTextColor, super(key: key); - ASButton.warn( - {Key key, - this.radius, - this.outlineColor, - this.textStyle, - this.padding, - @required this.title, - this.onPressed, - this.width, - this.disableColor, - this.disableTextColor, - this.splashColor}) - : bgcolor = kLightPrimaryColor, + ASButton.warn({ + Key key, + this.radius, + this.outlineColor, + this.textStyle, + this.padding, + @required this.title, + this.onPressed, + this.width, + this.disableColor, + this.disableTextColor, + }) : bgcolor = kLightPrimaryColor, textColor = kLightTextColor, outline = false, + this.splashColor = ColorTool.getSplashColor(kPrimaryColor), super(key: key); ASButton.operation( {Key key, @@ -169,7 +169,7 @@ class _ASButtonState extends State { borderRadius: BorderRadius.circular(widget.radius ?? 15.5.w)), color: widget.bgcolor ?? kForegroundColor, splashColor: widget.splashColor, - highlightColor: widget.splashColor, + highlightColor: widget.splashColor?.withOpacity(0.3), elevation: 0, focusElevation: 0, highlightElevation: 0, diff --git a/lib/buttons/as_longbutton.dart b/lib/buttons/as_longbutton.dart index c297d3d..ef19fa6 100644 --- a/lib/buttons/as_longbutton.dart +++ b/lib/buttons/as_longbutton.dart @@ -114,6 +114,7 @@ class _ASLongButtonState extends State { color: widget.bgColor ?? kForegroundColor, elevation: 0, highlightElevation: 0, + splashColor: ColorTool.getSplashColor(widget.bgColor), ); } } diff --git a/lib/styles/as_colors.dart b/lib/styles/as_colors.dart index 0ecdf4a..963b41b 100644 --- a/lib/styles/as_colors.dart +++ b/lib/styles/as_colors.dart @@ -35,3 +35,22 @@ const Color kLightTextColor = Color(0xD9FFFFFF); ///次主题色 const Color kSecondaryColor = Color(0xFFE50112); + +class ColorTool { + static Color getSplashColor(Color color) { + int r = color.red; + int g = color.green; + int b = color.blue; + + return Color.fromRGBO( + colorM50Less0(r), + colorM50Less0(g), + colorM50Less0(b), + 1, + ); + } + + static int colorM50Less0(int light) { + return (light - 50) < 0 ? 0 : (light - 50); + } +}