Skip to content

Commit

Permalink
show when table unsupported and support for tag u
Browse files Browse the repository at this point in the history
  • Loading branch information
avdosev committed Apr 8, 2021
1 parent 26b899c commit b03456c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
6 changes: 4 additions & 2 deletions lib/utils/html_to_json/transformer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,17 @@ const inlineElements = {
'b',
'a',
'um',
'sup'
'sup',
'u',
};

const nameToType = <String, TextMode>{
'strong': TextMode.strong,
'em': TextMode.emphasis,
'i': TextMode.italic,
's': TextMode.strikethrough,
'b': TextMode.bold
'b': TextMode.bold,
'u': TextMode.underline,
};

Node optimizeParagraph(Paragraph p) {
Expand Down
32 changes: 18 additions & 14 deletions lib/widgets/html_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -119,20 +119,24 @@ Widget buildTree(view.Node element, BuildContext context, BuildParams params) {
src: element.src,
);
} else if (element is view.Table) {
widget = Table(
defaultColumnWidth: IntrinsicColumnWidth(),
border:
TableBorder.all(color: Theme.of(context).textTheme.bodyText2.color),
children: element.rows
.map((row) => TableRow(
children: row
.map((child) => TableCell(
child: Padding(
padding: EdgeInsets.all(5),
child: buildTree(child, context, params))))
.toList()))
.toList(),
);
try {
widget = Table(
defaultColumnWidth: IntrinsicColumnWidth(),
border:
TableBorder.all(color: Theme.of(context).textTheme.bodyText2.color),
children: element.rows
.map((row) => TableRow(
children: row
.map((child) => TableCell(
child: Padding(
padding: EdgeInsets.all(5),
child: buildTree(child, context, params))))
.toList()))
.toList(),
);
} catch (err) {
widget = Text("Unsupported table");
}
} else {
logInfo("Not found case for $type");
}
Expand Down

0 comments on commit b03456c

Please sign in to comment.