Skip to content

Commit cfe0c21

Browse files
authored
[flutter_markdown] Code decoration (#5060)
Because of using `DecoratedBox` for code block the content is above the decoration. This PR replaces `DecoratedBox` with `Container`. ![image](https://github.com/flutter/packages/assets/1847552/3203ecaf-23d3-44bd-ad73-f1369aa38020) Issue: flutter/flutter#135858
1 parent 35732b6 commit cfe0c21

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

packages/flutter_markdown/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.6.17+4
2+
3+
* Fixes an issue where a code block would overlap its container decoration.
4+
15
## 0.6.17+3
26

37
* Fixes an incorrect note about SDK versions in the 0.6.17+2 CHANGELOG.md entry.

packages/flutter_markdown/lib/src/builder.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,8 +442,9 @@ class MarkdownBuilder implements md.NodeVisitor {
442442
),
443443
);
444444
} else if (tag == 'pre') {
445-
child = DecoratedBox(
446-
decoration: styleSheet.codeblockDecoration!,
445+
child = Container(
446+
clipBehavior: Clip.hardEdge,
447+
decoration: styleSheet.codeblockDecoration,
447448
child: child,
448449
);
449450
} else if (tag == 'hr') {

packages/flutter_markdown/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: A Markdown renderer for Flutter. Create rich text output,
44
formatted with simple Markdown tags.
55
repository: https://github.com/flutter/packages/tree/main/packages/flutter_markdown
66
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+flutter_markdown%22
7-
version: 0.6.17+3
7+
version: 0.6.17+4
88

99
environment:
1010
sdk: ">=3.0.0 <4.0.0"

0 commit comments

Comments
 (0)