Add runtime text shadow support

This commit is contained in:
gem
2026-06-09 11:49:24 +08:00
parent 8d2c97269a
commit 5e6a4877f4
12 changed files with 167 additions and 0 deletions

View File

@@ -968,6 +968,7 @@ class RuntimeComponent extends PositionComponent
fontWeight: node.type == RuntimeNodeType.button
? FontWeight.w600
: FontWeight.normal,
shadows: _textShadows(node),
);
final component = _textComponent;
@@ -1033,6 +1034,23 @@ class RuntimeComponent extends PositionComponent
return (node.text ?? '').contains('\n');
}
List<Shadow>? _textShadows(RuntimeNode node) {
final color = node.textShadowColor;
if (color == null) {
return null;
}
return [
Shadow(
color: composeRuntimeColorAlpha(color, renderAlpha),
offset: Offset(
node.textShadowOffsetX ?? 0,
node.textShadowOffsetY ?? 0,
),
blurRadius: node.textShadowBlur ?? 0,
),
];
}
Color _textColor(RuntimeNode node) {
if (node.type == RuntimeNodeType.button) {
return Colors.white;