DarkMode: Improve markdown code blocks color

Flutter_markdown has hardcoded certain grey colors. This doesn't go well
with a dark theme. For now we're overwriting it.
This commit is contained in:
Vishesh Handa
2020-01-27 23:50:39 +01:00
parent 645892a7dc
commit 177a7c3d74

View File

@ -181,6 +181,26 @@ class NoteViewer extends StatelessWidget {
), ),
); );
// Copied from MarkdownStyleSheet except Grey is replaced with Highlight color
var markdownStyleSheet = MarkdownStyleSheet.fromTheme(theme).copyWith(
code: theme.textTheme.body1.copyWith(
backgroundColor: theme.dialogBackgroundColor,
fontFamily: "monospace",
fontSize: theme.textTheme.body1.fontSize * 0.85,
),
tableBorder: TableBorder.all(color: theme.highlightColor, width: 0),
tableCellsDecoration: BoxDecoration(color: theme.dialogBackgroundColor),
codeblockDecoration: BoxDecoration(
color: theme.dialogBackgroundColor,
borderRadius: BorderRadius.circular(2.0),
),
horizontalRuleDecoration: BoxDecoration(
border: Border(
top: BorderSide(width: 5.0, color: theme.highlightColor),
),
),
);
var view = SingleChildScrollView( var view = SingleChildScrollView(
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
@ -192,7 +212,7 @@ class NoteViewer extends StatelessWidget {
padding: const EdgeInsets.only(top: 8.0, bottom: 8.0), padding: const EdgeInsets.only(top: 8.0, bottom: 8.0),
child: MarkdownBody( child: MarkdownBody(
data: note.body, data: note.body,
styleSheet: MarkdownStyleSheet.fromTheme(theme), styleSheet: markdownStyleSheet,
onTapLink: (String link) { onTapLink: (String link) {
print("Launching " + link); print("Launching " + link);
launch(link); launch(link);