This commit is contained in:
wgh19
2024-05-15 22:16:44 +08:00
parent 0181c4b65e
commit 4ada655bbd
4 changed files with 102 additions and 16 deletions

View File

@@ -129,7 +129,6 @@ class DownloadingTask {
String subPathPatten = appdata.settings["downloadSubPath"];
final tagsWeight = (appdata.settings["tagsWeight"] as String).split(' ');
final originalTags = List<Tag>.from(illust.tags);
print(originalTags);
originalTags.sort((a, b){
var aWeight = tagsWeight.indexOf(a.name);
if(aWeight == -1) aWeight = tagsWeight.length;
@@ -137,7 +136,6 @@ class DownloadingTask {
if(bWeight == -1) bWeight = tagsWeight.length;
return aWeight - bWeight;
});
print(originalTags);
final tags = appdata.settings["useTranslatedNameForDownload"] == false
? originalTags.map((e) => e.name).toList()
: originalTags.map((e) => e.translatedName ?? e.name).toList();

80
lib/pages/logs.dart Normal file
View File

@@ -0,0 +1,80 @@
import 'package:fluent_ui/fluent_ui.dart';
import 'package:flutter/services.dart';
import 'package:pixes/components/md.dart';
import 'package:pixes/components/title_bar.dart';
import 'package:pixes/foundation/log.dart';
class LogsPage extends StatefulWidget {
const LogsPage({super.key});
@override
State<LogsPage> createState() => _LogsPageState();
}
class _LogsPageState extends State<LogsPage> {
@override
Widget build(BuildContext context) {
return Column(
children: [
const TitleBar(title: "Logs"),
Expanded(
child: ListView.builder(
reverse: true,
controller: ScrollController(),
itemCount: Log.logs.length,
itemBuilder: (context, index){
index = Log.logs.length - index - 1;
return Padding(
padding: const EdgeInsets.fromLTRB(16, 0, 16, 8),
child: SelectionArea(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Container(
decoration: BoxDecoration(
color: ColorScheme.of(context).surfaceVariant,
borderRadius: const BorderRadius.all(Radius.circular(16)),
),
child: Padding(
padding: const EdgeInsets.fromLTRB(5, 0, 5, 1),
child: Text(Log.logs[index].title),
),
),
const SizedBox(width: 3,),
Container(
decoration: BoxDecoration(
color: [
ColorScheme.of(context).error,
ColorScheme.of(context).errorContainer,
ColorScheme.of(context).primaryContainer
][Log.logs[index].level.index],
borderRadius: const BorderRadius.all(Radius.circular(16)),
),
child: Padding(
padding: const EdgeInsets.fromLTRB(5, 0, 5, 1),
child: Text(
Log.logs[index].level.name,
style: TextStyle(color: Log.logs[index].level.index==0?Colors.white:Colors.black),),
),
),
],
),
Text(Log.logs[index].content),
Text(Log.logs[index].time.toString().replaceAll(RegExp(r"\.\w+"), "")),
Button(onPressed: (){
Clipboard.setData(ClipboardData(text: Log.logs[index].content));
}, child: const Text("复制")),
const Divider(),
],
),
),
);
},
)
)
],
);
}
}

View File

@@ -12,6 +12,8 @@ import 'package:pixes/utils/io.dart';
import 'package:pixes/utils/translation.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'logs.dart';
class SettingsPage extends StatefulWidget {
const SettingsPage({super.key});
@@ -177,6 +179,12 @@ class _SettingsPageState extends State<SettingsPage> {
onPressed: () =>
launchUrlString("https://t.me/pica_group"),
)),
buildItem(
title: "Logs",
action: IconButton(
icon: const Icon(MdIcons.open_in_new, size: 18,),
onPressed: () => context.to(() => const LogsPage())
)),
],
),
);