feat(app): 增强文字元素渲染 — 多行+字号+颜色
This commit is contained in:
@@ -146,16 +146,25 @@ class _DraggableElementState extends State<DraggableElement> {
|
||||
|
||||
switch (element.elementType) {
|
||||
case ElementType.text:
|
||||
final text = element.content['text'] as String? ?? '';
|
||||
final fontSize = (element.content['fontSize'] as num?)?.toDouble() ?? 18.0;
|
||||
final fontColor = element.content['fontColor'] as String? ?? '#2D2420';
|
||||
final color = _parseColor(fontColor);
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
padding: const EdgeInsets.all(8),
|
||||
alignment: Alignment.centerLeft,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withValues(alpha: 0.9),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Text(
|
||||
element.content['text'] as String? ?? '',
|
||||
text,
|
||||
style: TextStyle(
|
||||
fontSize: (element.content['fontSize'] as num?)?.toDouble() ?? 16,
|
||||
color: _parseColor(element.content['fontColor'] as String?),
|
||||
fontSize: fontSize,
|
||||
color: color,
|
||||
fontFamily: 'NotoSansSC',
|
||||
),
|
||||
maxLines: null,
|
||||
softWrap: true,
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user