コード例 #1
0
        public RenderParagraph(TextSpan text,
                               TextAlign textAlign         = TextAlign.left,
                               TextDirection textDirection = TextDirection.ltr,
                               bool softWrap             = true,
                               TextOverflow overflow     = TextOverflow.clip,
                               float textScaleFactor     = 1.0f,
                               int?maxLines              = null,
                               Action onSelectionChanged = null,
                               Color selectionColor      = null
                               )
        {
            D.assert(maxLines == null || maxLines > 0);
            this._softWrap    = softWrap;
            this._overflow    = overflow;
            this._textPainter = new TextPainter(
                text,
                textAlign,
                textDirection,
                textScaleFactor,
                maxLines,
                overflow == TextOverflow.ellipsis ? _kEllipsis : ""
                );

            this._selection         = null;
            this.onSelectionChanged = onSelectionChanged;
            this.selectionColor     = selectionColor;

            this._resetHoverHandler();
        }
コード例 #2
0
        public void PaintPrintPageImage(IPainter painter, int page, Size pageSize, Rectangle margins, string appInfo, string fileInfo)
        {
            var lineWidth = Math.Max((int)(PixelsPerMm / 4m), 1);

            painter.FillRectangle(margins.Left, margins.Top, margins.Width, margins.Height, WhiteColorArgb);

            using (painter.TranslateCoordinates(new Size(margins.Left, margins.Top)))
            {
                if (page < PagesCount - PrintPalettePagesCount)
                {
                    PaintSchemePage(painter, page, new Size(margins.Width, margins.Height), new Rectangle(0, 0, margins.Width, margins.Height), lineWidth);
                }
                else
                {
                    PaintPalettePage(painter, page, lineWidth, margins);
                }
            }

            var infoY       = margins.BottomExclusive + (int)(CellSizeMm / 2);
            var textSize    = (int)(PixelsPerMm * 3);
            var textPainter = new TextPainter(GridPainter.SymbolsFont, (int)(PixelsPerMm * 3));

            painter.PaintText(appInfo, new Point(margins.Left, infoY), textSize, spaceBetweenCharacters: lineWidth);

            var fileInfoWidth = textPainter.GetTextSize(fileInfo, spaceBetweenCharacters: lineWidth).Width;

            painter.PaintText(fileInfo, new Point(margins.RightExclusive - fileInfoWidth, infoY), textSize, spaceBetweenCharacters: lineWidth);

            var pageNo      = String.Format(Resources.PrintPageNo, page + 1, PagesCount);
            var pageNoWidth = textPainter.GetTextSize(pageNo, spaceBetweenCharacters: lineWidth).Width;

            painter.PaintText(pageNo, new Point(margins.Left + (margins.Width - pageNoWidth) / 2, infoY), textSize, spaceBetweenCharacters: lineWidth);
        }
コード例 #3
0
ファイル: editable.cs プロジェクト: wxFancer/UIWidgets
        public RenderEditable(TextSpan text, TextDirection textDirection, ViewportOffset offset,
                              ValueNotifier <bool> showCursor,
                              TextAlign textAlign                = TextAlign.left, double textScaleFactor = 1.0, Color cursorColor = null,
                              bool?hasFocus                      = null, int?maxLines = 1, Color selectionColor = null,
                              TextSelection selection            = null, bool obscureText = false, SelectionChangedHandler onSelectionChanged = null,
                              CaretChangedHandler onCaretChanged = null, bool ignorePointer = false)
        {
            this._textPainter = new TextPainter(text: text, textAlign: textAlign, textDirection: textDirection,
                                                textScaleFactor: textScaleFactor);
            this._cursorColor       = cursorColor;
            this._showCursor        = showCursor ?? new ValueNotifier <bool>(false);
            this._hasFocus          = hasFocus ?? false;
            this._maxLines          = maxLines;
            this._selectionColor    = selectionColor;
            this._selection         = selection;
            this._obscureText       = obscureText;
            this._offset            = offset;
            this.ignorePointer      = ignorePointer;
            this.onCaretChanged     = onCaretChanged;
            this.onSelectionChanged = onSelectionChanged;

            D.assert(this._maxLines == null || this._maxLines > 0);
            D.assert(this._showCursor != null);
            D.assert(!this._showCursor.value || cursorColor != null);

            this._tap                   = new TapGestureRecognizer(this);
            this._doubleTap             = new DoubleTapGestureRecognizer(this);
            this._tap.onTapDown         = this._handleTapDown;
            this._tap.onTap             = this._handleTap;
            this._doubleTap.onDoubleTap = this._handleDoubleTap;
            this._longPress             = new LongPressGestureRecognizer(debugOwner: this);
            this._longPress.onLongPress = this._handleLongPress;
        }
コード例 #4
0
        public void Clip(IGradientMask mask, TContext context)
        {
            switch (mask)
            {
            case IEllipseMask ellipseMask:
                EllipsePainter.Clip(ellipseMask, context);
                break;

            case IRectangleMask rectangleMask:
                RectanglePainter.Clip(rectangleMask, context);
                break;

            case ITextMask textMask:
                TextPainter.Clip(textMask, context);
                break;

            case IPathMask pathMask:
                PathPainter.Clip(pathMask, context);
                break;

            case IMaskCollection maskCollection:
                ClipCollection(maskCollection, context);
                break;
            }
        }
コード例 #5
0
 protected override void Draw()
 {
     Canvas.SmoothingMode = SmoothingMode.HighQuality;
     this.Canvas.DrawImage(background, 8, 8, background.Width, background.Height);
     if (stone == null)
     {
         using (Font transFont = new Font("Tahoma", 11.0f, FontStyle.Bold, GraphicsUnit.Pixel))
         {
             TextPainter.DrawStringHalo(Canvas, versionInfo, transFont, 26, 80, background.Width - 16, 50, Color.White, true);
         }
         DrawTranslatorName();
         DrawDesignerName();
     }
     else
     {
         if (stoneIcon != null)
         {
             Canvas.DrawImage(stoneIcon, 24, 50, 64, 64);
         }
         DrawStoneName();
         using (Font transFont = new Font("Tahoma", 11.0f, FontStyle.Bold, GraphicsUnit.Pixel))
         {
             TextPainter.DrawStringHalo(Canvas, author, transFont, 96, 128, 400, 400, Color.White, false);
         }
         DrawVersionCopyright();
     }
     Canvas.SmoothingMode = SmoothingMode.AntiAlias;
     for (int cnt = 0; cnt < Children.Count; cnt++)
     {
         Children[cnt].Paint(Canvas);
     }
 }
コード例 #6
0
        private void DrawStoneName()
        {
            if (string.IsNullOrEmpty(description))
            {
                description = "Krento Stone";
            }

            using (Font aboutFont = new Font("Tahoma", 16.0f, FontStyle.Bold, GraphicsUnit.Pixel))
            {
                TextPainter.DrawString(Canvas, description, aboutFont, 96, 40, 400, 400, Color.White, false);
            }

            if (stone != null)
            {
                if (stone.StoneBuiltIn)
                {
                    using (Font descFont = new Font("Tahoma", 11.0f, FontStyle.Bold, GraphicsUnit.Pixel))
                    {
                        TextPainter.DrawString(Canvas, "Built In Krento Stone", descFont, 96, 70, 400, 400, Color.White, false);
                    }
                }
                else
                {
                    using (Font descFont = new Font("Tahoma", 11.0f, FontStyle.Bold, GraphicsUnit.Pixel))
                    {
                        TextPainter.DrawString(Canvas, "External Krento Stone", descFont, 96, 70, 400, 400, Color.White, false);
                    }
                }
            }
        }
コード例 #7
0
        public override void paint(
            PaintingContext context,
            Offset center,
            Animation <float> activationAnimation = null,
            Animation <float> enableAnimation     = null,
            bool?isDiscrete             = null,
            TextPainter labelPainter    = null,
            RenderBox parentBox         = null,
            SliderThemeData sliderTheme = null,
            float?value = null
            )
        {
            Canvas     canvas      = context.canvas;
            FloatTween radiusTween = new FloatTween(
                begin: 0.0f,
                end: this.overlayRadius
                );

            canvas.drawCircle(
                center,
                radiusTween.evaluate(activationAnimation),
                new Paint {
                color = sliderTheme.overlayColor
            }
                );
        }
コード例 #8
0
        public override void paint(
            PaintingContext context,
            Offset center,
            Animation <float> activationAnimation = null,
            Animation <float> enableAnimation     = null,
            bool?isDiscrete             = null,
            TextPainter labelPainter    = null,
            RenderBox parentBox         = null,
            SliderThemeData sliderTheme = null,
            float?value = null)
        {
            ColorTween enableColor = new ColorTween(
                begin: sliderTheme.disabledThumbColor,
                end: sliderTheme.valueIndicatorColor
                );

            this._drawValueIndicator(
                parentBox,
                context.canvas,
                center,
                new Paint {
                color = enableColor.evaluate(enableAnimation)
            },
                activationAnimation.value,
                labelPainter
                );
        }
コード例 #9
0
ファイル: AboutWindow.cs プロジェクト: bravesoftdz/krento
 private void DrawVersionCopyright()
 {
     using (Font transFont = new Font("Tahoma", 8.0f, FontStyle.Bold, GraphicsUnit.Point))
     {
         TextPainter.DrawString(Canvas, Version, transFont, 96, 154, 400, 400, Color.White, false);
         TextPainter.DrawString(Canvas, Copyright, transFont, 96, 240, 400, 400, Color.White, false);
     }
 }
コード例 #10
0
 TextPainter GetTextPainter(int pixelHeight)
 {
     if (cachedTextPainter == null || cachedTextPainter.Font != SymbolsFont || cachedTextPainter.PixelHeight != pixelHeight)
     {
         cachedTextPainter = new TextPainter(SymbolsFont, pixelHeight);
     }
     return(cachedTextPainter);
 }
コード例 #11
0
        public SplashWindow()
            : base()
        {
            Text = "Krento Splash Screen";
            if (!string.IsNullOrEmpty(GlobalSettings.SplashName))
            {
                if (FileOperations.FileExists(GlobalSettings.SplashName))
                {
                    background = FastBitmap.FromFile(FileOperations.StripFileName(GlobalSettings.SplashName));
                }
            }

            if (background == null)
            {
                background = NativeThemeManager.LoadBitmap("WindowKrentoSplash.png");
            }


            bmpHeight = background.Height;
            bmpWidth  = background.Width;

            this.Width  = background.Width + 16;
            this.Height = background.Height + 16;

            this.Alpha    = 240;
            this.ColorKey = ColorUtils.WhiteKey;

            StringBuilder sb = new StringBuilder("Version ");

            sb.Append(Application.ProductVersion);
#if PORTABLE
            sb.Append(" Portable");
#endif
            if (NativeMethods.IsNativeWin64())
            {
                sb.Append("  x64");
            }
            else
            {
                sb.Append("  x86");
            }

            versionInfo = sb.ToString();


            using (Graphics g = Graphics.FromImage(background))
            {
                using (Font versionFont = new Font("Tahoma", 11.0f, FontStyle.Bold, GraphicsUnit.Pixel))
                {
                    TextPainter.DrawStringHalo(g, versionInfo, versionFont, -16, 120, bmpWidth, 50, Color.White, true);
                }
            }


            this.Canvas.DrawImage(background, 8, 8, bmpWidth, bmpHeight);

            this.Update();
        }
コード例 #12
0
        private void CanvasView_PaintSurface(object sender, SKPaintSurfaceEventArgs e)
        {
            var canvas = e.Surface.Canvas;

            canvas.Clear(SKColors.CornflowerBlue);
            canvas.Translate(e.Info.Width / 2, e.Info.Height / 2);
            canvas.Scale(e.Info.Width / 210f);
            canvas.DrawCircle(0, 0, 100, blackFillPaint);
            var painter = new TextPainter {
                FontSize = 8, TextColor = SKColors.White
            };

            for (int i = 0; i < 60; i++)
            {
                // Dots
                canvas.Save();
                canvas.RotateDegrees(6 * i);
                canvas.DrawCircle(0, -90, i % 5 == 0 ? 4 : 2, whiteFillPaint);
                canvas.Restore();
                // Maths
                if (i % 5 == 0)
                {
                    painter.LaTeX = labels[i / 5];
                    if (!(painter.Measure(e.Info.Width) is { } measure))
                    {
                        throw new Structures.InvalidCodePathException("Invalid LaTeX");
                    }
                    var θ    = (90 - 6 * i) / 180f * PI;
                    var sinθ = (float)Sin(θ);
                    var cosθ = (float)Cos(θ);
                    painter.Draw(canvas,
                                 new System.Drawing.PointF(75 * cosθ - measure.Width / 2,
                                                           -75 * sinθ - measure.Height / 2),
                                 float.PositiveInfinity);
                }
            }
            var dateTime = DateTime.Now;

            // H
            canvas.Save();
            canvas.RotateDegrees(30 * dateTime.Hour + dateTime.Minute / 2f);
            whiteStrokePaint.StrokeWidth = 12;
            canvas.DrawLine(0, 0, 0, -50, whiteStrokePaint);
            canvas.Restore();
            // M
            canvas.Save();
            canvas.RotateDegrees(6 * dateTime.Minute + dateTime.Second / 10f);
            whiteStrokePaint.StrokeWidth = 6;
            canvas.DrawLine(0, 0, 0, -65, whiteStrokePaint);
            canvas.Restore();
            // S
            canvas.Save();
            canvas.RotateDegrees(6f * (dateTime.Second + dateTime.Millisecond / 1000f));
            redStrokePaint.StrokeWidth = 2;
            canvas.DrawLine(0, 0, 0, -75, redStrokePaint);
            canvas.Restore();
        }
コード例 #13
0
ファイル: ChattingWindow.cs プロジェクト: Luciano-0/2048-Demo
        public float CalculateMessageHeight(
            Models.Message message,
            bool showTime,
            float width)
        {
            var height = 0.0f;

            if (message.attachments.isNotEmpty())
            {
                var attachment  = message.attachments.first();
                var contentType = attachment.contentType;
                if (contentType == "image/png" ||
                    contentType == "image/jpg" ||
                    contentType == "image/jpeg" ||
                    contentType == "image/gif")
                {
                    height = 42 + 282 * attachment.height / attachment.width + (showTime ? 36 : 0);
                }
                else
                {
                    var textPainter = new TextPainter(
                        textDirection: TextDirection.ltr,
                        text: new TextSpan(
                            text: attachment.filename,
                            style: new TextStyle(
                                fontSize: 16,
                                fontFamily: "PingFang"
                                )
                            )
                        );
                    textPainter.layout(maxWidth: 172);
                    height = 86 + textPainter.getLineCount() * 22;
                    height = height.clamp(114, height);
                    if (showTime)
                    {
                        height += 36;
                    }
                }
            }
            else
            {
                height = 66 + (showTime ? 36 : 0); // Name + Internal + Bottom padding + time
                var textPainter = new TextPainter(
                    textDirection: TextDirection.ltr,
                    text: ParseMessage(
                        message.content ?? "此条消息已被删除",
                        widget.users
                        )
                    );
                textPainter.layout(maxWidth: width);
                height += textPainter.getLineCount() * 22;
                height += MessageEmbed.CalculateTextHeight(message, width);
            }

            return(height);
        }
コード例 #14
0
 public abstract void paint(
     PaintingContext context,
     Offset center,
     Animation <float> activationAnimation = null,
     Animation <float> enableAnimation     = null,
     bool?isDiscrete             = null,
     TextPainter labelPainter    = null,
     RenderBox parentBox         = null,
     SliderThemeData sliderTheme = null,
     float?value = null);
コード例 #15
0
 void _prepare()
 {
     this._paintShadow       = this._shadow.toPaint();
     this._paintBanner       = new Paint();
     this._paintBanner.color = this.color;
     this._textPainter       = new TextPainter(
         text: new TextSpan(style: this.textStyle, text: this.message),
         textAlign: TextAlign.center
         );
     this._prepared = true;
 }
コード例 #16
0
        private async void InitAll()
        {
            this.plotter = new Plotter(this);
            await plotter.Init();

            await plotter.PenUp();

            this.painter          = new Painter(plotter, this);
            this.textPainter      = new TextPainter(plotter, new FontEnRu(), 35, 70, 15);
            this.textPainterSmall = new TextPainter(plotter, new FontEnRu(), 22, 45, 5);
        }
コード例 #17
0
 void _prepare()
 {
     _paintShadow       = _shadow.toPaint();
     _paintBanner       = new Paint();
     _paintBanner.color = color;
     _textPainter       = new TextPainter(
         text: new TextSpan(style: textStyle, text: message),
         textAlign: TextAlign.center,
         textDirection: textDirection ?? TextDirection.ltr
         );
     _prepared = true;
 }
コード例 #18
0
        private void DrawTranslatorName()
        {
            if (string.IsNullOrEmpty(translator))
            {
                return;
            }

            using (Font transFont = new Font("Tahoma", 11.0f, FontStyle.Bold, GraphicsUnit.Pixel))
            {
                TextPainter.DrawStringHalo(Canvas, translator, transFont, 26, 110, background.Width - 16, 50, Color.White, true);
            }
        }
コード例 #19
0
        float _calculateTextHeight(string text, float textWidth, int?maxLines = null)
        {
            var textPainter = new TextPainter(
                new TextSpan(
                    text,
                    this._messageStyle
                    ),
                maxLines: maxLines
                );

            textPainter.layout(maxWidth: textWidth);
            return(textPainter.height);
        }
コード例 #20
0
ファイル: CustomInput.cs プロジェクト: U3DC/ConnectAppCN
        float _calculateTextHeight(string text, float textWidth)
        {
            var textPainter = new TextPainter(
                textDirection: TextDirection.ltr,
                text: new TextSpan(
                    text, this._inputFieldStyle
                    ),
                maxLines: 2
                );

            textPainter.layout(maxWidth: textWidth);

            return(textPainter.height);
        }
コード例 #21
0
        public static float CalculateTextHeight(string text, TextStyle textStyle, float textWidth, int?maxLines)
        {
            var textPainter = new TextPainter(
                textDirection: TextDirection.ltr,
                text: new TextSpan(
                    text: text,
                    style: textStyle
                    ),
                maxLines: maxLines
                );

            textPainter.layout(maxWidth: textWidth);
            return(textPainter.height);
        }
コード例 #22
0
ファイル: AboutWindow.cs プロジェクト: bravesoftdz/krento
        /// <summary>
        /// Draws the name of the toy.
        /// </summary>
        private void DrawToyName()
        {
            if (string.IsNullOrEmpty(AboutText))
            {
                AboutText = "Krento Toy";
            }

            using (Font aboutFont = new Font("Tahoma", 12.0f, FontStyle.Bold, GraphicsUnit.Point))
            {
                TextPainter.DrawString(Canvas, AboutText, aboutFont, 96, 40, 275, 400, Color.White, false);
            }

            using (Font descFont = new Font("Tahoma", 8.0f, FontStyle.Bold, GraphicsUnit.Point))
            {
                TextPainter.DrawString(Canvas, Description, descFont, 96, 70, 275, 120, Color.White, false, true);
            }
        }
コード例 #23
0
        public static float CalculateTextHeight(Unity.Messenger.Models.Message message, float width)
        {
            if (message == null || message.embeds.isEmpty())
            {
                return(0);
            }

            var innerWidth = width - 2 * 6;
            var embedData  = message.embeds[0].embedData;

            var textPainter = new TextPainter(
                textDirection: TextDirection.ltr,
                text: new TextSpan(
                    text: embedData.title,
                    style: _embedTitleStyle
                    )
                );

            textPainter.layout(maxWidth: innerWidth);
            var embedDataTitleHeight = textPainter.getLineCount() * 23;

            textPainter = new TextPainter(
                textDirection: TextDirection.ltr,
                text: new TextSpan(
                    text: embedData.description,
                    style: _embedDescriptionStyle
                    )
                );
            textPainter.layout(maxWidth: innerWidth);
            var embedDescriptionHeight = textPainter.getLineCount() * 23;

            float embedNameHeight;

            if (embedData.image.isEmpty() && embedData.name.isEmpty())
            {
                embedNameHeight = 0;
            }
            else
            {
                embedNameHeight = 23;
            }

            var descriptionHeight = embedDataTitleHeight + 4 + embedDescriptionHeight + 4 + embedNameHeight;

            return(descriptionHeight + 24);
        }
コード例 #24
0
        public override void paint(
            PaintingContext context,
            Offset center,
            Animation <float> activationAnimation = null,
            Animation <float> enableAnimation     = null,
            bool isDiscrete             = false,
            TextPainter labelPainter    = null,
            RenderBox parentBox         = null,
            SliderThemeData sliderTheme = null,
            TextDirection?textDirection = null,
            float?value = null)
        {
            Canvas     canvas      = context.canvas;
            ColorTween enableColor = new ColorTween(
                begin: sliderTheme.disabledThumbColor,
                end: sliderTheme.valueIndicatorColor
                );

            Tween <float> slideUpTween = new FloatTween(
                begin: 0.0f,
                end: _slideUpHeight
                );
            float  size          = _indicatorSize * sizeTween.evaluate(enableAnimation);
            Offset slideUpOffset = new Offset(0.0f, -slideUpTween.evaluate(activationAnimation));
            Path   thumbPath     = SliderDemoUtils._upTriangle(size, center + slideUpOffset);
            Color  paintColor    = enableColor.evaluate(enableAnimation)
                                   .withAlpha((255.0f * activationAnimation.value).round());

            canvas.drawPath(
                thumbPath,
                new Paint {
                color = paintColor
            }
                );
            canvas.drawLine(
                center,
                center + slideUpOffset,
                new Paint
            {
                color       = paintColor,
                style       = PaintingStyle.stroke,
                strokeWidth = 2.0f
            });
            labelPainter.paint(canvas,
                               center + slideUpOffset + new Offset(-labelPainter.width / 2.0f, -labelPainter.height - 4.0f));
        }
コード例 #25
0
        private void DrawDesignerName()
        {
            int y;

            if (string.IsNullOrEmpty(translator))
            {
                y = 110;
            }
            else
            {
                y = 130;
            }

            using (Font transFont = new Font("Tahoma", 11.0f, FontStyle.Bold, GraphicsUnit.Pixel))
            {
                TextPainter.DrawStringHalo(Canvas, "Design: Stan Ragets", transFont, 26, y, background.Width - 16, 50, Color.White, true);
            }
        }
コード例 #26
0
ファイル: CTextUtils.cs プロジェクト: lsw5530/ConnectAppCN
        public static Size CalculateTextSize(string text, TextStyle textStyle, float textWidth,
                                             int?maxLines = null)
        {
            if (text.isEmpty())
            {
                return(Size.zero);
            }

            var textPainter = new TextPainter(
                textDirection: TextDirection.ltr,
                text: new TextSpan(
                    text: text,
                    style: textStyle
                    ),
                maxLines: maxLines
                );

            textPainter.layout(maxWidth: textWidth);
            return(textPainter.size);
        }
コード例 #27
0
ファイル: paragraph.cs プロジェクト: zmtzawqlp/UIWidgets
 public RenderParagraph(TextSpan text,
                        TextAlign textAlign         = TextAlign.left,
                        TextDirection textDirection = TextDirection.ltr,
                        bool softWrap         = true,
                        TextOverflow overflow = TextOverflow.clip,
                        float textScaleFactor = 1.0f,
                        int?maxLines          = null
                        )
 {
     D.assert(maxLines == null || maxLines > 0);
     this._softWrap    = softWrap;
     this._overflow    = overflow;
     this._textPainter = new TextPainter(
         text,
         textAlign,
         textDirection,
         textScaleFactor,
         maxLines,
         overflow == TextOverflow.ellipsis ? _kEllipsis : ""
         );
 }
コード例 #28
0
        void _updateLabelPainter(Thumb thumb)
        {
            if (labels == null)
            {
                return;
            }

            string      text         = null;
            TextPainter labelPainter = null;

            switch (thumb)
            {
            case Thumb.start:
                text         = labels.start;
                labelPainter = _startLabelPainter;
                break;

            case Thumb.end:
                text         = labels.end;
                labelPainter = _endLabelPainter;
                break;
            }

            if (labels != null)
            {
                labelPainter.text = new TextSpan(
                    style: _sliderTheme.valueIndicatorTextStyle,
                    text: text
                    );
                labelPainter.textDirection   = textDirection;
                labelPainter.textScaleFactor = textScaleFactor;
                labelPainter.layout();
            }
            else
            {
                labelPainter.text = null;
            }

            markNeedsLayout();
        }
コード例 #29
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);
 }
コード例 #30
0
        public override void paint(
            PaintingContext context,
            Offset center,
            Animation <float> activationAnimation = null,
            Animation <float> enableAnimation     = null,
            bool isDiscrete             = false,
            TextPainter labelPainter    = null,
            RenderBox parentBox         = null,
            SliderThemeData sliderTheme = null,
            TextDirection?textDirection = null,
            float?value = null)
        {
            Canvas     canvas     = context.canvas;
            ColorTween colorTween = new ColorTween(
                begin: sliderTheme.disabledThumbColor,
                end: sliderTheme.thumbColor
                );
            float size      = _thumbSize * sizeTween.evaluate(enableAnimation);
            Path  thumbPath = SliderDemoUtils._downTriangle(size, center);

            canvas.drawPath(thumbPath, new Paint {
                color = colorTween.evaluate(enableAnimation)
            });
        }