💄 Brightness of code block

This commit is contained in:
LittleSheep 2024-10-07 16:29:36 +08:00
parent 6876d2e7c0
commit 09dc7d2a0d

View File

@ -1,3 +1,5 @@
import 'dart:ui';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart'; import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:gap/gap.dart'; import 'package:gap/gap.dart';
@ -277,7 +279,10 @@ class _MarkdownTextCodeElement extends MarkdownElementBuilder {
await Highlighter.initialize([highlightingPath]); await Highlighter.initialize([highlightingPath]);
return Highlighter( return Highlighter(
language: highlightingPath, language: highlightingPath,
theme: await HighlighterTheme.loadLightTheme(), theme: PlatformDispatcher.instance.platformBrightness ==
Brightness.light
? await HighlighterTheme.loadLightTheme()
: await HighlighterTheme.loadDarkTheme(),
); );
})(), })(),
builder: (context, snapshot) { builder: (context, snapshot) {