add a setting for original image

This commit is contained in:
wgh19
2024-05-31 19:32:46 +08:00
parent 5e53c57755
commit 9275024050
4 changed files with 20 additions and 4 deletions

View File

@@ -159,7 +159,8 @@
"Follow the artist": "关注画师", "Follow the artist": "关注画师",
"Manga": "漫画", "Manga": "漫画",
"Actions": "操作", "Actions": "操作",
"Current quantity": "当前数量" "Current quantity": "当前数量",
"Display the original image on the details page": "在详情页显示原图"
}, },
"zh_TW": { "zh_TW": {
"Search": "搜索", "Search": "搜索",
@@ -321,6 +322,7 @@
"Follow the artist": "關注畫師", "Follow the artist": "關注畫師",
"Manga": "漫畫", "Manga": "漫畫",
"Actions": "操作", "Actions": "操作",
"Current quantity": "當前數量" "Current quantity": "當前數量",
"Display the original image on the details page": "在詳情頁顯示原圖"
} }
} }

View File

@@ -33,6 +33,7 @@ class _Appdata {
LogicalKeyboardKey.keyD.keyId, LogicalKeyboardKey.keyD.keyId,
LogicalKeyboardKey.keyF.keyId, LogicalKeyboardKey.keyF.keyId,
], ],
"showOriginalImage": false,
}; };
bool lock = false; bool lock = false;

View File

@@ -318,6 +318,10 @@ class _IllustPageState extends State<IllustPage> {
} }
Widget image; Widget image;
var imageUrl = appdata.settings["showOriginalImage"]
? widget.illust.images[index].original
: widget.illust.images[index].large;
if (!widget.illust.isUgoira) { if (!widget.illust.isUgoira) {
image = SizedBox( image = SizedBox(
width: imageWidth, width: imageWidth,
@@ -327,8 +331,7 @@ class _IllustPageState extends State<IllustPage> {
child: Image( child: Image(
key: ValueKey(index), key: ValueKey(index),
image: downloadFile == null image: downloadFile == null
? CachedImageProvider(widget.illust.images[index].large) ? CachedImageProvider(imageUrl) as ImageProvider
as ImageProvider
: FileImage(downloadFile) as ImageProvider, : FileImage(downloadFile) as ImageProvider,
width: imageWidth, width: imageWidth,
fit: BoxFit.cover, fit: BoxFit.cover,

View File

@@ -252,6 +252,16 @@ class _SettingsPageState extends State<SettingsPage> {
context.to(() => const ShortcutsSettings()); context.to(() => const ShortcutsSettings());
}, },
)), )),
buildItem(
title: "Display the original image on the details page".tl,
action: ToggleSwitch(
checked: appdata.settings['showOriginalImage'],
onChanged: (value) {
setState(() {
appdata.settings['showOriginalImage'] = value;
});
appdata.writeData();
})),
], ],
), ),
); );