按钮添加splash

null_safety
小赖 4 years ago
parent 33b2dd8457
commit ca7a004c1b

@ -16,20 +16,20 @@ class _ExampleButtonState extends State<ExampleButton> {
title: 'Button',
body: ListView(
children: [
ASButton.delete(
title: '删除订单',
ASButton.danger(
title: '危险按钮',
onPressed: () {},
),
ASButton.info(
title: '删除订单',
title: '提示按钮',
onPressed: () {},
),
ASButton.warn(
title: '删除订单',
title: '警告按钮',
onPressed: () {},
),
ASButton.opration(
title: '删除订单',
ASButton.operation(
title: '操作按钮',
onPressed: () {},
),
SizedBox(height: 12.w),
@ -51,7 +51,7 @@ class _ExampleButtonState extends State<ExampleButton> {
title: '支付',
onPressed: () {},
),
ASButton.delete(
ASButton.danger(
title: '删除',
onPressed: () {},
),

@ -1,3 +1,4 @@
import 'package:ansu_ui/styles/as_colors.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -40,6 +41,8 @@ class ASButton extends StatefulWidget {
///
final Color disableTextColor;
final Color splashColor;
ASButton({
Key key,
this.bgcolor,
@ -54,22 +57,24 @@ class ASButton extends StatefulWidget {
this.width,
this.disableColor,
this.disableTextColor,
this.splashColor,
}) : super(key: key);
ASButton.warn(
{Key key,
this.textStyle,
this.padding,
this.radius,
this.bgcolor,
this.onPressed,
@required this.title,
this.width,
this.disableColor,
this.disableTextColor})
: outline = true,
outlineColor = Color(0xFFE50112),
textColor = Color(0xFFE50112),
ASButton.danger({
Key key,
this.textStyle,
this.padding,
this.radius,
this.bgcolor,
this.onPressed,
@required this.title,
this.width,
this.disableColor,
this.disableTextColor,
}) : outline = true,
outlineColor = kDangerColor,
textColor = kDangerColor,
splashColor = kDangerColor.withOpacity(0.2),
super(key: key);
ASButton.info(
@ -82,13 +87,14 @@ class ASButton extends StatefulWidget {
this.onPressed,
this.width,
this.disableColor,
this.disableTextColor})
this.disableTextColor,
this.splashColor})
: outline = true,
outlineColor = Color(0x73000000),
textColor = Color(0xD9000000),
super(key: key);
ASButton.delete(
ASButton.warn(
{Key key,
this.radius,
this.outlineColor,
@ -98,12 +104,13 @@ class ASButton extends StatefulWidget {
this.onPressed,
this.width,
this.disableColor,
this.disableTextColor})
this.disableTextColor,
this.splashColor})
: bgcolor = Color(0xFFFFB600),
textColor = Color(0xD9FFFFFF),
outline = false,
super(key: key);
ASButton.opration(
ASButton.operation(
{Key key,
this.radius,
this.outlineColor,
@ -113,7 +120,8 @@ class ASButton extends StatefulWidget {
this.onPressed,
this.width,
this.disableColor,
this.disableTextColor})
this.disableTextColor,
this.splashColor})
: bgcolor = Color(0xFFF2F2F2),
textColor = Color(0xD9000000),
outline = false,
@ -124,6 +132,7 @@ class ASButton extends StatefulWidget {
this.onPressed,
this.outlineColor,
this.width,
this.splashColor,
}) : bgcolor = Color(0xFFFFBD32),
textColor = Color(0xFF0000000),
textStyle = TextStyle(fontSize: 14.sp, fontWeight: FontWeight.bold),
@ -158,7 +167,9 @@ class _ASButtonState extends State<ASButton> {
? BorderSide(color: widget.outlineColor, width: 0.5.w)
: BorderSide.none,
borderRadius: BorderRadius.circular(widget.radius ?? 15.5.w)),
color: widget.bgcolor ?? Color(0xFFFFFFFF),
color: widget.bgcolor ?? kForegroundColor,
splashColor: widget.splashColor,
highlightColor: widget.splashColor,
elevation: 0,
focusElevation: 0,
highlightElevation: 0,

@ -17,3 +17,6 @@ const Color kForegroundColor = Color(0xFFFFFFFF);
///
const Color kBackgroundColor = Color(0xFFF6F6F6);
///
const Color kDangerColor = Color(0xFFE50112);

Loading…
Cancel
Save