Skip to content

Commit 412434d

Browse files
committed
small render fixes
1 parent a834640 commit 412434d

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

lib/widgets/html_view.dart

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import 'package:flutter/cupertino.dart';
21
import 'package:flutter/material.dart';
3-
import 'package:flutter_highlight/themes/paraiso-dark.dart';
42
import 'package:habr_app/stores/app_settings.dart';
53
import 'package:provider/provider.dart';
64
import 'package:itertools/itertools.dart';
@@ -61,6 +59,13 @@ class BuildParams {
6159
required this.imagesWithPadding,
6260
this.padding,
6361
});
62+
63+
BuildParams withoutPadding() {
64+
return BuildParams(
65+
textAlign: textAlign,
66+
imagesWithPadding: false,
67+
);
68+
}
6469
}
6570

6671
Widget wrapPadding(Widget child, BuildParams params) => params.padding != null
@@ -155,13 +160,23 @@ Widget? buildTree(
155160
themeNameLight: appSettings.lightCodeTheme,
156161
);
157162
} else if (element is view.BlockQuote) {
158-
widget = BlockQuote(child: buildTree(element.child, context, params));
163+
widget = BlockQuote(
164+
child: buildTree(
165+
element.child,
166+
context,
167+
params.withoutPadding(),
168+
),
169+
);
159170
widget = wrapPadding(widget, params);
160171
} else if (element is view.BlockList) {
161172
// TODO: ordered list
162173
widget = UnorderedList(
163174
children: element.children
164-
.map<Widget?>((li) => buildTree(li, context, params))
175+
.map<Widget?>((li) => buildTree(
176+
li,
177+
context,
178+
params.withoutPadding(),
179+
))
165180
.notNull
166181
.toList());
167182
widget = wrapPadding(widget, params);

0 commit comments

Comments
 (0)