improve download subpath

This commit is contained in:
wgh136
2024-05-16 10:55:49 +08:00
parent 945d386d17
commit 1698928212
5 changed files with 39 additions and 52 deletions

View File

@@ -282,8 +282,6 @@ class _SetDownloadSubPathPage extends StatefulWidget {
class __SetDownloadSubPathPageState extends State<_SetDownloadSubPathPage> {
final controller =
TextEditingController(text: appdata.settings["downloadSubPath"]);
final controller2 =
TextEditingController(text: appdata.settings["tagsWeight"]);
@override
Widget build(BuildContext context) {
@@ -297,26 +295,6 @@ class __SetDownloadSubPathPageState extends State<_SetDownloadSubPathPage> {
TextBox(
controller: controller,
).paddingHorizontal(16),
Text("Weights of the tags".tl)
.padding(const EdgeInsets.symmetric(vertical: 8, horizontal: 16)),
TextBox(
controller: controller2,
).paddingHorizontal(16),
const SizedBox(
height: 8,
),
ListTile(
title: Text("Use translated tag name".tl),
trailing: ToggleSwitch(
checked: appdata.settings["useTranslatedNameForDownload"],
onChanged: (value) {
setState(() {
appdata.settings["useTranslatedNameForDownload"] = value;
});
appdata.writeSettings();
},
),
),
const SizedBox(
height: 8,
),
@@ -326,7 +304,6 @@ class __SetDownloadSubPathPageState extends State<_SetDownloadSubPathPage> {
var text = controller.text;
if (check(text)) {
appdata.settings["downloadSubPath"] = text;
appdata.settings["tagsWeight"] = controller2.text;
appdata.writeData();
context.pop();
} else {
@@ -360,15 +337,9 @@ ${"Some keywords will be replaced by the following rule:".tl}
\${id} -> ${"Artwork ID".tl}
\${index} -> ${"Index of the image in the artwork".tl}
\${ext} -> ${"File extension".tl}
\${AI} -> ${"Replace with 'AI' if the work was generated by AI, otherwise replace with blank".tl}
\${tag{*}} -> ${"Replace with * if the work have tag *, otherwise replace with blank.".tl}
${"Tags: Tags will be sorted by the \"Weights of tags\" setting and replaced by the following rule:".tl}
${"The final text will be affected by the \"Use translated tag name\" setting.".tl}
\${tag0} -> ${"The first tag of the artwork".tl}
\${tag1} -> ${"The second tag of the artwork".tl}
...
${"Weights of the tags".tl}:
${"Filled with tags. The tags should be separated by a space. The tag in front has higher weight.".tl}
${"It is required to use the original name instead of the translated name.".tl}
${"Multiple path separators will be automatically replaced with a single".tl}
""";
}