ParagraphStyle constructor

ParagraphStyle({TextAlign textAlign, TextDirection textDirection, FontWeight fontWeight, FontStyle fontStyle, int maxLines, String fontFamily, double fontSize, double lineHeight, String ellipsis, 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.

  • 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.

  • 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).

  • 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 to use when painting the text (e.g., Roboto).

  • fontSize: The size of glyphs (in logical pixels) to use when painting the text.

  • lineHeight: The minimum height of the line boxes, as a multiple of the font size.

  • 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.

Implementation

//   See: https://github.com/flutter/flutter/issues/9819
///
/// * `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.
///
/// * `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).
///
/// * `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 to use when painting the text (e.g.,
///   Roboto).
///
/// * `fontSize`: The size of glyphs (in logical pixels) to use when painting
///   the text.
///
/// * `lineHeight`: The minimum height of the line boxes, as a multiple of the
///   font size.
///
/// * `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.
ParagraphStyle({
  TextAlign textAlign,
  TextDirection textDirection,
  FontWeight fontWeight,
  FontStyle fontStyle,
  int maxLines,
  String fontFamily,
  double fontSize,
  double lineHeight,
  String ellipsis,
  Locale locale,
}) : _encoded = _encodeParagraphStyle(
       textAlign,
       textDirection,
       fontWeight,
       fontStyle,
       maxLines,
       fontFamily,
       fontSize,
       lineHeight,
       ellipsis,
       locale,
     ),
     _fontFamily = fontFamily,
     _fontSize = fontSize,
     _lineHeight = lineHeight,
     _ellipsis = ellipsis,
     _locale = locale;