mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 07:47:24 +00:00
fix editor font
This commit is contained in:
@@ -67,10 +67,6 @@ class _CodeEditorState extends State<CodeEditor> {
|
|||||||
child: IntrinsicWidth(
|
child: IntrinsicWidth(
|
||||||
stepWidth: 100,
|
stepWidth: 100,
|
||||||
child: TextField(
|
child: TextField(
|
||||||
style: TextStyle(
|
|
||||||
fontFamily: 'consolas',
|
|
||||||
fontFamilyFallback: ['Courier New', 'monospace'],
|
|
||||||
),
|
|
||||||
controller: _controller,
|
controller: _controller,
|
||||||
focusNode: _focusNode,
|
focusNode: _focusNode,
|
||||||
maxLines: null,
|
maxLines: null,
|
||||||
@@ -124,6 +120,20 @@ class _CodeTextEditingController extends TextEditingController {
|
|||||||
theme: _theme!,
|
theme: _theme!,
|
||||||
);
|
);
|
||||||
var result = highlighter.highlight(text);
|
var result = highlighter.highlight(text);
|
||||||
|
style = TextStyle(
|
||||||
|
fontFamily: 'consolas',
|
||||||
|
fontFamilyFallback: ['Courier New', 'monospace'],
|
||||||
|
);
|
||||||
|
|
||||||
|
return setTextSpanFont(result, style);
|
||||||
|
}
|
||||||
|
|
||||||
|
TextSpan setTextSpanFont(TextSpan span, TextStyle style) {
|
||||||
|
var result = TextSpan(
|
||||||
|
style: style.merge(span.style),
|
||||||
|
children: span.children?.whereType().map((e) => setTextSpanFont(e, style)).toList(),
|
||||||
|
text: span.text,
|
||||||
|
);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user