Merge branch 'main' into feature-minePage

This commit is contained in:
guozhigq
2024-09-28 21:24:06 +08:00
57 changed files with 3794 additions and 332 deletions

View File

@ -82,14 +82,11 @@ class PiliSchame {
case 'opus':
if (path.startsWith('/detail')) {
var opusId = path.split('/').last;
Get.toNamed(
'/webview',
parameters: {
'url': 'https://www.bilibili.com/opus/$opusId',
'type': 'url',
'pageTitle': '',
},
);
Get.toNamed('/opus', arguments: {
'title': '',
'id': opusId,
'articleType': 'opus',
});
}
break;
case 'search':
@ -97,12 +94,14 @@ class PiliSchame {
break;
case 'article':
final String id = path.split('/').last.split('?').first;
Get.toNamed('/htmlRender', parameters: {
'url': 'https://www.bilibili.com/read/cv$id',
'title': 'cv$id',
'id': 'cv$id',
'dynamicType': 'read'
});
Get.toNamed(
'/read',
parameters: {
'title': 'cv$id',
'id': id,
'dynamicType': 'read',
},
);
break;
case 'pgc':
if (path.contains('ep')) {
@ -243,12 +242,12 @@ class PiliSchame {
break;
case 'read':
print('专栏');
String id = 'cv${Utils.matchNum(query!['id']!).first}';
Get.toNamed('/htmlRender', parameters: {
String id = Utils.matchNum(query!['id']!).first.toString();
Get.toNamed('/read', parameters: {
'url': value.dataString!,
'title': '',
'id': id,
'dynamicType': 'read'
'articleType': 'read'
});
break;
case 'space':

14
lib/utils/highlight.dart Normal file
View File

@ -0,0 +1,14 @@
import 'package:flutter/material.dart';
import 'package:re_highlight/languages/all.dart';
import 'package:re_highlight/re_highlight.dart';
import 'package:re_highlight/styles/all.dart';
TextSpan? highlightExistingText(String text, List<String> languages) {
final Highlight highlight = Highlight();
highlight.registerLanguages(builtinAllLanguages);
final HighlightResult result = highlight.highlightAuto(text, languages);
final TextSpanRenderer renderer =
TextSpanRenderer(const TextStyle(), builtinAllThemes['github']!);
result.render(renderer);
return renderer.span;
}