예제 #1
0
 public override Widget build(BuildContext context)
 {
     return(new Align(
                alignment: Alignment.bottomCenter,
                heightFactor: 1.0f,
                child: new Container(
                    margin: EdgeInsets.only(
                        bottom: new FloatTween(
                            begin: 2.0f,
                            end: BottomNavigationBarUtils._kBottomMargin
                            ).evaluate(this.animation)
                        ),
                    child: new FadeTransition(
                        opacity: this.animation,
                        child: DefaultTextStyle.merge(
                            style: new TextStyle(
                                fontSize: BottomNavigationBarUtils._kActiveFontSize,
                                color: Colors.white
                                ),
                            child: this.item.title
                            )
                        )
                    )
                ));
 }
예제 #2
0
        public override Widget build(BuildContext context)
        {
            float t = new FloatTween(
                begin: BottomNavigationBarUtils._kInactiveFontSize / BottomNavigationBarUtils._kActiveFontSize,
                end: 1.0f
                ).evaluate(this.animation);

            return(new Align(
                       alignment: Alignment.bottomCenter,
                       heightFactor: 1.0f,
                       child: new Container(
                           margin: EdgeInsets.only(bottom: BottomNavigationBarUtils._kBottomMargin),
                           child: DefaultTextStyle.merge(
                               style: new TextStyle(
                                   fontSize: BottomNavigationBarUtils._kActiveFontSize,
                                   color: this.colorTween.evaluate(this.animation)
                                   ),
                               child: new Transform(
                                   transform: Matrix3.makeScale(t),
                                   alignment: Alignment.bottomCenter,
                                   child: this.item.title
                                   )
                               )
                           )
                       ));
        }
예제 #3
0
        Widget _buildFixedLabel()
        {
            float t = new FloatTween(
                begin: BottomNavigationBarUtils._kInactiveFontSize / BottomNavigationBarUtils._kActiveFontSize,
                end: 1.0f
                ).evaluate(this.animation);

            return(new Align(
                       alignment: Alignment.bottomCenter,
                       heightFactor: 1.0f,
                       child: new Container(
                           margin: EdgeInsets.only(bottom: BottomNavigationBarUtils._kBottomMargin),
                           child: DefaultTextStyle.merge(
                               style: new TextStyle(
                                   fontSize: BottomNavigationBarUtils._kActiveFontSize,
                                   color: this.colorTween.evaluate(this.animation)
                                   ),
//                        child: new Transform(
//                            transform: Matrix3.makeAll(t, 0, 0, 0, t, 0, 0, 0, t),
//                            alignment: Alignment.bottomCenter,
//                            child: this.item.title
//                        )
                               child: this.item.title
                               )
                           )
                       ));
        }
 Widget _createContainer(List <Widget> tiles)
 {
     return(DefaultTextStyle.merge(
                overflow: TextOverflow.ellipsis,
                child: new Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: tiles
                    )
                ));
 }
예제 #5
0
        public override Widget build(BuildContext context)
        {
            float selectedFontSize   = selectedLabelStyle.fontSize ?? 0;
            float unselectedFontSize = unselectedLabelStyle.fontSize ?? 0;

            TextStyle customStyle = TextStyle.lerp(
                unselectedLabelStyle,
                selectedLabelStyle,
                animation.value
                );
            float t = new FloatTween(begin: unselectedFontSize / selectedFontSize, end: 1.0f)
                      .evaluate(animation);
            Widget text = DefaultTextStyle.merge(
                style: customStyle.copyWith(
                    fontSize: selectedFontSize,
                    color: colorTween.evaluate(animation)
                    ),
                child: new Transform(
                    transform: Matrix4.diagonal3Values(t, t, t),
                    alignment: Alignment.bottomCenter,
                    child: item.title
                    )
                );

            if (!showUnselectedLabels && !showSelectedLabels)
            {
                text = new Opacity(
                    opacity: 0.0f,
                    child: text
                    );
            }
            else if (!showUnselectedLabels)
            {
                text = new FadeTransition(
                    opacity: animation,
                    child: text
                    );
            }
            else if (!showSelectedLabels)
            {
                text = new FadeTransition(
                    opacity: new FloatTween(begin: 1.0f, end: 0.0f).animate(animation),
                    child: text
                    );
            }

            return(new Align(
                       alignment: Alignment.bottomCenter,
                       heightFactor: 1.0f,
                       child: new Container(child: text)
                       ));
        }
        Widget _wrapActiveItem(BuildContext context, Widget item, bool active)
        {
            if (!active)
            {
                return(item);
            }

            Color activeColor = this.activeColor ?? CupertinoTheme.of(context).primaryColor;

            return(IconTheme.merge(
                       data: new IconThemeData(color: activeColor),
                       child: DefaultTextStyle.merge(
                           style: new TextStyle(color: activeColor),
                           child: item
                           )
                       ));
        }
        public override Widget build(BuildContext context)
        {
            float t = new FloatTween(begin: this.unselectedFontSize / this.selectedFontSize, end: 1.0f)
                      .evaluate(this.animation);
            Widget text = DefaultTextStyle.merge(
                style: new TextStyle(
                    fontSize: this.selectedFontSize,
                    color: this.colorTween.evaluate(this.animation)
                    ),
                child: new Transform(
                    transform: Matrix3.makeAll(t, 0, 0,
                                               0, t, 0,
                                               0, 0, 1),
                    alignment: Alignment.bottomCenter,
                    child: this.item.title
                    )
                );

            if (!this.showUnselectedLabels && !this.showSelectedLabels)
            {
                text = new Opacity(
                    opacity: 0.0f,
                    child: text
                    );
            }
            else if (!this.showUnselectedLabels)
            {
                text = new FadeTransition(
                    opacity: this.animation,
                    child: text
                    );
            }
            else if (!this.showSelectedLabels)
            {
                text = new FadeTransition(
                    opacity: new FloatTween(begin: 1.0f, end: 0.0f).animate(this.animation),
                    child: text
                    );
            }
            return(new Align(
                       alignment: Alignment.bottomCenter,
                       heightFactor: 1.0f,
                       child: new Container(child: text)
                       ));
        }
예제 #8
0
        public override Widget build(BuildContext context)
        {
            float?width = this.shrinkToFit ? (float?)null : MediaQuery.of(context).size.width;

            return(new Container(
                       padding: this.padding,
                       color: this.backgroundColor,
                       width: width,
                       child: DefaultTextStyle.merge(
                           style: this.defaultTextStyle ?? DefaultTextStyle.of(context).style,
                           child: (this.useRichText)
                        ? (Widget) new HtmlRichTextParser(
                               shrinkToFit: this.shrinkToFit,
                               onLinkTap: this.onLinkTap,
                               renderNewlines: this.renderNewlines,
                               customEdgeInsets: this.customEdgeInsets,
                               customTextStyle: this.customTextStyle,
                               customTextAlign: this.customTextAlign,
                               html: this.data,
                               onImageError: this.onImageError,
                               linkStyle: this.linkStyle,
                               imageProperties: this.imageProperties,
                               onImageTap: this.onImageTap,
                               showImages: this.showImages
                               )
                        : new HtmlOldParser(
                               width: width,
                               onLinkTap: this.onLinkTap,
                               renderNewlines: this.renderNewlines,
                               customRender: this.customRender,
                               html: this.data,
                               blockSpacing: this.blockSpacing,
                               onImageError: this.onImageError,
                               linkStyle: this.linkStyle,
                               showImages: this.showImages
                               )
                           )
                       ));
        }
예제 #9
0
        Widget _parseNode(HtmlNode node)
        {
            if (this.customRender != null)
            {
                Widget customWidget = this.customRender(node, this._parseNodeList(node.ChildNodes));
                if (customWidget != null)
                {
                    return(customWidget);
                }
            }

            if (node.NodeType is HtmlNodeType.Element)
            {
                if (!_supportedElements.Contains(node.Name))
                {
                    return(new Container());
                }

                switch (node.Name)
                {
                case "a":
                    return(new GestureDetector(
                               child: DefaultTextStyle.merge(
                                   child: new Wrap(
                                       children: this._parseNodeList(node.ChildNodes)
                                       ),
                                   style: this.linkStyle
                                   ),
                               onTap: () => {
                        if (node.Attributes.Contains("href") && this.onLinkTap != null)
                        {
                            string url = node.Attributes["href"].Value;
                            this.onLinkTap(url);
                        }
                    }));

                case "abbr":
                    return(DefaultTextStyle.merge(
                               child: new Wrap(
                                   children: this._parseNodeList(node.ChildNodes)
                                   ),
                               style: new TextStyle(
                                   decoration: TextDecoration.underline,
                                   decorationStyle: TextDecorationStyle.solid
                                   )
                               ));

                case "acronym":
                    return(DefaultTextStyle.merge(
                               child: new Wrap(
                                   children: this._parseNodeList(node.ChildNodes)
                                   ),
                               style: new TextStyle(
                                   decoration: TextDecoration.underline,
                                   decorationStyle: TextDecorationStyle.solid
                                   )
                               ));

                case "address":
                    return(DefaultTextStyle.merge(
                               child: new Wrap(
                                   children: this._parseNodeList(node.ChildNodes)
                                   ),
                               style: new TextStyle(
                                   fontStyle: FontStyle.italic
                                   )
                               ));

                case "article":
                    return(new Container(
                               width: this.width,
                               child: new Wrap(
                                   crossAxisAlignment: WrapCrossAlignment.center,
                                   children: this._parseNodeList(node.ChildNodes)
                                   )
                               ));

                case "aside":
                    return(new Container(
                               width: this.width,
                               child: new Wrap(
                                   crossAxisAlignment: WrapCrossAlignment.center,
                                   children: this._parseNodeList(node.ChildNodes)
                                   )
                               ));

                case "b":
                    return(DefaultTextStyle.merge(
                               child: new Wrap(
                                   children: this._parseNodeList(node.ChildNodes)
                                   ),
                               style: new TextStyle(
                                   fontWeight: FontWeight.bold
                                   )
                               ));

                case "bdi":
                    return(new Wrap(
                               children: this._parseNodeList(node.ChildNodes)
                               ));

                case "bdo":
                    if (node.Attributes["dir"] != null)
                    {
                        return(new Directionality(
                                   child: new Wrap(
                                       children: this._parseNodeList(node.ChildNodes)
                                       ),
                                   textDirection: node.Attributes["dir"].Value == "rtl"
                                    ? TextDirection.rtl
                                    : TextDirection.ltr
                                   ));
                    }

                    //Direction attribute is required, just render the text normally now.
                    return(new Wrap(
                               children: this._parseNodeList(node.ChildNodes)
                               ));

                case "big":
                    return(DefaultTextStyle.merge(
                               child: new Wrap(
                                   children: this._parseNodeList(node.ChildNodes)
                                   ),
                               style: new TextStyle(
                                   fontSize: 20.0f
                                   )
                               ));

                case "blockquote":
                    return(new Padding(
                               padding:
                               EdgeInsets.fromLTRB(40.0f, this.blockSpacing, 40.0f, this.blockSpacing),
                               child: new Container(
                                   width: this.width,
                                   child: new Wrap(
                                       crossAxisAlignment: WrapCrossAlignment.center,
                                       children: this._parseNodeList(node.ChildNodes)
                                       )
                                   )
                               ));

                case "body":
                    return(new Container(
                               width: this.width,
                               child: new Wrap(
                                   crossAxisAlignment: WrapCrossAlignment.center,
                                   children: this._parseNodeList(node.ChildNodes)
                                   )
                               ));

                case "br":
                    if (this._isNotFirstBreakTag(node))
                    {
                        return(new Container(width: this.width, height: this.blockSpacing));
                    }

                    return(new Container(width: this.width));

                case "caption":
                    return(new Container(
                               width: this.width,
                               child: new Wrap(
                                   crossAxisAlignment: WrapCrossAlignment.center,
                                   alignment: WrapAlignment.center,
                                   children: this._parseNodeList(node.ChildNodes)
                                   )
                               ));

                case "center":
                    return(new Container(
                               width: this.width,
                               child: new Wrap(
                                   crossAxisAlignment: WrapCrossAlignment.center,
                                   children: this._parseNodeList(node.ChildNodes),
                                   alignment: WrapAlignment.center
                                   )));

                case "cite":
                    return(DefaultTextStyle.merge(
                               child: new Wrap(
                                   children: this._parseNodeList(node.ChildNodes)
                                   ),
                               style: new TextStyle(
                                   fontStyle: FontStyle.italic
                                   )
                               ));

                case "code":
                    return(DefaultTextStyle.merge(
                               child: new Wrap(
                                   children: this._parseNodeList(node.ChildNodes)
                                   ),
                               style: new TextStyle(
                                   fontFamily: "monospace"
                                   )
                               ));

                case "data":
                    return(new Wrap(
                               children: this._parseNodeList(node.ChildNodes)
                               ));

                case "dd":
                    return(new Padding(
                               padding: EdgeInsets.only(left: 40.0f),
                               child: new Container(
                                   width: this.width,
                                   child: new Wrap(
                                       crossAxisAlignment: WrapCrossAlignment.center,
                                       children: this._parseNodeList(node.ChildNodes)
                                       )
                                   )));

                case "del":
                    return(DefaultTextStyle.merge(
                               child: new Wrap(
                                   children: this._parseNodeList(node.ChildNodes)
                                   ),
                               style: new TextStyle(
                                   decoration: TextDecoration.lineThrough
                                   )
                               ));

                case "dfn":
                    return(DefaultTextStyle.merge(
                               child: new Wrap(
                                   children: this._parseNodeList(node.ChildNodes)
                                   ),
                               style: new TextStyle(
                                   fontStyle: FontStyle.italic
                                   )
                               ));

                case "div":
                    return(new Container(
                               width: this.width,
                               child: new Wrap(
                                   crossAxisAlignment: WrapCrossAlignment.center,
                                   children: this._parseNodeList(node.ChildNodes)
                                   )
                               ));

                case "dl":
                    return(new Padding(
                               padding: EdgeInsets.only(top: this.blockSpacing, bottom: this.blockSpacing),
                               child: new Column(
                                   children: this._parseNodeList(node.ChildNodes),
                                   crossAxisAlignment: CrossAxisAlignment.start
                                   )));

                case "dt":
                    return(new Wrap(
                               children: this._parseNodeList(node.ChildNodes)
                               ));

                case "em":
                    return(DefaultTextStyle.merge(
                               child: new Wrap(
                                   children: this._parseNodeList(node.ChildNodes)
                                   ),
                               style: new TextStyle(
                                   fontStyle: FontStyle.italic
                                   )
                               ));

                case "figcaption":
                    return(new Wrap(
                               children: this._parseNodeList(node.ChildNodes)
                               ));

                case "figure":
                    return(new Padding(
                               padding:
                               EdgeInsets.fromLTRB(40.0f, this.blockSpacing, 40.0f, this.blockSpacing),
                               child: new Column(
                                   children: this._parseNodeList(node.ChildNodes),
                                   crossAxisAlignment: CrossAxisAlignment.center
                                   )));

                case "font":
                    return(new Wrap(
                               children: this._parseNodeList(node.ChildNodes)
                               ));

                case "footer":
                    return(new Container(
                               width: this.width,
                               child: new Wrap(
                                   crossAxisAlignment: WrapCrossAlignment.center,
                                   children: this._parseNodeList(node.ChildNodes)
                                   )
                               ));

                case "h1":
                    return(DefaultTextStyle.merge(
                               child: new Container(
                                   width: this.width,
                                   child: new Wrap(
                                       crossAxisAlignment: WrapCrossAlignment.center,
                                       children: this._parseNodeList(node.ChildNodes)
                                       )
                                   ),
                               style: new TextStyle(
                                   fontSize: 28.0f,
                                   fontWeight: FontWeight.bold
                                   )
                               ));

                case "h2":
                    return(DefaultTextStyle.merge(
                               child: new Container(
                                   width: this.width,
                                   child: new Wrap(
                                       crossAxisAlignment: WrapCrossAlignment.center,
                                       children: this._parseNodeList(node.ChildNodes)
                                       )
                                   ),
                               style: new TextStyle(
                                   fontSize: 21.0f,
                                   fontWeight: FontWeight.bold
                                   )
                               ));

                case "h3":
                    return(DefaultTextStyle.merge(
                               child: new Container(
                                   width: this.width,
                                   child: new Wrap(
                                       crossAxisAlignment: WrapCrossAlignment.center,
                                       children: this._parseNodeList(node.ChildNodes)
                                       )
                                   ),
                               style: new TextStyle(
                                   fontSize: 16.0f,
                                   fontWeight: FontWeight.bold
                                   )
                               ));

                case "h4":
                    return(DefaultTextStyle.merge(
                               child: new Container(
                                   width: this.width,
                                   child: new Wrap(
                                       crossAxisAlignment: WrapCrossAlignment.center,
                                       children: this._parseNodeList(node.ChildNodes)
                                       )
                                   ),
                               style: new TextStyle(
                                   fontSize: 14.0f,
                                   fontWeight: FontWeight.bold
                                   )
                               ));

                case "h5":
                    return(DefaultTextStyle.merge(
                               child: new Container(
                                   width: this.width,
                                   child: new Wrap(
                                       crossAxisAlignment: WrapCrossAlignment.center,
                                       children: this._parseNodeList(node.ChildNodes)
                                       )
                                   ),
                               style: new TextStyle(
                                   fontSize: 12.0f,
                                   fontWeight: FontWeight.bold
                                   )
                               ));

                case "h6":
                    return(DefaultTextStyle.merge(
                               child: new Container(
                                   width: this.width,
                                   child: new Wrap(
                                       crossAxisAlignment: WrapCrossAlignment.center,
                                       children: this._parseNodeList(node.ChildNodes)
                                       )
                                   ),
                               style: new TextStyle(
                                   fontSize: 10.0f,
                                   fontWeight: FontWeight.bold
                                   )
                               ));

                case "header":
                    return(new Container(
                               width: this.width,
                               child: new Wrap(
                                   crossAxisAlignment: WrapCrossAlignment.center,
                                   children: this._parseNodeList(node.ChildNodes)
                                   )
                               ));

                case "hr":
                    return(new Padding(
                               padding: EdgeInsets.only(top: 7.0f, bottom: 7.0f),
                               child: new Divider(height: 1.0f, color: Colors.black38)
                               ));

                case "i":
                    return(DefaultTextStyle.merge(
                               child: new Wrap(
                                   children: this._parseNodeList(node.ChildNodes)
                                   ),
                               style: new TextStyle(
                                   fontStyle: FontStyle.italic
                                   )
                               ));

                case "img":
                    return(new Builder(
                               builder: (BuildContext context) => {
                        if (this.showImages)
                        {
                            if (node.Attributes["src"] != null)
                            {
                                if (node.Attributes["src"].Value.StartsWith("data:image") &&
                                    node.Attributes["src"].Value.Contains("base64,"))
                                {
                                    return Image.memory(Convert.FromBase64String(
                                                            node.Attributes["src"].Value.Split(new string[] { "base64," },
                                                                                               StringSplitOptions.None)[1].Trim()));
                                }

                                return Image.network(node.Attributes["src"].Value);
                            }
                            else if (node.Attributes["alt"] != null)
                            {
                                //Temp fix for https://github.com/flutter/flutter/issues/736
                                if (node.Attributes["alt"].Value.EndsWith(" "))
                                {
                                    return new Container(
                                        padding: EdgeInsets.only(right: 2.0f),
                                        child: new Text(node.Attributes["alt"].Value));
                                }
                                else
                                {
                                    return new Text(node.Attributes["alt"].Value);
                                }
                            }
                        }

                        return new Container();
                    }
                               ));

                case "ins":
                    return(DefaultTextStyle.merge(
                               child: new Wrap(
                                   children: this._parseNodeList(node.ChildNodes)
                                   ),
                               style: new TextStyle(
                                   decoration: TextDecoration.underline
                                   )
                               ));

                case "kbd":
                    return(DefaultTextStyle.merge(
                               child: new Wrap(
                                   children: this._parseNodeList(node.ChildNodes)
                                   ),
                               style: new TextStyle(
                                   fontFamily: "monospace"
                                   )
                               ));

                case "li":
                    string     type        = node.ParentNode.Name; // Parent type; usually ol or ul
                    EdgeInsets markPadding = EdgeInsets.symmetric(horizontal: 4.0f);
                    Widget     mark;
                    switch (type)
                    {
                    case "ul":
                        mark = new Container(child: new Text("•"), padding: markPadding);
                        break;

                    case "ol":
                        int index = node.ParentNode.ChildNodes.IndexOf(node) + 1;
                        mark = new Container(child: new Text($"{index}."), padding: markPadding);
                        break;

                    default:         //Fallback to middle dot
                        mark = new Container(width: 0.0f, height: 0.0f);
                        break;
                    }

                    return(new Container(
                               width: this.width,
                               child: new Wrap(
                                   crossAxisAlignment: WrapCrossAlignment.center,
                                   children: new List <Widget> {
                        mark,
                        new Wrap(
                            crossAxisAlignment: WrapCrossAlignment.center,
                            children: this._parseNodeList(node.ChildNodes))
                    }
                                   )
                               ));

                case "main":
                    return(new Container(
                               width: this.width,
                               child: new Wrap(
                                   crossAxisAlignment: WrapCrossAlignment.center,
                                   children: this._parseNodeList(node.ChildNodes)
                                   )
                               ));

                case "mark":
                    return(DefaultTextStyle.merge(
                               child: new Wrap(
                                   children: this._parseNodeList(node.ChildNodes)
                                   ),
                               style: new TextStyle(
                                   color: Colors.black,
                                   background: this._getPaint(Colors.yellow)
                                   )
                               ));

                case "nav":
                    return(new Container(
                               width: this.width,
                               child: new Wrap(
                                   crossAxisAlignment: WrapCrossAlignment.center,
                                   children: this._parseNodeList(node.ChildNodes)
                                   )
                               ));

                case "noscript":
                    return(new Container(
                               width: this.width,
                               child: new Wrap(
                                   crossAxisAlignment: WrapCrossAlignment.center,
                                   alignment: WrapAlignment.start,
                                   children: this._parseNodeList(node.ChildNodes)
                                   )
                               ));

                case "ol":
                    return(new Column(
                               children: this._parseNodeList(node.ChildNodes),
                               crossAxisAlignment: CrossAxisAlignment.start
                               ));

                case "p":
                    return(new Padding(
                               padding: EdgeInsets.only(top: this.blockSpacing, bottom: this.blockSpacing),
                               child: new Container(
                                   width: this.width,
                                   child: new Wrap(
                                       crossAxisAlignment: WrapCrossAlignment.center,
                                       alignment: WrapAlignment.start,
                                       children: this._parseNodeList(node.ChildNodes)
                                       )
                                   )
                               ));

                case "pre":
                    return(new Padding(
                               padding: EdgeInsets.all(this.blockSpacing),
                               child: DefaultTextStyle.merge(
                                   child: new Text(node.InnerHtml),
                                   style: new TextStyle(
                                       fontFamily: "monospace"
                                       )
                                   )
                               ));

                case "q":
                    List <Widget> children = new List <Widget>();
                    children.Add(new Text("\""));
                    children.AddRange(this._parseNodeList(node.ChildNodes));
                    children.Add(new Text("\""));
                    return(DefaultTextStyle.merge(
                               child: new Wrap(
                                   children: children
                                   ),
                               style: new TextStyle(
                                   fontStyle: FontStyle.italic
                                   )
                               ));

                case "rp":
                    return(new Wrap(
                               children: this._parseNodeList(node.ChildNodes)
                               ));

                case "rt":
                    return(new Wrap(
                               children: this._parseNodeList(node.ChildNodes)
                               ));

                case "ruby":
                    return(new Wrap(
                               children: this._parseNodeList(node.ChildNodes)
                               ));

                case "s":
                    return(DefaultTextStyle.merge(
                               child: new Wrap(
                                   children: this._parseNodeList(node.ChildNodes)
                                   ),
                               style: new TextStyle(
                                   decoration: TextDecoration.lineThrough
                                   )
                               ));

                case "samp":
                    return(DefaultTextStyle.merge(
                               child: new Wrap(
                                   children: this._parseNodeList(node.ChildNodes)
                                   ),
                               style: new TextStyle(
                                   fontFamily: "monospace"
                                   )
                               ));

                case "section":
                    return(new Container(
                               width: this.width,
                               child: new Wrap(
                                   crossAxisAlignment: WrapCrossAlignment.center,
                                   children: this._parseNodeList(node.ChildNodes)
                                   )
                               ));

                case "small":
                    return(DefaultTextStyle.merge(
                               child: new Wrap(
                                   children: this._parseNodeList(node.ChildNodes)
                                   ),
                               style: new TextStyle(
                                   fontSize: 10.0f
                                   )
                               ));

                case "span":
                    return(new Wrap(
                               children: this._parseNodeList(node.ChildNodes)
                               ));

                case "strike":
                    return(DefaultTextStyle.merge(
                               child: new Wrap(
                                   children: this._parseNodeList(node.ChildNodes)
                                   ),
                               style: new TextStyle(
                                   decoration: TextDecoration.lineThrough
                                   )
                               ));

                case "strong":
                    return(DefaultTextStyle.merge(
                               child: new Wrap(
                                   children: this._parseNodeList(node.ChildNodes)
                                   ),
                               style: new TextStyle(
                                   fontWeight: FontWeight.bold
                                   )
                               ));

                case "sub":
                case "sup":
                    //Use builder to capture the parent font to inherit the font styles
                    return(new Builder(builder: (BuildContext context) => {
                        DefaultTextStyle parent = DefaultTextStyle.of(context);
                        TextStyle parentStyle = parent.style;

                        var painter = new TextPainter(
                            text: new TextSpan(
                                text: node.InnerText,
                                style: parentStyle
                                ),
                            textDirection: TextDirection.ltr);
                        painter.layout();
                        //print(painter.size);

                        //Get the height from the default text
                        var height = painter.size.height *
                                     1.35f;     //compute a higher height for the text to increase the offset of the Positioned text

                        painter = new TextPainter(
                            text: new TextSpan(
                                text: node.InnerText,
                                style: parentStyle.merge(new TextStyle(
                                                             fontSize:
                                                             parentStyle.fontSize * RichTextParserUtils.OFFSET_TAGS_FONT_SIZE_FACTOR))
                                ),
                            textDirection: TextDirection.ltr);
                        painter.layout();
                        //print(painter.size);

                        //Get the width from the reduced/positioned text
                        var width = painter.size.width;

                        //print("Width: $width, Height: $height");

                        return DefaultTextStyle.merge(
                            child: new Wrap(
                                crossAxisAlignment: WrapCrossAlignment.center,
                                children: new List <Widget> {
                            new Stack(
                                fit: StackFit.loose,
                                children: new List <Widget> {
                                //The Stack needs a non-positioned object for the next widget to respect the space so we create
                                //a sized box to fill the required space
                                new SizedBox(
                                    width: width,
                                    height: height
                                    ),
                                DefaultTextStyle.merge(
                                    child: new Positioned(
                                        child: new Wrap(children: this._parseNodeList(node.ChildNodes)),
                                        bottom: node.Name == "sub" ? 0 : (int?)null,
                                        top: node.Name == "sub" ? (int?)null : 0
                                        ),
                                    style: new TextStyle(
                                        fontSize: parentStyle.fontSize *
                                        RichTextParserUtils.OFFSET_TAGS_FONT_SIZE_FACTOR)
                                    )
                            }
                                )
                        }
                                )
                            );
                    }));

                case "table":
                    return(new Column(
                               children: this._parseNodeList(node.ChildNodes),
                               crossAxisAlignment: CrossAxisAlignment.start
                               ));

                case "tbody":
                    return(new Column(
                               children: this._parseNodeList(node.ChildNodes),
                               crossAxisAlignment: CrossAxisAlignment.start
                               ));

                case "td":
                    int colspan = 1;
                    if (node.Attributes["colspan"] != null)
                    {
                        int.TryParse(node.Attributes["colspan"].Value, out colspan);
                    }

                    return(new Expanded(
                               flex: colspan,
                               child: new Wrap(
                                   crossAxisAlignment: WrapCrossAlignment.center,
                                   children: this._parseNodeList(node.ChildNodes)
                                   )
                               ));

                case "template":
                    //Not usually displayed in HTML
                    return(new Container());

                case "tfoot":
                    return(new Column(
                               children: this._parseNodeList(node.ChildNodes),
                               crossAxisAlignment: CrossAxisAlignment.start
                               ));

                case "th":
                    int _colspan = 1;
                    if (node.Attributes["colspan"] != null)
                    {
                        int.TryParse(node.Attributes["colspan"].Value, out _colspan);
                    }

                    return(DefaultTextStyle.merge(
                               child: new Expanded(
                                   flex: _colspan,
                                   child: new Wrap(
                                       crossAxisAlignment: WrapCrossAlignment.center,
                                       alignment: WrapAlignment.center,
                                       children: this._parseNodeList(node.ChildNodes)
                                       )
                                   ),
                               style: new TextStyle(
                                   fontWeight: FontWeight.bold
                                   )
                               ));

                case "thead":
                    return(new Column(
                               children: this._parseNodeList(node.ChildNodes),
                               crossAxisAlignment: CrossAxisAlignment.start
                               ));

                case "time":
                    return(new Wrap(
                               children: this._parseNodeList(node.ChildNodes)
                               ));

                case "tr":
                    return(new Row(
                               children: this._parseNodeList(node.ChildNodes),
                               crossAxisAlignment: CrossAxisAlignment.center
                               ));

                case "tt":
                    return(DefaultTextStyle.merge(
                               child: new Wrap(
                                   children: this._parseNodeList(node.ChildNodes)
                                   ),
                               style: new TextStyle(
                                   fontFamily: "monospace"
                                   )
                               ));

                case "u":
                    return(DefaultTextStyle.merge(
                               child: new Wrap(
                                   children: this._parseNodeList(node.ChildNodes)
                                   ),
                               style: new TextStyle(
                                   decoration: TextDecoration.underline
                                   )
                               ));

                case "ul":
                    return(new Column(
                               children: this._parseNodeList(node.ChildNodes),
                               crossAxisAlignment: CrossAxisAlignment.start
                               ));

                case "var":
                    return(DefaultTextStyle.merge(
                               child: new Wrap(
                                   children: this._parseNodeList(node.ChildNodes)
                                   ),
                               style: new TextStyle(
                                   fontStyle: FontStyle.italic
                                   )
                               ));
                }
            }
            else if (node.NodeType is HtmlNodeType.Text)
            {
                //We don't need to worry about rendering extra whitespace
                if (node.InnerText.Trim() == "" && node.InnerText.IndexOf(" ") == -1)
                {
                    return(new Wrap());
                }

                if (node.InnerText.Trim() == "" && node.InnerText.IndexOf(" ") != -1)
                {
                    (node as HtmlTextNode).Text = " ";
                }

                string finalText = this.trimStringHtml(node.InnerText);
                //Temp fix for https://github.com/flutter/flutter/issues/736
                if (finalText.EndsWith(" "))
                {
                    return(new Container(
                               padding: EdgeInsets.only(right: 2.0f), child: new Text(finalText)));
                }
                else
                {
                    return(new Text(finalText));
                }
            }

            return(new Wrap());
        }