|
1 | 1 | import 'dart:convert';
|
2 |
| -import 'dart:io'; |
3 | 2 |
|
4 | 3 | import 'package:flutter/gestures.dart';
|
5 | 4 | import 'package:flutter/material.dart';
|
@@ -224,6 +223,7 @@ class HtmlRichTextParser extends StatelessWidget {
|
224 | 223 | "time",
|
225 | 224 | "span",
|
226 | 225 | "big",
|
| 226 | + "sub", |
227 | 227 | ];
|
228 | 228 |
|
229 | 229 | // specialty elements require unique handling
|
@@ -523,6 +523,13 @@ class HtmlRichTextParser extends StatelessWidget {
|
523 | 523 | childStyle = childStyle.merge(
|
524 | 524 | TextStyle(backgroundColor: Colors.yellow, color: Colors.black));
|
525 | 525 | break;
|
| 526 | + case "sub": |
| 527 | + childStyle = childStyle.merge( |
| 528 | + TextStyle( |
| 529 | + fontSize: childStyle.fontSize * OFFSET_TAGS_FONT_SIZE_FACTOR, |
| 530 | + ), |
| 531 | + ); |
| 532 | + break; |
526 | 533 | case "del":
|
527 | 534 | case "s":
|
528 | 535 | case "strike":
|
@@ -958,39 +965,11 @@ class HtmlRichTextParser extends StatelessWidget {
|
958 | 965 | }
|
959 | 966 | }
|
960 | 967 |
|
961 |
| - Paint _getPaint(Color color) { |
962 |
| - Paint paint = new Paint(); |
963 |
| - paint.color = color; |
964 |
| - return paint; |
965 |
| - } |
966 |
| - |
967 | 968 | String condenseHtmlWhitespace(String stringToTrim) {
|
968 | 969 | stringToTrim = stringToTrim.replaceAll("\n", " ");
|
969 | 970 | while (stringToTrim.indexOf(" ") != -1) {
|
970 | 971 | stringToTrim = stringToTrim.replaceAll(" ", " ");
|
971 | 972 | }
|
972 | 973 | return stringToTrim;
|
973 | 974 | }
|
974 |
| - |
975 |
| - bool _isNotFirstBreakTag(dom.Node node) { |
976 |
| - int index = node.parentNode.nodes.indexOf(node); |
977 |
| - if (index == 0) { |
978 |
| - if (node.parentNode == null) { |
979 |
| - return false; |
980 |
| - } |
981 |
| - return _isNotFirstBreakTag(node.parentNode); |
982 |
| - } else if (node.parentNode.nodes[index - 1] is dom.Element) { |
983 |
| - if ((node.parentNode.nodes[index - 1] as dom.Element).localName == "br") { |
984 |
| - return true; |
985 |
| - } |
986 |
| - return false; |
987 |
| - } else if (node.parentNode.nodes[index - 1] is dom.Text) { |
988 |
| - if ((node.parentNode.nodes[index - 1] as dom.Text).text.trim() == "") { |
989 |
| - return _isNotFirstBreakTag(node.parentNode.nodes[index - 1]); |
990 |
| - } else { |
991 |
| - return false; |
992 |
| - } |
993 |
| - } |
994 |
| - return false; |
995 |
| - } |
996 | 975 | }
|
0 commit comments