Chat: code blocks and inline code use the monospace font
This commit is contained in:
@@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/semantics.dart';
|
||||
|
||||
import '../../../../ui/layout/wheel_scroll_forwarding.dart';
|
||||
import '../../../../ui/text/monospace.dart';
|
||||
import '../sessions/chat_adaptive.dart';
|
||||
import 'chat_link_launcher.dart';
|
||||
import 'chat_link_spans.dart';
|
||||
@@ -209,7 +210,12 @@ class _ChatMarkdownViewState extends State<ChatMarkdownView> {
|
||||
decoration: BoxDecoration(color: _codeFill(context, cupertino)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: HorizontalScrollView(child: Text(code)),
|
||||
child: HorizontalScrollView(
|
||||
child: Text(
|
||||
code,
|
||||
style: const TextStyle(fontFamily: appMonospaceFamily),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -262,9 +268,12 @@ class _ChatMarkdownViewState extends State<ChatMarkdownView> {
|
||||
MarkdownPlain(text: final text) => TextSpan(text: text),
|
||||
MarkdownInlineCode(text: final text) => TextSpan(
|
||||
text: text,
|
||||
// The same host-theme surface as a fenced block marks the run as
|
||||
// code without a font, size or literal colour override.
|
||||
style: TextStyle(backgroundColor: _codeFill(context, cupertino)),
|
||||
// The same host-theme surface and monospace family as a fenced
|
||||
// block mark the run as code; the size stays the surrounding text's.
|
||||
style: TextStyle(
|
||||
fontFamily: appMonospaceFamily,
|
||||
backgroundColor: _codeFill(context, cupertino),
|
||||
),
|
||||
),
|
||||
MarkdownStrong(spans: final inner) => TextSpan(
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
|
||||
Reference in New Issue
Block a user