, instead found $row');
36 | return new TableRow(children: row.children.map(_buildCell).toList());
37 | }
38 |
39 | /// Builds a table cell from a tag.
40 | TableCell _buildCell(dom.Element cell) {
41 | assert(cell.localName == 'td' || cell.localName == 'th',
42 | 'Expected | or | , instead found $cell');
43 | return new TableCell(
44 | child: new Container(
45 | padding: EdgeInsets.all(5),
46 | child: new Text(cell.text,
47 | style: TextStyle(
48 | fontWeight: cell.localName == 'th'
49 | ? FontWeight.bold
50 | : FontWeight.normal))));
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/lib/tags/TextTag.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_mini_program/Page.dart';
3 | import 'package:flutter_mini_program/utils/ConvertUtil.dart';
4 | import 'package:html/dom.dart' as dom;
5 |
6 | /// Builds a [Text] widget from a [dom.Text] element.
7 | class TextTag extends StatelessWidget {
8 | final Page page;
9 | final dom.Element element;
10 | final Map style;
11 |
12 | TextTag({this.page, this.element, this.style});
13 |
14 | @override
15 | Widget build(BuildContext context) {
16 | String text = element.text.trim();
17 | text = ConvertUtil.compileTemplateString(text, page.data);
18 |
19 | Text textWidget = new Text(text,
20 | style: TextStyle(
21 | color: style['color'],
22 | fontWeight: style['fontWeight'],
23 | fontStyle: style['fontStyle'],
24 | decoration: style['textDecoration'],
25 | decorationColor: style['textDecorationColor'],
26 | decorationStyle: style['textDecorationStyle'],
27 | fontSize: style['fontSize'],
28 | height: style['height']),
29 | softWrap: true,
30 | textAlign: style['textAlign'],
31 | textDirection: style['direction'],
32 | overflow: TextOverflow.clip);
33 |
34 | if (style['display'] == 'block') {
35 | return Row(
36 | children: [textWidget],
37 | );
38 | } else if (style['display'] == 'inline') {
39 | return textWidget;
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/lib/tags/VideoTag.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_mini_program/Page.dart';
3 | import 'package:html/dom.dart' as dom;
4 | import 'package:video_player/video_player.dart';
5 |
6 | /// Load a Video from a |