Skip to content

Commit 2857b20

Browse files
author
Nguyen Dat
committed
remove unuse code + resolve conflict
2 parents 2973ebb + acc288c commit 2857b20

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

example/lib/main.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,6 @@ const htmlData = r"""
237237
<p id='bottom'><a href='#top'>Scroll to top</a></p>
238238
""";
239239

240-
const htmlDataLines ="""
241-
<h3>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vestibulum sapien feugiat lorem tempor, id porta orci elementum. Fusce sed justo id arcu egestas congue. Fusce tincidunt lacus ipsum, in imperdiet felis ultricies eu. In ullamcorper risus felis, ac maximus dui bibendum vel. Integer ligula tortor, facilisis eu mauris ut, ultrices hendrerit ex. Donec scelerisque massa consequat, eleifend mauris eu, mollis dui. Donec placerat augue tortor, et tincidunt quam tempus non. Quisque sagittis enim nisi, eu condimentum lacus egestas ac. Nam facilisis luctus ipsum, at aliquam urna fermentum a. Quisque tortor dui, faucibus in ante eget, pellentesque mattis nibh. In augue dolor, euismod vitae eleifend nec, tempus vel urna. Donec vitae augue accumsan ligula fringilla ultrices et vel ex.</h3>
242-
""";
243-
244240
class _MyHomePageState extends State<MyHomePage> {
245241
@override
246242
Widget build(BuildContext context) {

lib/html_parser.dart

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -577,14 +577,15 @@ class HtmlParser extends StatelessWidget {
577577
static StyledElement _processBeforesAndAfters(StyledElement tree) {
578578
if (tree.style.before != null) {
579579
tree.children.insert(
580-
0, TextContentElement(text: tree.style.before, style: tree.style));
580+
0, TextContentElement(text: tree.style.before, style: tree.style.copyWith(beforeAfterNull: true, display: Display.INLINE)));
581581
}
582582
if (tree.style.after != null) {
583583
tree.children
584-
.add(TextContentElement(text: tree.style.after, style: tree.style));
585-
} else {
586-
tree.children.forEach(_processBeforesAndAfters);
584+
.add(TextContentElement(text: tree.style.after, style: tree.style.copyWith(beforeAfterNull: true, display: Display.INLINE)));
587585
}
586+
587+
tree.children.forEach(_processBeforesAndAfters);
588+
588589
return tree;
589590
}
590591

lib/style.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ class Style {
371371
String? markerContent,
372372
int? maxLines,
373373
TextOverflow? textOverflow,
374+
bool? beforeAfterNull,
374375
}) {
375376
return Style(
376377
backgroundColor: backgroundColor ?? this.backgroundColor,
@@ -400,8 +401,8 @@ class Style {
400401
whiteSpace: whiteSpace ?? this.whiteSpace,
401402
width: width ?? this.width,
402403
wordSpacing: wordSpacing ?? this.wordSpacing,
403-
before: before ?? this.before,
404-
after: after ?? this.after,
404+
before: beforeAfterNull == true ? null : before ?? this.before,
405+
after: beforeAfterNull == true ? null : after ?? this.after,
405406
border: border ?? this.border,
406407
alignment: alignment ?? this.alignment,
407408
markerContent: markerContent ?? this.markerContent,

0 commit comments

Comments
 (0)