text static method

Widget text({
  1. required String text,
  2. required VoidCallback? onPressed,
  3. bool loading = false,
  4. ButtonSize buttonSize = ButtonSize.md,
  5. Widget? suffixIcon,
  6. TextStyle? textStyle,
  7. Color? textColor = KashiColors.primaryColor,
  8. EdgeInsetsGeometry margin = EdgeInsets.zero,
  9. 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,
              ),
          ],
        )),
  );
}