@@ -294,6 +294,15 @@ class HtmlParser extends StatelessWidget {
294294 ),
295295 );
296296 } else if (tree.style? .display == Display .LIST_ITEM ) {
297+ List <InlineSpan > getChildren (StyledElement tree) {
298+ InlineSpan tabSpan = WidgetSpan (child: Text ("\t " , textAlign: TextAlign .right));
299+ List <InlineSpan > children = tree.children? .map ((tree) => parseTree (newContext, tree))? .toList () ?? [];
300+ if (tree.style? .listStylePosition == ListStylePosition .INSIDE ) {
301+ children.insert (0 , tabSpan);
302+ }
303+ return children;
304+ }
305+
297306 return WidgetSpan (
298307 child: ContainerSpan (
299308 newContext: newContext,
@@ -308,25 +317,29 @@ class HtmlParser extends StatelessWidget {
308317 tree.style? .listStylePosition == null ?
309318 Padding (
310319 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 ),
311- child: Text ('${newContext .style .markerContent }\t ' ,
320+ child: Text (
321+ newContext.style.markerContent,
312322 textAlign: TextAlign .right,
313- style: newContext.style.generateTextStyle ()),
323+ style: newContext.style.generateTextStyle ()
324+ ),
314325 ) : Container (height: 0 , width: 0 ),
326+ Text ("\t " , textAlign: TextAlign .right),
315327 Expanded (
316- child: StyledText (
317- textSpan: TextSpan (
318- text: (tree.style? .listStylePosition ==
319- ListStylePosition .INSIDE )
320- ? '${newContext .style .markerContent }\t '
321- : null ,
322- children: tree.children
323- ? .map ((tree) => parseTree (newContext, tree))
324- ? .toList () ??
325- [],
326- style: newContext.style.generateTextStyle (),
327- ),
328- style: newContext.style,
329- renderContext: context,
328+ child: Padding (
329+ padding: tree.style? .listStylePosition == ListStylePosition .INSIDE ?
330+ EdgeInsets .only (left: tree.style? .direction != TextDirection .rtl ? 10.0 : 0.0 , right: tree.style? .direction == TextDirection .rtl ? 10.0 : 0.0 ) : EdgeInsets .zero,
331+ child: StyledText (
332+ textSpan: TextSpan (
333+ text: (tree.style? .listStylePosition ==
334+ ListStylePosition .INSIDE )
335+ ? '${newContext .style .markerContent }'
336+ : null ,
337+ children: getChildren (tree),
338+ style: newContext.style.generateTextStyle (),
339+ ),
340+ style: newContext.style,
341+ renderContext: context,
342+ )
330343 )
331344 )
332345 ],
0 commit comments