Skip to content

Commit 84d00e0

Browse files
committed
Replaced element instead of Content element and move more stuff to Style to prepare for css implementation
1 parent cce767f commit 84d00e0

14 files changed

+446
-372
lines changed

example/main.dart

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import 'package:flutter/material.dart';
2-
import 'package:flutter_html/block_element.dart';
2+
import 'package:flutter_html/src/block_element.dart';
33
import 'package:flutter_html/flutter_html.dart';
44
import 'package:flutter_html/style.dart';
5-
import 'package:flutter_html/styled_element.dart';
6-
import 'package:html/dom.dart' as dom;
75

86
void main() => runApp(new MyApp());
97

@@ -125,15 +123,13 @@ class _MyHomePageState extends State<MyHomePage> {
125123
//Optional parameters:
126124
style: {
127125
"ul": Style(
128-
textStyle: TextStyle(
129-
fontFamily: "monospace",
130-
fontSize: 24,
131-
),
126+
fontFamily: "monospace",
127+
fontSize: 24,
128+
margin: EdgeInsets.zero,
132129
block: Block(
133-
backgroundColor: Colors.blue,
134130
border: Border.all(width: 2),
135-
margin: EdgeInsets.zero,
136131
),
132+
backgroundColor: Colors.blue,
137133
),
138134
},
139135
onLinkTap: (url) {

lib/block_element.dart

Lines changed: 0 additions & 196 deletions
This file was deleted.

lib/flutter_html.dart

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ class Html extends StatelessWidget {
6262
Widget build(BuildContext context) {
6363
final double width = MediaQuery.of(context).size.width;
6464

65-
if(useRichText) {
65+
if (useRichText) {
6666
return Container(
67-
// padding: padding,
67+
padding: padding,
6868
color: backgroundColor,
6969
width: width,
7070
child: DefaultTextStyle.merge(
7171
style: defaultTextStyle ?? Theme.of(context).textTheme.body1,
72-
child: HtmlRichTextParser(
72+
child: HtmlRichTextParser(
7373
width: width,
7474
onLinkTap: onLinkTap,
7575
renderNewlines: renderNewlines,
@@ -87,15 +87,13 @@ class Html extends StatelessWidget {
8787
}
8888

8989
return Container(
90-
color: backgroundColor,
91-
width: width,
92-
child: HtmlParser(
93-
htmlData: data,
94-
cssData: css,
95-
onLinkTap: onLinkTap,
96-
style: style,
97-
)
98-
);
99-
90+
color: backgroundColor,
91+
width: width,
92+
child: HtmlParser(
93+
htmlData: data,
94+
cssData: css,
95+
onLinkTap: onLinkTap,
96+
style: style,
97+
));
10098
}
10199
}

0 commit comments

Comments
 (0)