custom method

Widget custom(
  1. BuildContext context,
  2. String? text, {
  3. int? maxLines,
  4. TextAlign? textAlign,
  5. Color? color,
  6. double? height,
  7. TextDecoration? decoration,
  8. required FontWeight fontWeight,
  9. required double fontSize,
  10. String? font,
})

Implementation

Widget custom(BuildContext context, String? text,
    {int? maxLines,
    TextAlign? textAlign,
    Color? color,
    double? height,
    TextDecoration? decoration,
    required FontWeight fontWeight,
    required double fontSize,
    String? font}) {
  return Text(
    text ?? '',
    textAlign: textAlign ?? TextAlign.start,
    maxLines: maxLines,
    overflow: maxLines != null ? TextOverflow.ellipsis : null,
    style: TextStyle(
      fontFamily: font ?? Theme.of(context).textTheme.bodyMedium!.fontFamily,
      color: color ?? Theme.of(context).textTheme.bodyMedium!.color,
      fontSize: fontSize,
      fontWeight: fontWeight,
      height: height ?? textHeight,
      decoration: decoration ?? TextDecoration.none,
    ),
  );
}