showHeading method

Widget showHeading({
  1. required String name,
  2. int maxLines = 2,
  3. bool softWrap = true,
  4. double? fontSize,
  5. double height = 1,
  6. FontWeight? fontWeight,
  7. String? fontFamily,
  8. TextAlign? textAlign,
  9. Color color = Colors.grey,
})

Creates a heading text widget with customizable styling.

Displays text with configurable font, size, weight, and alignment. Suitable for section headings and titles.

Parameters:

  • name: The text content to display.
  • maxLines: Maximum number of lines (defaults to 2).
  • softWrap: Whether the text should break at soft line breaks (defaults to true).
  • fontSize: Font size. Defaults to Utils.appFontFamily.textSize16.
  • height: Line height multiplier (defaults to 1).
  • fontWeight: Font weight. Defaults to FontWeight.w500.
  • fontFamily: Font family. Defaults to Utils.appFontFamily.interSemiBoldFontFamily.
  • textAlign: Text alignment. Defaults to TextAlign.left.
  • color: Text color (defaults to grey).

Returns a Text widget with the specified styling.

Example:

showHeading(
  name: 'Section Title',
  fontSize: 18,
  fontWeight: FontWeight.bold,
  color: Colors.black,
);

Implementation

Widget showHeading(
    {required String name,
    int maxLines = 2,
    bool softWrap = true,
    double? fontSize,
    double height = 1,
    FontWeight? fontWeight,
    String? fontFamily,
    TextAlign? textAlign,
    Color color = Colors.grey}) {
  return Text(
    name,
    softWrap: softWrap,
    maxLines: maxLines,
    style: TextStyle(
      fontSize: fontSize ?? Utils.appFontFamily.textSize16,
      color: color,
      fontWeight: fontWeight ?? FontWeight.w500,
      height: height,
      fontFamily: fontFamily ?? Utils.appFontFamily.interSemiBoldFontFamily,
    ),
    textAlign: textAlign ?? TextAlign.left,
  );
}