button add width

master
小赖 4 years ago
parent 2b1ac75fc1
commit e57b6920e4

@ -13,6 +13,7 @@ class AkuButton extends StatefulWidget {
@required @required
final VoidCallback onPressed; final VoidCallback onPressed;
final Color color; final Color color;
final double width;
AkuButton({ AkuButton({
Key key, Key key,
this.child, this.child,
@ -21,6 +22,7 @@ class AkuButton extends StatefulWidget {
this.onPressed, this.onPressed,
this.padding = EdgeInsets.zero, this.padding = EdgeInsets.zero,
this.color = Colors.transparent, this.color = Colors.transparent,
this.width = 0,
}) : super(key: key); }) : super(key: key);
@override @override
@ -38,6 +40,7 @@ class _AkuButtonState extends State<AkuButton> with PlatformMixin {
minHeight: widget.height, minHeight: widget.height,
padding: widget.padding, padding: widget.padding,
color: widget.color, color: widget.color,
minWidth: widget.width,
) )
: AkuMaterialButton( : AkuMaterialButton(
onPressed: widget.onPressed, onPressed: widget.onPressed,
@ -46,6 +49,7 @@ class _AkuButtonState extends State<AkuButton> with PlatformMixin {
height: widget.height, height: widget.height,
padding: widget.padding, padding: widget.padding,
color: widget.color, color: widget.color,
minWidth: widget.width,
); );
} }
} }

@ -9,6 +9,7 @@ class AkuCupertinoButton extends CupertinoButton {
final double radius; final double radius;
final double minHeight; final double minHeight;
final Color nullColor; final Color nullColor;
final double minWidth;
AkuCupertinoButton({ AkuCupertinoButton({
Key key, Key key,
@ -19,9 +20,14 @@ class AkuCupertinoButton extends CupertinoButton {
this.radius = 0, this.radius = 0,
this.minHeight = 0, this.minHeight = 0,
this.nullColor, this.nullColor,
this.minWidth,
}) : super( }) : super(
key: key, key: key,
child: child, child: Container(
alignment: Alignment.center,
constraints: BoxConstraints(minWidth: minWidth),
child: child,
),
color: color, color: color,
onPressed: onPressed, onPressed: onPressed,
padding: padding, padding: padding,

@ -44,5 +44,6 @@ class AkuMaterialButton extends MaterialButton {
), ),
child: child, child: child,
color: color, color: color,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
); );
} }