예제 #1
0
 public ParagraphStyle getParagraphStyle(
     TextAlign?textAlign         = null,
     TextDirection?textDirection = null,
     float?textScaleFactor       = 1.0f,
     string ellipsis             = null,
     int?maxLines = null,
     TextHeightBehavior textHeightBehavior = null,
     Locale locale         = null,
     string fontFamily     = null,
     float?fontSize        = null,
     FontWeight fontWeight = null,
     FontStyle?fontStyle   = null,
     float?height          = null,
     StrutStyle strutStyle = null
     )
 {
     D.assert(textScaleFactor != null);
     D.assert(maxLines == null || maxLines > 0);
     return(new ParagraphStyle(
                textAlign: textAlign,
                textDirection ?? TextDirection.ltr,
                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
             : new ui.StrutStyle(
                    fontFamily: strutStyle.fontFamily,
                    fontFamilyFallback: strutStyle.fontFamilyFallback,
                    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
                ));
 }
예제 #2
0
 public TextPainter(InlineSpan text             = null,
                    TextAlign textAlign         = TextAlign.left,
                    TextDirection textDirection = TextDirection.ltr,
                    float textScaleFactor       = 1.0f,
                    int?maxLines                          = null,
                    string ellipsis                       = null,
                    Locale locale                         = null,
                    StrutStyle strutStyle                 = null,
                    TextWidthBasis textWidthBasis         = TextWidthBasis.parent,
                    TextHeightBehavior textHeightBehavior = null)
 {
     D.assert(text == null || text.debugAssertIsValid());
     D.assert(maxLines == null || maxLines > 0);
     _text               = text;
     _textAlign          = textAlign;
     _textDirection      = textDirection;
     _textScaleFactor    = textScaleFactor;
     _maxLines           = maxLines;
     _ellipsis           = ellipsis;
     _locale             = locale;
     _strutStyle         = strutStyle;
     _textWidthBasis     = textWidthBasis;
     _textHeightBehavior = textHeightBehavior;
 }