mirror of
https://github.com/foss42/apidash.git
synced 2025-12-02 02:39:19 +08:00
51 lines
1.2 KiB
Dart
51 lines
1.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import '../tokens/tokens.dart';
|
|
|
|
class ADTextButton extends StatelessWidget {
|
|
const ADTextButton({
|
|
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: labelTextStyle ?? kTextStyleButton,
|
|
);
|
|
return icon != null
|
|
? 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,
|
|
);
|
|
}
|
|
}
|