Skip to content

Commit 52be6ad

Browse files
content: Move CodeBlock padding to inside scroll view
This way, when the text is wide and needs to scroll, the padding scrolls with the text, rather than reducing the size of the viewport. See screenshots: #242 (comment)
1 parent 4589fd5 commit 52be6ad

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/widgets/content.dart

+3-2
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@ class CodeBlock extends StatelessWidget {
257257
@override
258258
Widget build(BuildContext context) {
259259
return Container(
260-
padding: const EdgeInsets.fromLTRB(7, 5, 7, 3),
261260
decoration: BoxDecoration(
262261
color: Colors.white,
263262
border: Border.all(
@@ -266,7 +265,9 @@ class CodeBlock extends StatelessWidget {
266265
borderRadius: BorderRadius.circular(4)),
267266
child: SingleChildScrollViewWithScrollbar(
268267
scrollDirection: Axis.horizontal,
269-
child: Text.rich(_buildNodes(node.spans))));
268+
child: Padding(
269+
padding: const EdgeInsets.fromLTRB(7, 5, 7, 3),
270+
child: Text.rich(_buildNodes(node.spans)))));
270271
}
271272

272273
InlineSpan _buildNodes(List<CodeBlockSpanNode> nodes) {

0 commit comments

Comments
 (0)