Esempio n. 1
0
 public HtmlOldParser(
     float?width                     = null,
     OnLinkTap onLinkTap             = null,
     bool renderNewlines             = false,
     CustomRender customRender       = null,
     float blockSpacing              = 0.0f,
     string html                     = null,
     ImageErrorListener onImageError = null,
     TextStyle linkStyle             = null,
     bool showImages                 = true
     )
 {
     D.assert(width != null);
     this.width          = width.Value;
     this.onLinkTap      = onLinkTap;
     this.renderNewlines = renderNewlines;
     this.customRender   = customRender;
     this.blockSpacing   = blockSpacing;
     this.html           = html;
     this.onImageError   = onImageError;
     this.linkStyle      = linkStyle;
     this.showImages     = showImages;
     this.linkStyle      = linkStyle ?? new TextStyle(
         decoration: TextDecoration.underline,
         color: Colors.blueAccent,
         decorationColor: Colors.blueAccent);
 }
Esempio n. 2
0
 public HtmlView(
     Key key                           = null,
     string data                       = null,
     EdgeInsets padding                = null,
     Color backgroundColor             = null,
     TextStyle defaultTextStyle        = null,
     OnLinkTap onLinkTap               = null,
     bool renderNewlines               = false,
     CustomRender customRender         = null,
     CustomEdgeInsets customEdgeInsets = null,
     CustomTextStyle customTextStyle   = null,
     CustomTextAlign customTextAlign   = null,
     float blockSpacing                = 14.0f,
     bool useRichText                  = true,
     ImageErrorListener onImageError   = null,
     TextStyle linkStyle               = null,
     bool shrinkToFit                  = false,
     ImageProperties imageProperties   = null,
     OnImageTap onImageTap             = null,
     bool showImages                   = true
     ) : base(key: key)
 {
     D.assert(data != null);
     this.data             = data;
     this.padding          = padding;
     this.backgroundColor  = backgroundColor;
     this.defaultTextStyle = defaultTextStyle;
     this.onLinkTap        = onLinkTap;
     this.renderNewlines   = renderNewlines;
     this.customRender     = customRender;
     this.customEdgeInsets = customEdgeInsets;
     this.customTextStyle  = customTextStyle ?? this._customTextStyle;
     this.customTextAlign  = customTextAlign;
     this.blockSpacing     = blockSpacing;
     this.useRichText      = useRichText;
     this.onImageError     = onImageError;
     this.linkStyle        = linkStyle ?? new TextStyle(
         decoration: TextDecoration.underline,
         color: Colors.blueAccent,
         decorationColor: Colors.blueAccent);
     this.shrinkToFit     = shrinkToFit;
     this.imageProperties = imageProperties;
     this.onImageTap      = onImageTap;
     this.showImages      = showImages;
 }
Esempio n. 3
0
        /// <summary>
        /// Zeichnen des buttons
        /// </summary>
        public override void OnRender()
        {
            if (Selected)
            {
                var2         = 0.2f;
                prevSelected = true;
            }
            else if (prevSelected)
            {
                var2         = 0f;
                prevSelected = false;
            }
            //übergang der fabe
            int r = CurrentColor.R + (int)((BackColor.R - CurrentColor.R) * StateManager.delta * 5);
            int g = CurrentColor.G + (int)((BackColor.G - CurrentColor.G) * StateManager.delta * 5);
            int b = CurrentColor.B + (int)((BackColor.B - CurrentColor.B) * StateManager.delta * 5);

            r            = Math.Abs(r % 256);
            g            = Math.Abs(g % 256);
            b            = Math.Abs(b % 256);
            CurrentColor = Color.FromArgb(r, g, b);

            if (CustomRender == null)
            {
                var1 += (var2 - var1) * StateManager.delta * 10;
                r     = CurrentColor.R - (int)(CurrentColor.R * (0.3f + var1));
                g     = CurrentColor.G - (int)(CurrentColor.G * (0.3f + var1));
                b     = CurrentColor.B - (int)(CurrentColor.B * (0.3f + var1));
                r     = Math.Abs(r % 256);
                g     = Math.Abs(g % 256);
                b     = Math.Abs(b % 256);
                StateManager.SetColor(0, 0, 0, 50);
                StateManager.FillRoundRect(Location, Size + new Vector(2, 2), 10);
                StateManager.FillGradientRoundRect(Location, Size, CurrentColor, Color.FromArgb(r, g, b), 90, 10);
                StateManager.SetColor(FontColor);
                StateManager.SetFont(FontUtils.DEFAULT_FONT);
                StateManager.DrawCenteredString(Name, Location + Size / 2);
            }
            else
            {
                CustomRender.Invoke();
            }
        }