Skip to content

Commit c644ae1

Browse files
committed
fix: vertex text style background not working.
1 parent d052265 commit c644ae1

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 1.0.4+1
2+
- fix: vertex text style `background` not working.
3+
14
## 1.0.4
25
- feat: support specifying vertex text style.
36

lib/core/options/text/vertex_text_renderer_impl.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class VertexTextRendererImpl extends VertexTextRenderer {
2121
var paragraphFontSize = vertexTextStyle?.fontSize ?? 14;
2222
var fontWeight = vertexTextStyle?.fontWeight ?? FontWeight.normal;
2323
var fontColor = vertexTextStyle?.color;
24+
var backgroundColor = vertexTextStyle?.backgroundColor;
2425

2526
/// 1.生成 ParagraphStyle,可设置文本的基本信息
2627
final paragraphStyle = ui.ParagraphStyle(
@@ -39,6 +40,8 @@ class VertexTextRendererImpl extends VertexTextRenderer {
3940
fontSize: fontSize,
4041
foreground: fontColor != null ? (Paint()..color = fontColor) : paint,
4142
fontWeight: fontWeight,
43+
background:
44+
backgroundColor == null ? null : (Paint()..color = backgroundColor),
4245
);
4346

4447
/// 3.添加样式和文字
@@ -52,7 +55,8 @@ class VertexTextRendererImpl extends VertexTextRenderer {
5255
TextPainter hpainter = TextPainter(
5356
textDirection: TextDirection.ltr,
5457
text: TextSpan(
55-
style: const TextStyle(fontSize: 16),
58+
style:
59+
TextStyle(fontSize: paragraphFontSize + 2, fontWeight: fontWeight),
5660
text: text,
5761
),
5862
)..layout();

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flutter_graph_view
22
description: Widgets for beautiful graphic data structures, such as force-oriented diagrams.
3-
version: 1.0.4
3+
version: 1.0.4+1
44
repository: https://github.com/dudu-ltd/flutter_graph_view
55
homepage: https://graph-cn.github.io/flutter_graph_view
66

0 commit comments

Comments
 (0)