Example #1
0
 Text(TextSpan textSpan,
      Key key                                  = null,
      TextStyle style                          = null,
      StrutStyle strutStyle                    = null,
      TextAlign?textAlign                      = null,
      bool?softWrap                            = null,
      TextOverflow?overflow                    = null,
      float?textScaleFactor                    = null,
      int?maxLines                             = null,
      TextWidthBasis textWidthBasis            = default,
      ui.TextHeightBehavior textHeightBehavior = null) : base(key)
 {
     D.assert(textSpan != null, () => "A non-null TextSpan must be provided to a Text.rich widget.");
     this.textSpan           = textSpan;
     data                    = null;
     this.style              = style;
     this.strutStyle         = strutStyle;
     this.textAlign          = textAlign;
     this.softWrap           = softWrap;
     this.overflow           = overflow;
     this.textScaleFactor    = textScaleFactor;
     this.maxLines           = maxLines;
     this.textHeightBehavior = textHeightBehavior;
     this.textWidthBasis     = textWidthBasis;
 }
Example #2
0
 public Text(string data,
             Key key                                  = null,
             TextStyle style                          = null,
             StrutStyle strutStyle                    = null,
             TextAlign?textAlign                      = null,
             bool?softWrap                            = null,
             TextOverflow?overflow                    = null,
             float?textScaleFactor                    = null,
             int?maxLines                             = null,
             TextWidthBasis textWidthBasis            = TextWidthBasis.parent,
             ui.TextHeightBehavior textHeightBehavior = null) : base(key)
 {
     D.assert(data != null, () => "A non-null string must be provided to a Text widget.");
     textSpan                = null;
     this.data               = data;
     this.style              = style;
     this.strutStyle         = strutStyle;
     this.textAlign          = textAlign;
     this.softWrap           = softWrap;
     this.overflow           = overflow;
     this.textScaleFactor    = textScaleFactor;
     this.maxLines           = maxLines;
     this.textWidthBasis     = textWidthBasis;
     this.textHeightBehavior = textHeightBehavior;
 }
Example #3
0
        public DefaultTextStyle(
            Widget child,
            TextStyle style,
            Key key                                  = null,
            TextAlign?textAlign                      = null,
            bool softWrap                            = true,
            TextOverflow overflow                    = TextOverflow.clip,
            int?maxLines                             = null,
            TextWidthBasis textWidthBasis            = TextWidthBasis.parent,
            ui.TextHeightBehavior textHeightBehavior = null

            ) : base(key: key, child: child)
        {
            D.assert(style != null);
            D.assert(maxLines == null || maxLines > 0);
            D.assert(child != null);

            this.style              = style;
            this.textAlign          = textAlign;
            this.softWrap           = softWrap;
            this.overflow           = overflow;
            this.maxLines           = maxLines;
            this.textWidthBasis     = textWidthBasis;
            this.textHeightBehavior = textHeightBehavior;
        }
Example #4
0
        public AnimatedDefaultTextStyle(
            Key key                                  = null,
            Widget child                             = null,
            TextStyle style                          = null,
            TextAlign?textAlign                      = null,
            bool softWrap                            = true,
            TextOverflow?overflow                    = null,
            int?maxLines                             = null,
            TextWidthBasis textWidthBasis            = TextWidthBasis.parent,
            ui.TextHeightBehavior textHeightBehavior = null,
            Curve curve                              = null,
            TimeSpan?duration                        = null,
            VoidCallback onEnd                       = null
            ) : base(key: key, curve: curve ?? Curves.linear, duration: duration, onEnd: onEnd)
        {
            overflow = overflow ?? TextOverflow.clip;
            D.assert(duration != null);
            D.assert(style != null);
            D.assert(child != null);
            D.assert(overflow != null);
            D.assert(maxLines == null || maxLines > 0);

            this.child              = child;
            this.style              = style;
            this.textAlign          = textAlign;
            this.softWrap           = softWrap;
            this.overflow           = overflow.Value;
            this.maxLines           = maxLines;
            this.textHeightBehavior = textHeightBehavior;
            this.textWidthBasis     = textWidthBasis;
        }
Example #5
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;
 }
Example #6
0
 public RenderParagraph(
     InlineSpan text             = null,
     TextAlign textAlign         = TextAlign.start,
     TextDirection textDirection = TextDirection.ltr,
     bool softWrap                            = true,
     TextOverflow overflow                    = TextOverflow.clip,
     float textScaleFactor                    = 1.0f,
     int?maxLines                             = null,
     Locale locale                            = null,
     StrutStyle strutStyle                    = null,
     TextWidthBasis textWidthBasis            = TextWidthBasis.parent,
     ui.TextHeightBehavior textHeightBehavior = null,
     List <RenderBox> children                = null
     )
 {
     D.assert(maxLines == null || maxLines > 0);
     D.assert(text != null);
     D.assert(text.debugAssertIsValid());
     D.assert(maxLines == null || maxLines > 0);
     _softWrap    = softWrap;
     _overflow    = overflow;
     _textPainter = new TextPainter(
         text: text,
         textAlign: textAlign,
         textDirection: textDirection,
         textScaleFactor: textScaleFactor,
         maxLines: maxLines,
         ellipsis: overflow == TextOverflow.ellipsis ? _kEllipsis : null,
         locale: locale,
         strutStyle: strutStyle,
         textWidthBasis: textWidthBasis,
         textHeightBehavior: textHeightBehavior
         );
     addAll(children);
     _extractPlaceholderSpans(text);
 }