getParagraphStyle method

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

The style information for paragraphs, encoded for use by dart:ui.

The textScaleFactor argument must not be null. If omitted, it defaults to 1.0. The other arguments may be null. The maxLines argument, if specified and non-null, must be greater than zero.

If the font size on this style isn't set, it will default to 14 logical pixels.


ui.ParagraphStyle getParagraphStyle({
  TextAlign textAlign,
  TextDirection textDirection,
  double textScaleFactor = 1.0,
  String ellipsis,
  int maxLines,
  ui.TextHeightBehavior textHeightBehavior,
  Locale locale,
  String fontFamily,
  double fontSize,
  FontWeight fontWeight,
  FontStyle fontStyle,
  double height,
  StrutStyle strutStyle,
}) {
  assert(textScaleFactor != null);
  assert(maxLines == null || maxLines > 0);
  return ui.ParagraphStyle(
    textAlign: textAlign,
    textDirection: textDirection,
    // Here, we stablish the contents of this TextStyle as the paragraph's default font
    // unless an override is passed in.
    fontWeight: fontWeight ?? this.fontWeight,
    fontStyle: fontStyle ?? this.fontStyle,
    fontFamily: fontFamily ?? this.fontFamily,
    fontSize: (fontSize ?? this.fontSize ?? _defaultFontSize) * textScaleFactor,
    height: height ?? this.height,
    textHeightBehavior: textHeightBehavior,
    strutStyle: strutStyle == null ? null : ui.StrutStyle(
      fontFamily: strutStyle.fontFamily,
      fontFamilyFallback: strutStyle.fontFamilyFallback,
      fontSize: strutStyle.fontSize == null ? null : strutStyle.fontSize * textScaleFactor,
      height: strutStyle.height,
      leading: strutStyle.leading,
      fontWeight: strutStyle.fontWeight,
      fontStyle: strutStyle.fontStyle,
      forceStrutHeight: strutStyle.forceStrutHeight,
    maxLines: maxLines,
    ellipsis: ellipsis,
    locale: locale,