Esempio n. 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;
 }
Esempio n. 2
0
 public static Widget merge(
     Widget child,
     Key key                                  = null,
     TextStyle style                          = null,
     TextAlign?textAlign                      = null,
     bool?softWrap                            = null,
     TextOverflow?overflow                    = null,
     int?maxLines                             = null,
     TextWidthBasis?textWidthBasis            = null,
     ui.TextHeightBehavior textHeightBehavior = null
     )
 {
     D.assert(child != null);
     return(new Builder(
                builder: (BuildContext context) => {
         DefaultTextStyle parent = DefaultTextStyle.of(context);
         return new DefaultTextStyle(
             key: key,
             style: parent.style.merge(style),
             textAlign: textAlign ?? parent.textAlign,
             softWrap: softWrap ?? parent.softWrap,
             overflow: overflow ?? parent.overflow,
             maxLines: maxLines ?? parent.maxLines,
             textWidthBasis: textWidthBasis ?? parent.textWidthBasis,
             child: child
             );
     }
                ));
 }
Esempio n. 3
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;
        }
Esempio n. 4
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;
 }
Esempio n. 5
0
 public static SelectableText rich(TextSpan textSpan,
                                   Key key                              = null,
                                   TextStyle style                      = null,
                                   TextAlign?textAlign                  = null,
                                   bool?softWrap                        = null,
                                   TextOverflow?overflow                = null,
                                   float?textScaleFactor                = null,
                                   int?maxLines                         = null,
                                   FocusNode focusNode                  = null,
                                   Color selectionColor                 = null,
                                   GestureTapDownCallback onTapDown     = null,
                                   GestureTapUpCallback onTapUp         = null,
                                   GestureTapCancelCallback onTapCancel = null)
 {
     return(new SelectableText(
                textSpan, key,
                style,
                textAlign,
                softWrap,
                overflow,
                textScaleFactor,
                maxLines,
                focusNode,
                selectionColor,
                onTapDown,
                onTapUp,
                onTapCancel));
 }
Esempio n. 6
0
 public SelectableText(TextSpan textSpan,
                       Key key                              = null,
                       TextStyle style                      = null,
                       TextAlign?textAlign                  = null,
                       bool?softWrap                        = null,
                       TextOverflow?overflow                = null,
                       float?textScaleFactor                = null,
                       int?maxLines                         = null,
                       FocusNode focusNode                  = null,
                       Color selectionColor                 = null,
                       GestureTapDownCallback onTapDown     = null,
                       GestureTapUpCallback onTapUp         = null,
                       GestureTapCancelCallback onTapCancel = null) : base(key)
 {
     D.assert(textSpan != null);
     this.textSpan        = textSpan;
     this.data            = null;
     this.style           = style;
     this.textAlign       = textAlign;
     this.softWrap        = softWrap;
     this.overflow        = overflow;
     this.textScaleFactor = textScaleFactor;
     this.maxLines        = maxLines;
     this.focusNode       = focusNode ?? new FocusNode();
     this.selectionColor  = selectionColor;
     this.onTapDown       = onTapDown;
     this.onTapUp         = onTapUp;
     this.onTapCancel     = onTapCancel;
 }
Esempio n. 7
0
 public static Text rich(TextSpan textSpan,
                         Key key                = null,
                         TextStyle style        = null,
                         TextAlign?textAlign    = null,
                         bool?softWrap          = null,
                         TextOverflow?overflow  = null,
                         double?textScaleFactor = null,
                         int?maxLines           = null)
 {
     return(new Text(
                textSpan, key,
                style,
                textAlign,
                softWrap,
                overflow,
                textScaleFactor,
                maxLines));
 }
Esempio n. 8
0
 Text(TextSpan textSpan,
      Key key                = null,
      TextStyle style        = null,
      TextAlign?textAlign    = null,
      bool?softWrap          = null,
      TextOverflow?overflow  = null,
      double?textScaleFactor = null,
      int?maxLines           = null) : base(key)
 {
     D.assert(textSpan != null);
     this.textSpan        = textSpan;
     this.data            = null;
     this.style           = style;
     this.textAlign       = textAlign;
     this.softWrap        = softWrap;
     this.overflow        = overflow;
     this.textScaleFactor = textScaleFactor;
     this.maxLines        = maxLines;
 }
Esempio n. 9
0
 public Text(string data,
             Key key               = null,
             TextStyle style       = null,
             TextAlign?textAlign   = null,
             bool?softWrap         = null,
             TextOverflow?overflow = null,
             float?textScaleFactor = null,
             int?maxLines          = null) : base(key)
 {
     D.assert(data != null);
     this.textSpan        = null;
     this.data            = data;
     this.style           = style;
     this.textAlign       = textAlign;
     this.softWrap        = softWrap;
     this.overflow        = overflow;
     this.textScaleFactor = textScaleFactor;
     this.maxLines        = maxLines;
 }
Esempio n. 10
0
 public SelectableWealthyText(List <TextSpan> textSpanList,
                              Key key               = null,
                              TextStyle style       = null,
                              TextAlign?textAlign   = null,
                              bool?softWrap         = null,
                              TextOverflow?overflow = null,
                              float?textScaleFactor = null,
                              int?maxLines          = null,
                              FocusNode focusNode   = null,
                              Color selectionColor  = null) : base(key)
 {
     this.textSpanList    = textSpanList;
     this.data            = null;
     this.style           = style;
     this.textAlign       = textAlign;
     this.softWrap        = softWrap;
     this.overflow        = overflow;
     this.textScaleFactor = textScaleFactor;
     this.maxLines        = maxLines;
     this.focusNode       = focusNode ?? new FocusNode();
     this.selectionColor  = selectionColor;
 }
Esempio n. 11
0
 public AnimatedDefaultTextStyle(
     Key key               = null,
     Widget child          = null,
     TextStyle style       = null,
     TextAlign?textAlign   = null,
     bool softWrap         = true,
     TextOverflow?overflow = null,
     int?maxLines          = null,
     Curve curve           = null,
     TimeSpan?duration     = null
     ) : base(key: key, curve: curve ?? Curves.linear, duration: duration)
 {
     D.assert(duration != null);
     D.assert(style != null);
     D.assert(child != null);
     D.assert(maxLines == null || maxLines > 0);
     this.child     = child;
     this.style     = style;
     this.textAlign = textAlign;
     this.softWrap  = softWrap;
     this.overflow  = overflow ?? TextOverflow.clip;
     this.maxLines  = maxLines;
 }
Esempio n. 12
0
 public SelectableText(string data,
                       Key key               = null,
                       TextStyle style       = null,
                       TextAlign?textAlign   = null,
                       bool?softWrap         = null,
                       TextOverflow?overflow = null,
                       float?textScaleFactor = null,
                       int?maxLines          = null,
                       FocusNode focusNode   = null,
                       Color selectionColor  = null) : base(key)
 {
     D.assert(data != null);
     this.textSpan        = null;
     this.data            = data;
     this.style           = style;
     this.textAlign       = textAlign;
     this.softWrap        = softWrap;
     this.overflow        = overflow;
     this.textScaleFactor = textScaleFactor;
     this.maxLines        = maxLines;
     this.focusNode       = focusNode ?? new FocusNode();
     this.selectionColor  = selectionColor;
 }
Esempio n. 13
0
 public static Widget merge(
     Key key               = null,
     TextStyle style       = null,
     TextAlign?textAlign   = null,
     bool?softWrap         = null,
     TextOverflow?overflow = null,
     int?maxLines          = null,
     Widget child          = null
     )
 {
     D.assert(child != null);
     return(new Builder(builder: (context => {
         var parent = of(context);
         return new DefaultTextStyle(
             key: key,
             style: parent.style.merge(style),
             textAlign: textAlign ?? parent.textAlign,
             softWrap: softWrap ?? parent.softWrap,
             overflow: overflow ?? parent.overflow,
             maxLines: maxLines ?? parent.maxLines,
             child: child
             );
     })));
 }
Esempio n. 14
0
 public WealthyText(
     List <TextSpan> textSpanList,
     Key key                   = null,
     TextStyle style           = null,
     TextAlign?textAlign       = TextAlign.left,
     bool?softWrap             = true,
     TextOverflow?overflow     = TextOverflow.clip,
     float?textScaleFactor     = 1.0f,
     int?maxLines              = null,
     Action onSelectionChanged = null,
     Color selectionColor      = null) :
     base(string.Empty,
          key,
          style,
          textAlign: textAlign,
          softWrap: softWrap,
          overflow: overflow,
          textScaleFactor: textScaleFactor,
          maxLines: maxLines)
 {
     _textSpanList       = textSpanList;
     _onSelectionChanged = onSelectionChanged;
     _selectionColor     = selectionColor;
 }