customText function

Widget customText(
  1. String msg, {
  2. Key? key,
  3. required TextStyle style,
  4. required BuildContext context,
  5. TextAlign textAlign = TextAlign.justify,
  6. TextOverflow overflow = TextOverflow.visible,
  7. bool softWrap = true,
})

Implementation

Widget customText(String msg,
    { Key? key,
      required TextStyle style,
      required BuildContext context,
      TextAlign textAlign = TextAlign.justify,
      TextOverflow overflow = TextOverflow.visible,
      bool softWrap = true}) {
  if (msg.isEmpty) {
    return const SizedBox(
      height: 0,
      width: 0,
    );
  } else {
    var fontSize = style.fontSize ?? Theme.of(context).textTheme.bodyMedium!.fontSize;
    style = style.copyWith(
      fontSize: fontSize! - (AppTheme.fullWidth(context) <= 375 ? 2 : 0),
    );
    return Text(
      msg,
      style: style,
      textAlign: textAlign,
      overflow: overflow,
      softWrap: softWrap,
      key: key,
    );
  }
}