text static method
Widget
text({
- required String text,
- required VoidCallback? onPressed,
- bool loading = false,
- ButtonSize buttonSize = ButtonSize.md,
- Widget? suffixIcon,
- TextStyle? textStyle,
- Color? textColor = KashiColors.primaryColor,
- EdgeInsetsGeometry margin = EdgeInsets.zero,
- Size size = const Size(0.0, 0.0),
Implementation
static Widget text({
required String text,
required VoidCallback? onPressed,
bool loading = false,
ButtonSize buttonSize = ButtonSize.md,
Widget? suffixIcon,
TextStyle? textStyle,
Color? textColor = KashiColors.primaryColor,
EdgeInsetsGeometry margin = EdgeInsets.zero,
Size size = const Size(0.0, 0.0),
}) {
return Padding(
padding: margin,
child: TextButton(
style: TextButton.styleFrom(
minimumSize: size,
shape: rectBorderRadiusX(8, null),
),
onPressed: !loading ? onPressed : null,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
text,
style: textStyle ??
KashiTheme.smallTextSemiBold
.copyWith(color: textColor)
.copyWith(
fontWeight: buttonSize.fontWeight,
fontSize: buttonSize.fontSize,
)
.toDMSanFontsFamily(),
),
if (suffixIcon != null)
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: suffixIcon,
),
],
)),
);
}