universal: style improvements (#67)

This commit is contained in:
Pacalini
2024-11-22 16:47:50 +08:00
committed by GitHub
parent 8b1f13cd33
commit 2f290f0c86
7 changed files with 69 additions and 42 deletions

View File

@@ -41,9 +41,14 @@
"Select a folder": "选择一个文件夹", "Select a folder": "选择一个文件夹",
"Folder": "文件夹", "Folder": "文件夹",
"Confirm": "确认", "Confirm": "确认",
"Are you sure you want to delete this comic?": "您确定要删除这部漫画", "Remove comic from favorite?": "从收藏中移除漫画?",
"Are you sure you want to delete @a selected comics?": "您确定要删除 @a 部漫画吗?", "Move": "移动",
"Move to folder": "移动到文件夹",
"Copy to folder": "复制到文件夹",
"Delete Comic": "删除漫画",
"Delete @c comics?": "删除 @c 本漫画?",
"Add comic source": "添加漫画源", "Add comic source": "添加漫画源",
"Delete comic source '@n' ?": "删除漫画源 '@n' ",
"Select file": "选择文件", "Select file": "选择文件",
"View list": "查看列表", "View list": "查看列表",
"Open help": "打开帮助", "Open help": "打开帮助",
@@ -132,7 +137,8 @@
"Block": "屏蔽", "Block": "屏蔽",
"Add new favorite to": "添加新收藏到", "Add new favorite to": "添加新收藏到",
"Move favorite after reading": "阅读后移动收藏", "Move favorite after reading": "阅读后移动收藏",
"Are you sure you want to delete this folder?" : "确定要删除这个收藏夹吗", "Delete folder?" : "刪除文件夾",
"Delete folder '@f' ?" : "删除文件夹 '@f' ",
"Import from file": "从文件导入", "Import from file": "从文件导入",
"Failed to import": "导入失败", "Failed to import": "导入失败",
"Cache Limit": "缓存限制", "Cache Limit": "缓存限制",
@@ -215,7 +221,7 @@
"Authorization Required": "需要身份验证", "Authorization Required": "需要身份验证",
"Sync": "同步", "Sync": "同步",
"The folder is Linked to @source": "文件夹已关联到 @source", "The folder is Linked to @source": "文件夹已关联到 @source",
"Source Folder": "源收藏夹", "Source Folder": "源文件夹",
"Use a config file": "使用配置文件", "Use a config file": "使用配置文件",
"Comic Source list": "漫画源列表", "Comic Source list": "漫画源列表",
"View": "查看", "View": "查看",
@@ -235,9 +241,7 @@
"Also remove files on disk": "同时删除磁盘上的文件", "Also remove files on disk": "同时删除磁盘上的文件",
"New version available": "有新版本可用", "New version available": "有新版本可用",
"A new version is available. Do you want to update now?" : "有新版本可用。您要现在更新吗?", "A new version is available. Do you want to update now?" : "有新版本可用。您要现在更新吗?",
"No new version available": "没有新版本可用", "No new version available": "没有新版本可用"
"Move": "移动",
"Move to favorites": "移动至收藏"
}, },
"zh_TW": { "zh_TW": {
"Home": "首頁", "Home": "首頁",
@@ -283,9 +287,14 @@
"Select a folder": "選擇一個文件夾", "Select a folder": "選擇一個文件夾",
"Folder": "文件夾", "Folder": "文件夾",
"Confirm": "確認", "Confirm": "確認",
"Are you sure you want to delete this comic?": "您確定要刪除這部漫畫", "Remove comic from favorite?": "從收藏中移除漫畫?",
"Are you sure you want to delete @a selected comics?": "您確定要刪除 @a 部漫畫嗎?", "Move": "移動",
"Move to folder": "移動到文件夾",
"Copy to folder": "複製到文件夾",
"Delete Comic": "刪除漫畫",
"Delete @c comics?": "刪除 @c 本漫畫?",
"Add comic source": "添加漫畫源", "Add comic source": "添加漫畫源",
"Delete comic source '@n' ?": "刪除漫畫源 '@n' ",
"Select file": "選擇文件", "Select file": "選擇文件",
"View list": "查看列表", "View list": "查看列表",
"Open help": "打開幫助", "Open help": "打開幫助",
@@ -372,7 +381,8 @@
"Block": "屏蔽", "Block": "屏蔽",
"Add new favorite to": "添加新收藏到", "Add new favorite to": "添加新收藏到",
"Move favorite after reading": "閱讀後移動收藏", "Move favorite after reading": "閱讀後移動收藏",
"Are you sure you want to delete this folder?" : "確定要刪除這個收藏夾嗎", "Delete folder?" : "刪除文件夾",
"Delete folder '@f' ?" : "刪除文件夾 '@f' ",
"Import from file": "從文件匯入", "Import from file": "從文件匯入",
"Failed to import": "匯入失敗", "Failed to import": "匯入失敗",
"Cache Limit": "緩存限制", "Cache Limit": "緩存限制",
@@ -455,7 +465,7 @@
"Authorization Required": "需要身份驗證", "Authorization Required": "需要身份驗證",
"Sync": "同步", "Sync": "同步",
"The folder is Linked to @source": "文件夾已關聯到 @source", "The folder is Linked to @source": "文件夾已關聯到 @source",
"Source Folder": "源收藏夾", "Source Folder": "源文件夾",
"Use a config file": "使用配置文件", "Use a config file": "使用配置文件",
"Comic Source list": "漫畫源列表", "Comic Source list": "漫畫源列表",
"View": "查看", "View": "查看",
@@ -475,8 +485,6 @@
"Also remove files on disk": "同時刪除磁盤上的文件", "Also remove files on disk": "同時刪除磁盤上的文件",
"New version available": "有新版本可用", "New version available": "有新版本可用",
"A new version is available. Do you want to update now?" : "有新版本可用。您要現在更新嗎?", "A new version is available. Do you want to update now?" : "有新版本可用。您要現在更新嗎?",
"No new version available": "沒有新版本可用", "No new version available": "沒有新版本可用"
"Move": "移動",
"Move to favorites": "移動至收藏"
} }
} }

View File

@@ -92,9 +92,13 @@ class _MenuRoute<T> extends PopupRoute<T> {
Icon( Icon(
entry.icon, entry.icon,
size: 18, size: 18,
color: entry.color
), ),
const SizedBox(width: 12), const SizedBox(width: 12),
Text(entry.text), Text(
entry.text,
style: TextStyle(color: entry.color)
),
], ],
), ),
), ),
@@ -119,7 +123,8 @@ class _MenuRoute<T> extends PopupRoute<T> {
class MenuEntry { class MenuEntry {
final String text; final String text;
final IconData? icon; final IconData? icon;
final Color? color;
final void Function() onClick; final void Function() onClick;
MenuEntry({required this.text, this.icon, required this.onClick}); MenuEntry({required this.text, this.icon, this.color, required this.onClick});
} }

View File

@@ -135,6 +135,7 @@ Future<void> showConfirmDialog({
required String content, required String content,
required void Function() onConfirm, required void Function() onConfirm,
String confirmText = "Confirm", String confirmText = "Confirm",
Color? btnColor,
}) { }) {
return showDialog( return showDialog(
context: context, context: context,
@@ -147,6 +148,9 @@ Future<void> showConfirmDialog({
context.pop(); context.pop();
onConfirm(); onConfirm();
}, },
style: FilledButton.styleFrom(
backgroundColor: btnColor,
),
child: Text(confirmText.tl), child: Text(confirmText.tl),
), ),
], ],

View File

@@ -231,7 +231,10 @@ class _BodyState extends State<_Body> {
showConfirmDialog( showConfirmDialog(
context: App.rootContext, context: App.rootContext,
title: "Delete".tl, title: "Delete".tl,
content: "Are you sure you want to delete it?".tl, content: "Delete comic source '@n' ?".tlParams({
"n": source.name,
}),
btnColor: context.colorScheme.error,
onConfirm: () { onConfirm: () {
var file = File(source.filePath); var file = File(source.filePath);
file.delete(); file.delete();

View File

@@ -149,22 +149,6 @@ class _LocalFavoritesPageState extends State<_LocalFavoritesPage> {
), ),
MenuButton( MenuButton(
entries: [ entries: [
MenuEntry(
icon: Icons.delete_outline,
text: "Delete Folder".tl,
onClick: () {
showConfirmDialog(
context: App.rootContext,
title: "Delete".tl,
content:
"Are you sure you want to delete this folder?".tl,
onConfirm: () {
favPage.setFolder(false, null);
LocalFavoritesManager().deleteFolder(widget.folder);
favPage.folderList?.updateFolders();
},
);
}),
MenuEntry( MenuEntry(
icon: Icons.edit_outlined, icon: Icons.edit_outlined,
text: "Rename".tl, text: "Rename".tl,
@@ -233,6 +217,26 @@ class _LocalFavoritesPageState extends State<_LocalFavoritesPage> {
} }
}); });
}), }),
MenuEntry(
icon: Icons.delete_outline,
text: "Delete Folder".tl,
color: context.colorScheme.error,
onClick: () {
showConfirmDialog(
context: App.rootContext,
title: "Delete".tl,
content:
"Delete folder '@f' ?".tlParams({
"f": widget.folder,
}),
btnColor: context.colorScheme.error,
onConfirm: () {
favPage.setFolder(false, null);
LocalFavoritesManager().deleteFolder(widget.folder);
favPage.folderList?.updateFolders();
},
);
}),
], ],
), ),
], ],
@@ -256,12 +260,12 @@ class _LocalFavoritesPageState extends State<_LocalFavoritesPage> {
actions: [ actions: [
MenuButton(entries: [ MenuButton(entries: [
MenuEntry( MenuEntry(
icon: Icons.star, icon: Icons.drive_file_move,
text: "Add to favorites".tl, text: "Move to folder".tl,
onClick: () => favoriteOption('move')), onClick: () => favoriteOption('move')),
MenuEntry( MenuEntry(
icon: Icons.drive_file_move, icon: Icons.copy,
text: "Move to favorites".tl, text: "Copy to folder".tl,
onClick: () => favoriteOption('add')), onClick: () => favoriteOption('add')),
MenuEntry( MenuEntry(
icon: Icons.select_all, icon: Icons.select_all,
@@ -277,13 +281,15 @@ class _LocalFavoritesPageState extends State<_LocalFavoritesPage> {
onClick: invertSelection), onClick: invertSelection),
MenuEntry( MenuEntry(
icon: Icons.delete_outline, icon: Icons.delete_outline,
text: "Delete Folder".tl, text: "Delete Comic".tl,
color: context.colorScheme.error,
onClick: () { onClick: () {
showConfirmDialog( showConfirmDialog(
context: context, context: context,
title: "Delete".tl, title: "Delete".tl,
content: content:
"Are you sure you want to delete this comic?".tl, "Delete @c comics?".tlParams({"c": selectedComics.length}),
btnColor: context.colorScheme.error,
onConfirm: () { onConfirm: () {
_deleteComicWithId(); _deleteComicWithId();
}, },

View File

@@ -19,8 +19,8 @@ Future<bool> _deleteComic(
bool loading = false; bool loading = false;
return StatefulBuilder(builder: (context, setState) { return StatefulBuilder(builder: (context, setState) {
return ContentDialog( return ContentDialog(
title: "Delete".tl, title: "Remove".tl,
content: Text("Are you sure you want to delete this comic?".tl) content: Text("Remove comic from favorite?".tl)
.paddingHorizontal(16), .paddingHorizontal(16),
actions: [ actions: [
Button.filled( Button.filled(
@@ -424,7 +424,7 @@ class _FolderTile extends StatelessWidget {
return StatefulBuilder(builder: (context, setState) { return StatefulBuilder(builder: (context, setState) {
return ContentDialog( return ContentDialog(
title: "Delete".tl, title: "Delete".tl,
content: Text("Are you sure you want to delete this folder?".tl) content: Text("Delete folder?".tl)
.paddingHorizontal(16), .paddingHorizontal(16),
actions: [ actions: [
Button.filled( Button.filled(

View File

@@ -111,6 +111,7 @@ class _HistoryPageState extends State<HistoryPage> {
MenuEntry( MenuEntry(
icon: Icons.remove, icon: Icons.remove,
text: 'Remove'.tl, text: 'Remove'.tl,
color: context.colorScheme.error,
onClick: () { onClick: () {
if (c.sourceKey.startsWith("Invalid")) { if (c.sourceKey.startsWith("Invalid")) {
HistoryManager().remove( HistoryManager().remove(