Skip to content

Commit 3e33f72

Browse files
committed
make requested changes
1 parent 44cd9a6 commit 3e33f72

File tree

2 files changed

+28
-48
lines changed

2 files changed

+28
-48
lines changed

lib/html_parser.dart

Lines changed: 28 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -253,57 +253,40 @@ class HtmlParser extends StatelessWidget {
253253
),
254254
);
255255
} else if (tree.style?.display == Display.LIST_ITEM) {
256-
List<Widget> children;
257-
if (tree.style?.listStylePosition == ListStylePosition.OUTSIDE) {
258-
children = [
259-
PositionedDirectional(
260-
width: 30, //TODO derive this from list padding.
261-
start: 0,
262-
child: Text('${newContext.style.markerContent}\t',
263-
textAlign: TextAlign.right,
264-
style: newContext.style.generateTextStyle()),
265-
),
266-
Padding(
267-
padding:
268-
EdgeInsets.only(left: 30), //TODO derive this from list padding.
269-
child: StyledText(
270-
textSpan: TextSpan(
271-
children: tree.children
272-
?.map((tree) => parseTree(newContext, tree))
273-
?.toList() ??
274-
[],
275-
style: newContext.style.generateTextStyle(),
276-
),
277-
style: newContext.style,
278-
),
279-
)
280-
];
281-
} else if (tree.style?.listStylePosition == ListStylePosition.INSIDE) {
282-
children = [
283-
Padding(
284-
padding:
285-
EdgeInsets.only(left: 30), //TODO derive this from list padding.
286-
child: StyledText(
287-
textSpan: TextSpan(
288-
text: '${newContext.style.markerContent}\t',
289-
children: tree.children
290-
?.map((tree) => parseTree(newContext, tree))
291-
?.toList() ??
292-
[],
293-
style: newContext.style.generateTextStyle(),
294-
),
295-
style: newContext.style,
296-
),
297-
)
298-
];
299-
}
300256
return WidgetSpan(
301257
child: ContainerSpan(
302258
newContext: newContext,
303259
style: tree.style,
304260
shrinkWrap: context.parser.shrinkWrap,
305261
child: Stack(
306-
children: children,
262+
children: [
263+
if (tree.style?.listStylePosition == ListStylePosition.OUTSIDE || tree.style?.listStylePosition == null)
264+
PositionedDirectional(
265+
width: 30, //TODO derive this from list padding.
266+
start: 0,
267+
child: Text('${newContext.style.markerContent}\t',
268+
textAlign: TextAlign.right,
269+
style: newContext.style.generateTextStyle()),
270+
),
271+
Padding(
272+
padding: EdgeInsets.only(
273+
left: 30), //TODO derive this from list padding.
274+
child: StyledText(
275+
textSpan: TextSpan(
276+
text: (tree.style?.listStylePosition ==
277+
ListStylePosition.INSIDE)
278+
? '${newContext.style.markerContent}\t'
279+
: null,
280+
children: tree.children
281+
?.map((tree) => parseTree(newContext, tree))
282+
?.toList() ??
283+
[],
284+
style: newContext.style.generateTextStyle(),
285+
),
286+
style: newContext.style,
287+
),
288+
)
289+
],
307290
),
308291
),
309292
);

lib/style.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,6 @@ class Style {
201201
(display == Display.BLOCK || display == Display.LIST_ITEM)) {
202202
this.alignment = Alignment.centerLeft;
203203
}
204-
if (this.listStylePosition == null && display == Display.LIST_ITEM) {
205-
this.listStylePosition = ListStylePosition.OUTSIDE;
206-
}
207204
}
208205

209206
TextStyle generateTextStyle() {

0 commit comments

Comments
 (0)