ParagraphStyle constructor

  1. {TextAlign? textAlign,
  2. TextDirection? textDirection,
  3. int? maxLines,
  4. String? fontFamily,
  5. double? fontSize,
  6. double? height,
  7. TextHeightBehavior? textHeightBehavior,
  8. FontWeight? fontWeight,
  9. FontStyle? fontStyle,
  10. StrutStyle? strutStyle,
  11. String? ellipsis,
  12. Locale? locale}

Creates a new ParagraphStyle object.

  • textAlign: The alignment of the text within the lines of the paragraph. If the last line is ellipsized (see ellipsis below), the alignment is applied to that line after it has been truncated but before the ellipsis has been added. See:

  • textDirection: The directionality of the text, left-to-right (e.g. Norwegian) or right-to-left (e.g. Hebrew). This controls the overall directionality of the paragraph, as well as the meaning of TextAlign.start and TextAlign.end in the textAlign field.

  • maxLines: The maximum number of lines painted. Lines beyond this number are silently dropped. For example, if maxLines is 1, then only one line is rendered. If maxLines is null, but ellipsis is not null, then lines after the first one that overflows the width constraints are dropped. The width constraints are those set in the ParagraphConstraints object passed to the Paragraph.layout method.

  • fontFamily: The name of the font family to apply when painting the text, in the absence of a textStyle being attached to the span.

  • fontSize: The fallback size of glyphs (in logical pixels) to use when painting the text. This is used when there is no TextStyle.

  • height: The fallback height of the spans as a multiplier of the font size. The fallback height is used when no height is provided through TextStyle.height. Omitting height here and in TextStyle will allow the line height to take the height as defined by the font, which may not be exactly the height of the fontSize.

  • textHeightBehavior: Specifies how the height multiplier is applied to ascent of the first line and the descent of the last line.

  • leadingDistribution: Specifies how the extra vertical space added by the height multiplier should be distributed over and under the text. Defaults to TextLeadingDistribution.proportional.

  • fontWeight: The typeface thickness to use when painting the text (e.g., bold).

  • fontStyle: The typeface variant to use when drawing the letters (e.g., italics).

  • strutStyle: The properties of the strut. Strut defines a set of minimum vertical line height related metrics and can be used to obtain more advanced line spacing behavior.

  • ellipsis: String used to ellipsize overflowing text. If maxLines is not null, then the ellipsis, if any, is applied to the last rendered line, if that line overflows the width constraints. If maxLines is null, then the ellipsis is applied to the first line that overflows the width constraints, and subsequent lines are dropped. The width constraints are those set in the ParagraphConstraints object passed to the Paragraph.layout method. The empty string and the null value are considered equivalent and turn off this behavior.

  • locale: The locale used to select region-specific glyphs.


  TextAlign? textAlign,
  TextDirection? textDirection,
  int? maxLines,
  String? fontFamily,
  double? fontSize,
  double? height,
  TextHeightBehavior? textHeightBehavior,
  FontWeight? fontWeight,
  FontStyle? fontStyle,
  StrutStyle? strutStyle,
  String? ellipsis,
  Locale? locale,
}) : _encoded = _encodeParagraphStyle(
     _fontFamily = fontFamily,
     _fontSize = fontSize,
     _height = height,
     _strutStyle = strutStyle,
     _ellipsis = ellipsis,
     _locale = locale,
     _leadingDistribution = textHeightBehavior?.leadingDistribution ?? TextLeadingDistribution.proportional;