From 78fe2462bd4e2743f25d4ecbde5a9cfbb635e90d Mon Sep 17 00:00:00 2001 From: Ankit Mahato Date: Sun, 6 Apr 2025 03:08:12 +0530 Subject: [PATCH] Update button_text.dart --- .../lib/widgets/button_text.dart | 30 +++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/packages/apidash_design_system/lib/widgets/button_text.dart b/packages/apidash_design_system/lib/widgets/button_text.dart index 4762e6d4..e3f74c5a 100644 --- a/packages/apidash_design_system/lib/widgets/button_text.dart +++ b/packages/apidash_design_system/lib/widgets/button_text.dart @@ -6,30 +6,42 @@ class ADTextButton extends StatelessWidget { super.key, this.icon, this.iconSize, + this.showLabel = true, this.label, + this.labelTextStyle, this.onPressed, }); final IconData? icon; final double? iconSize; + final bool showLabel; final String? label; + final TextStyle? labelTextStyle; final VoidCallback? onPressed; @override Widget build(BuildContext context) { var child = Text( label ?? "", - style: kTextStyleButton, + style: labelTextStyle ?? kTextStyleButton, ); return icon != null - ? TextButton.icon( - icon: Icon( - icon, - size: iconSize ?? kButtonIconSizeMedium, - ), - label: child, - onPressed: onPressed, - ) + ? showLabel + ? TextButton.icon( + icon: Icon( + icon, + size: iconSize ?? kButtonIconSizeMedium, + ), + label: child, + onPressed: onPressed, + ) + : IconButton( + onPressed: onPressed, + icon: Icon( + icon, + size: iconSize ?? kButtonIconSizeMedium, + ), + ) : TextButton( onPressed: onPressed, child: child,