mirror of
https://github.com/foss42/apidash.git
synced 2025-05-19 23:36:36 +08:00
39 lines
808 B
Dart
39 lines
808 B
Dart
import 'package:flutter/material.dart';
|
|
import '../tokens/tokens.dart';
|
|
|
|
class ADTextButton extends StatelessWidget {
|
|
const ADTextButton({
|
|
super.key,
|
|
this.icon,
|
|
this.iconSize,
|
|
this.label,
|
|
this.onPressed,
|
|
});
|
|
|
|
final IconData? icon;
|
|
final double? iconSize;
|
|
final String? label;
|
|
final VoidCallback? onPressed;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
var child = Text(
|
|
label ?? "",
|
|
style: kTextStyleButton,
|
|
);
|
|
return icon != null
|
|
? TextButton.icon(
|
|
icon: Icon(
|
|
icon,
|
|
size: iconSize ?? kButtonIconSizeMedium,
|
|
),
|
|
label: child,
|
|
onPressed: onPressed,
|
|
)
|
|
: TextButton(
|
|
onPressed: onPressed,
|
|
child: child,
|
|
);
|
|
}
|
|
}
|