getParagraphStyle method

ParagraphStyle getParagraphStyle ({TextAlign textAlign, TextDirection textDirection, double textScaleFactor: 1.0, String ellipsis, int maxLines, Locale locale, String fontFamily, double fontSize, FontWeight fontWeight, FontStyle fontStyle, double height, 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.

Implementation

ui.ParagraphStyle getParagraphStyle({
  TextAlign textAlign,
  TextDirection textDirection,
  double textScaleFactor = 1.0,
  String ellipsis,
  int maxLines,
  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,
    strutStyle: strutStyle == null ? null : ui.StrutStyle(
      fontFamily: strutStyle.fontFamily,
      fontFamilyFallback: strutStyle.fontFamilyFallback,
      fontSize: strutStyle.fontSize,
      height: strutStyle.height,
      leading: strutStyle.leading,
      fontWeight: strutStyle.fontWeight,
      fontStyle: strutStyle.fontStyle,
      forceStrutHeight: strutStyle.forceStrutHeight,
    ),
    maxLines: maxLines,
    ellipsis: ellipsis,
    locale: locale,
  );
}