update style

null_safety
小赖 4 years ago
parent 69501d3cff
commit cae6d0df1b

@ -94,21 +94,21 @@ class ASButton extends StatefulWidget {
textColor = kTextColor, textColor = kTextColor,
super(key: key); super(key: key);
ASButton.warn( ASButton.warn({
{Key key, Key key,
this.radius, this.radius,
this.outlineColor, this.outlineColor,
this.textStyle, this.textStyle,
this.padding, this.padding,
@required this.title, @required this.title,
this.onPressed, this.onPressed,
this.width, this.width,
this.disableColor, this.disableColor,
this.disableTextColor, this.disableTextColor,
this.splashColor}) }) : bgcolor = kLightPrimaryColor,
: bgcolor = kLightPrimaryColor,
textColor = kLightTextColor, textColor = kLightTextColor,
outline = false, outline = false,
this.splashColor = ColorTool.getSplashColor(kPrimaryColor),
super(key: key); super(key: key);
ASButton.operation( ASButton.operation(
{Key key, {Key key,
@ -169,7 +169,7 @@ class _ASButtonState extends State<ASButton> {
borderRadius: BorderRadius.circular(widget.radius ?? 15.5.w)), borderRadius: BorderRadius.circular(widget.radius ?? 15.5.w)),
color: widget.bgcolor ?? kForegroundColor, color: widget.bgcolor ?? kForegroundColor,
splashColor: widget.splashColor, splashColor: widget.splashColor,
highlightColor: widget.splashColor, highlightColor: widget.splashColor?.withOpacity(0.3),
elevation: 0, elevation: 0,
focusElevation: 0, focusElevation: 0,
highlightElevation: 0, highlightElevation: 0,

@ -114,6 +114,7 @@ class _ASLongButtonState extends State<ASLongButton> {
color: widget.bgColor ?? kForegroundColor, color: widget.bgColor ?? kForegroundColor,
elevation: 0, elevation: 0,
highlightElevation: 0, highlightElevation: 0,
splashColor: ColorTool.getSplashColor(widget.bgColor),
); );
} }
} }

@ -35,3 +35,22 @@ const Color kLightTextColor = Color(0xD9FFFFFF);
/// ///
const Color kSecondaryColor = Color(0xFFE50112); 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);
}
}

Loading…
Cancel
Save