Skip to content

Commit ccde72a

Browse files
committed
Merge latest changes
1 parent c6b030e commit ccde72a

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

example/lib/main.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,6 @@ class _MyHomePageState extends State<MyHomePage> {
251251
body: SingleChildScrollView(
252252
child: Html(
253253
data: htmlData,
254-
tagsList: Html.tags..addAll(["bird", "flutter"]),
255254
style: {
256255
"table": Style(
257256
backgroundColor: Color.fromARGB(0x50, 0xee, 0xee, 0xee),

lib/custom_render.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import 'package:collection/collection.dart';
22
import 'package:flutter/gestures.dart';
33
import 'package:flutter/material.dart';
44
import 'package:flutter_html/flutter_html.dart';
5-
import 'package:flutter_html/html_parser.dart';
65
import 'package:flutter_html/src/utils.dart';
76

87
typedef CustomRenderMatcher = bool Function(RenderContext context);
@@ -133,7 +132,7 @@ CustomRender listElementRender({
133132
children: [
134133
(style?.listStylePosition ?? context.tree.style.listStylePosition) == ListStylePosition.OUTSIDE ?
135134
Padding(
136-
padding: style?.padding ?? context.tree.style.padding
135+
padding: style?.padding?.nonNegative ?? context.tree.style.padding?.nonNegative
137136
?? EdgeInsets.only(left: (style?.direction ?? context.tree.style.direction) != TextDirection.rtl ? 10.0 : 0.0,
138137
right: (style?.direction ?? context.tree.style.direction) == TextDirection.rtl ? 10.0 : 0.0),
139138
child: Text(
@@ -142,7 +141,7 @@ CustomRender listElementRender({
142141
style: style?.generateTextStyle() ?? context.style.generateTextStyle()
143142
),
144143
) : Container(height: 0, width: 0),
145-
Text("\t", textAlign: TextAlign.right),
144+
Text("\t", textAlign: TextAlign.right, style: TextStyle(fontWeight: FontWeight.w400)),
146145
Expanded(
147146
child: Padding(
148147
padding: (style?.listStylePosition ?? context.tree.style.listStylePosition) == ListStylePosition.INSIDE ?
@@ -176,7 +175,7 @@ CustomRender replacedElementRender({PlaceholderAlignment? alignment, TextBaselin
176175

177176
CustomRender textContentElementRender({String? text}) =>
178177
CustomRender.inlineSpan(inlineSpan: (context, buildChildren) =>
179-
TextSpan(text: text ?? (context.tree as TextContentElement).text));
178+
TextSpan(text: (text ?? (context.tree as TextContentElement).text).transformed(context.tree.style.textTransform)));
180179

181180
CustomRender interactableElementRender({List<InlineSpan>? children}) =>
182181
CustomRender.inlineSpan(inlineSpan: (context, buildChildren) => TextSpan(
@@ -238,9 +237,11 @@ final Map<CustomRenderMatcher, CustomRender> defaultRenders = {
238237
};
239238

240239
List<InlineSpan> _getListElementChildren(ListStylePosition? position, Function() buildChildren) {
241-
InlineSpan tabSpan = WidgetSpan(child: Text("\t", textAlign: TextAlign.right));
242240
List<InlineSpan> children = buildChildren.call();
243241
if (position == ListStylePosition.INSIDE) {
242+
final tabSpan = WidgetSpan(
243+
child: Text("\t", textAlign: TextAlign.right, style: TextStyle(fontWeight: FontWeight.w400)),
244+
);
244245
children.insert(0, tabSpan);
245246
}
246247
return children;

lib/html_parser.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,9 @@ class HtmlParser extends StatelessWidget {
344344

345345
for (final entry in customRenders.keys) {
346346
if (entry.call(newContext)) {
347-
final buildChildren = () => tree.children.map((tree) => parseTree(context, tree)).toList();
347+
final buildChildren = () => tree.children.map((tree) => parseTree(newContext, tree)).toList();
348348
if (newContext.parser.selectable && customRenders[entry] is SelectableCustomRender) {
349-
final selectableBuildChildren = () => tree.children.map((tree) => parseTree(context, tree) as TextSpan).toList();
349+
final selectableBuildChildren = () => tree.children.map((tree) => parseTree(newContext, tree) as TextSpan).toList();
350350
return (customRenders[entry] as SelectableCustomRender).textSpan.call(newContext, selectableBuildChildren);
351351
}
352352
if (newContext.parser.selectable) {

0 commit comments

Comments
 (0)