master
小赖 4 years ago
parent a225184921
commit 2b1ac75fc1

@ -12,6 +12,7 @@ class AkuButton extends StatefulWidget {
final EdgeInsets padding; final EdgeInsets padding;
@required @required
final VoidCallback onPressed; final VoidCallback onPressed;
final Color color;
AkuButton({ AkuButton({
Key key, Key key,
this.child, this.child,
@ -19,6 +20,7 @@ class AkuButton extends StatefulWidget {
this.radius = 0, this.radius = 0,
this.onPressed, this.onPressed,
this.padding = EdgeInsets.zero, this.padding = EdgeInsets.zero,
this.color = Colors.transparent,
}) : super(key: key); }) : super(key: key);
@override @override
@ -35,6 +37,7 @@ class _AkuButtonState extends State<AkuButton> with PlatformMixin {
radius: widget.radius, radius: widget.radius,
minHeight: widget.height, minHeight: widget.height,
padding: widget.padding, padding: widget.padding,
color: widget.color,
) )
: AkuMaterialButton( : AkuMaterialButton(
onPressed: widget.onPressed, onPressed: widget.onPressed,
@ -42,6 +45,7 @@ class _AkuButtonState extends State<AkuButton> with PlatformMixin {
radius: widget.radius, radius: widget.radius,
height: widget.height, height: widget.height,
padding: widget.padding, padding: widget.padding,
color: widget.color,
); );
} }
} }

@ -11,6 +11,7 @@ class AkuMaterialButton extends MaterialButton {
final double minWidth; final double minWidth;
final double radius; final double radius;
final EdgeInsets padding; final EdgeInsets padding;
final Color color;
final Widget child; final Widget child;
AkuMaterialButton({ AkuMaterialButton({
@ -26,6 +27,7 @@ class AkuMaterialButton extends MaterialButton {
this.radius = 0, this.radius = 0,
this.padding = EdgeInsets.zero, this.padding = EdgeInsets.zero,
@required this.child, @required this.child,
this.color = Colors.transparent,
}) : super( }) : super(
key: key, key: key,
onPressed: onPressed, onPressed: onPressed,
@ -41,5 +43,6 @@ class AkuMaterialButton extends MaterialButton {
borderRadius: BorderRadius.circular(radius), borderRadius: BorderRadius.circular(radius),
), ),
child: child, child: child,
color: color,
); );
} }

@ -7,12 +7,14 @@ class AkuRoundButton extends AkuButton {
final VoidCallback onPressed; final VoidCallback onPressed;
final Widget child; final Widget child;
final EdgeInsets padding; final EdgeInsets padding;
final Color color;
AkuRoundButton({ AkuRoundButton({
Key key, Key key,
this.height, this.height,
@required this.child, @required this.child,
@required this.onPressed, @required this.onPressed,
this.padding = EdgeInsets.zero, this.padding = EdgeInsets.zero,
this.color = Colors.transparent,
}) : super( }) : super(
key: key, key: key,
height: height, height: height,
@ -20,5 +22,6 @@ class AkuRoundButton extends AkuButton {
onPressed: onPressed, onPressed: onPressed,
child: child, child: child,
padding: padding, padding: padding,
color: color,
); );
} }