@@ -420,11 +420,7 @@ class HtmlParser extends StatelessWidget {
420
420
tree.style.listStylePosition == ListStylePosition .OUTSIDE ?
421
421
Padding (
422
422
padding: tree.style.padding ?? EdgeInsets .only (left: tree.style.direction != TextDirection .rtl ? 10.0 : 0.0 , right: tree.style.direction == TextDirection .rtl ? 10.0 : 0.0 ),
423
- child: Text (
424
- "${newContext .style .markerContent }" ,
425
- textAlign: TextAlign .right,
426
- style: newContext.style.generateTextStyle ()
427
- ),
423
+ child: newContext.style.markerContent
428
424
) : Container (height: 0 , width: 0 ),
429
425
Text ("\t " , textAlign: TextAlign .right),
430
426
Expanded (
@@ -433,11 +429,10 @@ class HtmlParser extends StatelessWidget {
433
429
EdgeInsets .only (left: tree.style.direction != TextDirection .rtl ? 10.0 : 0.0 , right: tree.style.direction == TextDirection .rtl ? 10.0 : 0.0 ) : EdgeInsets .zero,
434
430
child: StyledText (
435
431
textSpan: TextSpan (
436
- text: (tree.style.listStylePosition ==
437
- ListStylePosition .INSIDE )
438
- ? '${newContext .style .markerContent }'
439
- : null ,
440
- children: getChildren (tree),
432
+ children: getChildren (tree)..insertAll (0 , tree.style.listStylePosition == ListStylePosition .INSIDE ?
433
+ [
434
+ WidgetSpan (alignment: PlaceholderAlignment .middle, child: newContext.style.markerContent ?? Container (height: 0 , width: 0 ))
435
+ ] : []),
441
436
style: newContext.style.generateTextStyle (),
442
437
),
443
438
style: newContext.style,
@@ -451,12 +446,12 @@ class HtmlParser extends StatelessWidget {
451
446
);
452
447
} else if (tree is ReplacedElement ) {
453
448
if (tree is TextContentElement ) {
454
- return TextSpan (text: tree.text);
449
+ return TextSpan (text: tree.text? . transformed (tree.style.textTransform) );
455
450
} else {
456
451
return WidgetSpan (
457
452
alignment: tree.alignment,
458
453
baseline: TextBaseline .alphabetic,
459
- child: tree.toWidget (context )! ,
454
+ child: tree.toWidget (newContext )! ,
460
455
);
461
456
}
462
457
} else if (tree is InteractableElement ) {
@@ -708,7 +703,10 @@ class HtmlParser extends StatelessWidget {
708
703
/// bullet all list items according to the [ListStyleType] they have been given.
709
704
static StyledElement _processListCharactersRecursive (
710
705
StyledElement tree, ListQueue <Context > olStack) {
711
- if (tree.name == 'ol' && tree.style.listStyleType != null ) {
706
+ if (tree.style.listStylePosition == null ) {
707
+ tree.style.listStylePosition = ListStylePosition .OUTSIDE ;
708
+ }
709
+ if (tree.name == 'ol' && tree.style.listStyleType != null && tree.style.listStyleType! .type == "marker" ) {
712
710
switch (tree.style.listStyleType! ) {
713
711
case ListStyleType .LOWER_LATIN :
714
712
case ListStyleType .LOWER_ALPHA :
@@ -728,26 +726,31 @@ class HtmlParser extends StatelessWidget {
728
726
olStack.add (Context <int >((tree.attributes['start' ] != null ? int .tryParse (tree.attributes['start' ] ?? "" ) ?? 1 : 1 ) - 1 ));
729
727
break ;
730
728
}
729
+ } else if (tree.style.display == Display .LIST_ITEM && tree.style.listStyleType != null && tree.style.listStyleType! .type == "widget" ) {
730
+ tree.style.markerContent = tree.style.listStyleType! .widget! ;
731
+ } else if (tree.style.display == Display .LIST_ITEM && tree.style.listStyleType != null && tree.style.listStyleType! .type == "image" ) {
732
+ tree.style.markerContent = Image .network (tree.style.listStyleType! .text);
731
733
} else if (tree.style.display == Display .LIST_ITEM && tree.style.listStyleType != null ) {
734
+ String marker = "" ;
732
735
switch (tree.style.listStyleType! ) {
733
736
case ListStyleType .NONE :
734
737
tree.style.markerContent = '' ;
735
738
break ;
736
739
case ListStyleType .CIRCLE :
737
- tree.style.markerContent = '○' ;
740
+ marker = '○' ;
738
741
break ;
739
742
case ListStyleType .SQUARE :
740
- tree.style.markerContent = '■' ;
743
+ marker = '■' ;
741
744
break ;
742
745
case ListStyleType .DISC :
743
- tree.style.markerContent = '•' ;
746
+ marker = '•' ;
744
747
break ;
745
748
case ListStyleType .DECIMAL :
746
749
if (olStack.isEmpty) {
747
750
olStack.add (Context <int >((tree.attributes['start' ] != null ? int .tryParse (tree.attributes['start' ] ?? "" ) ?? 1 : 1 ) - 1 ));
748
751
}
749
752
olStack.last.data += 1 ;
750
- tree.style.markerContent = '${olStack .last .data }.' ;
753
+ marker = '${olStack .last .data }.' ;
751
754
break ;
752
755
case ListStyleType .LOWER_LATIN :
753
756
case ListStyleType .LOWER_ALPHA :
@@ -762,7 +765,7 @@ class HtmlParser extends StatelessWidget {
762
765
}
763
766
}
764
767
}
765
- tree.style.markerContent = olStack.last.data.toString () + "." ;
768
+ marker = olStack.last.data.toString () + "." ;
766
769
olStack.last.data = olStack.last.data.toString ().nextLetter ();
767
770
break ;
768
771
case ListStyleType .UPPER_LATIN :
@@ -778,7 +781,7 @@ class HtmlParser extends StatelessWidget {
778
781
}
779
782
}
780
783
}
781
- tree.style.markerContent = olStack.last.data.toString ().toUpperCase () + "." ;
784
+ marker = olStack.last.data.toString ().toUpperCase () + "." ;
782
785
olStack.last.data = olStack.last.data.toString ().nextLetter ();
783
786
break ;
784
787
case ListStyleType .LOWER_ROMAN :
@@ -787,9 +790,9 @@ class HtmlParser extends StatelessWidget {
787
790
}
788
791
olStack.last.data += 1 ;
789
792
if (olStack.last.data <= 0 ) {
790
- tree.style.markerContent = '${olStack .last .data }.' ;
793
+ marker = '${olStack .last .data }.' ;
791
794
} else {
792
- tree.style.markerContent = (olStack.last.data as int ).toRomanNumeralString ()! .toLowerCase () + "." ;
795
+ marker = (olStack.last.data as int ).toRomanNumeralString ()! .toLowerCase () + "." ;
793
796
}
794
797
break ;
795
798
case ListStyleType .UPPER_ROMAN :
@@ -798,12 +801,16 @@ class HtmlParser extends StatelessWidget {
798
801
}
799
802
olStack.last.data += 1 ;
800
803
if (olStack.last.data <= 0 ) {
801
- tree.style.markerContent = '${olStack .last .data }.' ;
804
+ marker = '${olStack .last .data }.' ;
802
805
} else {
803
- tree.style.markerContent = (olStack.last.data as int ).toRomanNumeralString ()! + "." ;
806
+ marker = (olStack.last.data as int ).toRomanNumeralString ()! + "." ;
804
807
}
805
808
break ;
806
809
}
810
+ tree.style.markerContent = Text (
811
+ marker,
812
+ textAlign: TextAlign .right,
813
+ );
807
814
}
808
815
809
816
tree.children.forEach ((e) => _processListCharactersRecursive (e, olStack));
0 commit comments