buildHeading function

Row buildHeading({
  1. required String text,
  2. required double fontSize,
  3. FontWeight? fontWeight,
  4. Color? color,
  5. double? padding,
})

Build a heading widget with customisable style.

Arguments:

  • text - The text to display.
  • fontSize - The font size.
  • fontWeight - The font weight (optional).
  • color - The text colour (optional).
  • padding - The padding around the text (optional).

Implementation

Row buildHeading({
  required String text,
  required double fontSize,
  FontWeight? fontWeight,
  Color? color,
  double? padding,
}) {
  return Row(
    crossAxisAlignment: CrossAxisAlignment.start,
    children: [
      Flexible(
        child: Padding(
          padding: padding == null ? EdgeInsets.zero : EdgeInsets.all(padding),
          child: Text(
            text,
            style: TextStyle(
              fontSize: fontSize,
              fontWeight: fontWeight ?? FontWeight.normal,
              color: color ?? Colors.black,
            ),
          ),
        ),
      ),
    ],
  );
}