add content padding property to SecondaryButton

This commit is contained in:
julian 2023-04-03 17:00:08 -06:00
parent a9306e5267
commit f10db8306a

View file

@ -18,6 +18,7 @@ class SecondaryButton extends StatelessWidget {
this.enabled = true, this.enabled = true,
this.buttonHeight, this.buttonHeight,
this.iconSpacing = 10, this.iconSpacing = 10,
this.padding = EdgeInsets.zero,
}) : super(key: key); }) : super(key: key);
final double? width; final double? width;
@ -29,6 +30,7 @@ class SecondaryButton extends StatelessWidget {
final Widget? trailingIcon; final Widget? trailingIcon;
final ButtonHeight? buttonHeight; final ButtonHeight? buttonHeight;
final double iconSpacing; final double iconSpacing;
final EdgeInsets padding;
TextStyle getStyle(bool isDesktop, BuildContext context) { TextStyle getStyle(bool isDesktop, BuildContext context) {
if (isDesktop) { if (isDesktop) {
@ -155,37 +157,40 @@ class SecondaryButton extends StatelessWidget {
: Theme.of(context) : Theme.of(context)
.extension<StackColors>()! .extension<StackColors>()!
.getSecondaryDisabledButtonStyle(context), .getSecondaryDisabledButtonStyle(context),
child: Row( child: Padding(
mainAxisAlignment: MainAxisAlignment.center, padding: padding,
crossAxisAlignment: CrossAxisAlignment.center, child: Row(
children: [ mainAxisAlignment: MainAxisAlignment.center,
if (icon != null) icon!, crossAxisAlignment: CrossAxisAlignment.center,
if (icon != null && label != null) children: [
SizedBox( if (icon != null) icon!,
width: iconSpacing, if (icon != null && label != null)
), SizedBox(
if (label != null) width: iconSpacing,
Column( ),
mainAxisSize: MainAxisSize.min, if (label != null)
mainAxisAlignment: MainAxisAlignment.center, Column(
crossAxisAlignment: CrossAxisAlignment.center, mainAxisSize: MainAxisSize.min,
children: [ mainAxisAlignment: MainAxisAlignment.center,
Text( crossAxisAlignment: CrossAxisAlignment.center,
label!, children: [
style: getStyle(isDesktop, context), Text(
), label!,
if (buttonHeight != null && buttonHeight == ButtonHeight.s) style: getStyle(isDesktop, context),
const SizedBox(
height: 2,
), ),
], if (buttonHeight != null && buttonHeight == ButtonHeight.s)
), const SizedBox(
if (trailingIcon != null) height: 2,
SizedBox( ),
width: iconSpacing, ],
), ),
if (trailingIcon != null) trailingIcon!, if (trailingIcon != null)
], SizedBox(
width: iconSpacing,
),
if (trailingIcon != null) trailingIcon!,
],
),
), ),
), ),
); );