mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-31 16:18:22 +08:00
opt import render theme
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -26,6 +26,7 @@ import 'package:material_design_icons_flutter/material_design_icons_flutter.dart
|
|||||||
import 'package:package_info_plus/package_info_plus.dart';
|
import 'package:package_info_plus/package_info_plus.dart';
|
||||||
import 'package:re_highlight/languages/json.dart';
|
import 'package:re_highlight/languages/json.dart';
|
||||||
import 'package:re_highlight/re_highlight.dart';
|
import 'package:re_highlight/re_highlight.dart';
|
||||||
|
import 'package:re_highlight/styles/github-dark.dart';
|
||||||
import 'package:re_highlight/styles/github.dart';
|
import 'package:re_highlight/styles/github.dart';
|
||||||
import 'package:share_plus/share_plus.dart';
|
import 'package:share_plus/share_plus.dart';
|
||||||
|
|
||||||
@@ -384,13 +385,25 @@ Future<void> showInportExportDialog<T>(
|
|||||||
SmartDialog.showToast('解析json失败:$e');
|
SmartDialog.showToast('解析json失败:$e');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final renderer = TextSpanRenderer(const TextStyle(), githubTheme);
|
final highlight = Highlight()..registerLanguage('json', langJson);
|
||||||
Highlight()
|
final result = highlight.highlight(
|
||||||
..registerLanguage('json', langJson)
|
code: formatText,
|
||||||
..highlight(code: formatText, language: 'json').render(renderer);
|
language: 'json',
|
||||||
|
);
|
||||||
|
late TextSpanRenderer renderer;
|
||||||
|
bool? isDarkMode;
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
|
final isDark = context.isDarkMode;
|
||||||
|
if (isDark != isDarkMode) {
|
||||||
|
isDarkMode = isDark;
|
||||||
|
renderer = TextSpanRenderer(
|
||||||
|
const TextStyle(),
|
||||||
|
isDark ? githubDarkTheme : githubTheme,
|
||||||
|
);
|
||||||
|
result.render(renderer);
|
||||||
|
}
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: Text('是否导入如下$title?'),
|
title: Text('是否导入如下$title?'),
|
||||||
content: SingleChildScrollView(
|
content: SingleChildScrollView(
|
||||||
|
|||||||
Reference in New Issue
Block a user