mirror of
https://github.com/foss42/apidash.git
synced 2025-08-06 13:51:20 +08:00
Update button_text.dart
This commit is contained in:
@ -6,30 +6,42 @@ class ADTextButton extends StatelessWidget {
|
|||||||
super.key,
|
super.key,
|
||||||
this.icon,
|
this.icon,
|
||||||
this.iconSize,
|
this.iconSize,
|
||||||
|
this.showLabel = true,
|
||||||
this.label,
|
this.label,
|
||||||
|
this.labelTextStyle,
|
||||||
this.onPressed,
|
this.onPressed,
|
||||||
});
|
});
|
||||||
|
|
||||||
final IconData? icon;
|
final IconData? icon;
|
||||||
final double? iconSize;
|
final double? iconSize;
|
||||||
|
final bool showLabel;
|
||||||
final String? label;
|
final String? label;
|
||||||
|
final TextStyle? labelTextStyle;
|
||||||
final VoidCallback? onPressed;
|
final VoidCallback? onPressed;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var child = Text(
|
var child = Text(
|
||||||
label ?? "",
|
label ?? "",
|
||||||
style: kTextStyleButton,
|
style: labelTextStyle ?? kTextStyleButton,
|
||||||
);
|
);
|
||||||
return icon != null
|
return icon != null
|
||||||
? TextButton.icon(
|
? showLabel
|
||||||
icon: Icon(
|
? TextButton.icon(
|
||||||
icon,
|
icon: Icon(
|
||||||
size: iconSize ?? kButtonIconSizeMedium,
|
icon,
|
||||||
),
|
size: iconSize ?? kButtonIconSizeMedium,
|
||||||
label: child,
|
),
|
||||||
onPressed: onPressed,
|
label: child,
|
||||||
)
|
onPressed: onPressed,
|
||||||
|
)
|
||||||
|
: IconButton(
|
||||||
|
onPressed: onPressed,
|
||||||
|
icon: Icon(
|
||||||
|
icon,
|
||||||
|
size: iconSize ?? kButtonIconSizeMedium,
|
||||||
|
),
|
||||||
|
)
|
||||||
: TextButton(
|
: TextButton(
|
||||||
onPressed: onPressed,
|
onPressed: onPressed,
|
||||||
child: child,
|
child: child,
|
||||||
|
Reference in New Issue
Block a user