Improve WebDav UI

This commit is contained in:
2025-03-23 16:42:55 +08:00
parent 9dae28e366
commit d05eaf8c7e
2 changed files with 42 additions and 30 deletions

View File

@@ -358,7 +358,7 @@
"Once the operation is successful, app will automatically sync data with the server.": "操作成功后, APP将自动与服务器同步数据", "Once the operation is successful, app will automatically sync data with the server.": "操作成功后, APP将自动与服务器同步数据",
"Cache cleared": "缓存已清除", "Cache cleared": "缓存已清除",
"Disabled": "已禁用", "Disabled": "已禁用",
"WebDAV Auto Sync": "WebDAV 自动同步", "Auto Sync Data": "自动同步数据",
"Mark all as read": "全部标记为已读", "Mark all as read": "全部标记为已读",
"Do you want to mark all as read?" : "您要全部标记为已读吗?", "Do you want to mark all as read?" : "您要全部标记为已读吗?",
"Swipe down for previous chapter": "向下滑动查看上一章", "Swipe down for previous chapter": "向下滑动查看上一章",
@@ -372,7 +372,8 @@
"Refresh": "刷新", "Refresh": "刷新",
"Paging": "分页", "Paging": "分页",
"Continuous": "连续", "Continuous": "连续",
"Display mode of comic list": "漫画列表的显示模式" "Display mode of comic list": "漫画列表的显示模式",
"A valid WebDav directory URL": "有效的WebDav目录URL"
}, },
"zh_TW": { "zh_TW": {
"Home": "首頁", "Home": "首頁",
@@ -733,7 +734,7 @@
"Once the operation is successful, app will automatically sync data with the server.": "操作成功後, APP將自動與伺服器同步資料", "Once the operation is successful, app will automatically sync data with the server.": "操作成功後, APP將自動與伺服器同步資料",
"Cache cleared": "快取已清除", "Cache cleared": "快取已清除",
"Disabled": "已停用", "Disabled": "已停用",
"WebDAV Auto Sync": "WebDAV 自動同步", "Auto Sync Data": "自動同步資料",
"Mark all as read": "全部標記為已讀", "Mark all as read": "全部標記為已讀",
"Do you want to mark all as read?" : "您要全部標記為已讀嗎?", "Do you want to mark all as read?" : "您要全部標記為已讀嗎?",
"Swipe down for previous chapter": "向下滑動查看上一章", "Swipe down for previous chapter": "向下滑動查看上一章",
@@ -747,6 +748,7 @@
"Refresh": "刷新", "Refresh": "刷新",
"Paging": "分頁", "Paging": "分頁",
"Continuous": "連續", "Continuous": "連續",
"Display mode of comic list": "漫畫列表的顯示模式" "Display mode of comic list": "漫畫列表的顯示模式",
"A valid WebDav directory URL": "有效的WebDav目錄URL"
} }
} }

View File

@@ -330,11 +330,10 @@ class _WebdavSettingState extends State<_WebdavSetting> {
String url = ""; String url = "";
String user = ""; String user = "";
String pass = ""; String pass = "";
bool autoSync = false; bool autoSync = true;
bool isTesting = false; bool isTesting = false;
bool upload = true; bool upload = true;
bool isEnabled = false;
@override @override
void initState() { void initState() {
@@ -349,8 +348,7 @@ class _WebdavSettingState extends State<_WebdavSetting> {
url = configs[0]; url = configs[0];
user = configs[1]; user = configs[1];
pass = configs[2]; pass = configs[2];
isEnabled = true; autoSync = appdata.implicitData['webdavAutoSync'] ?? true;
autoSync = appdata.implicitData['webdavAutoSync'] ?? false;
} }
void onAutoSyncChanged(bool value) { void onAutoSyncChanged(bool value) {
@@ -368,16 +366,11 @@ class _WebdavSettingState extends State<_WebdavSetting> {
body: SingleChildScrollView( body: SingleChildScrollView(
child: Column( child: Column(
children: [ children: [
const SizedBox(height: 12),
SwitchListTile(
title: Text("WebDAV Auto Sync".tl),
value: autoSync,
onChanged: onAutoSyncChanged,
),
const SizedBox(height: 12), const SizedBox(height: 12),
TextField( TextField(
decoration: const InputDecoration( decoration: InputDecoration(
labelText: "URL", labelText: "URL",
hintText: "A valid WebDav directory URL".tl,
border: OutlineInputBorder(), border: OutlineInputBorder(),
), ),
controller: TextEditingController(text: url), controller: TextEditingController(text: url),
@@ -402,6 +395,16 @@ class _WebdavSettingState extends State<_WebdavSetting> {
onChanged: (value) => pass = value, onChanged: (value) => pass = value,
), ),
const SizedBox(height: 12), const SizedBox(height: 12),
ListTile(
leading: Icon(Icons.sync),
title: Text("Auto Sync Data".tl),
contentPadding: EdgeInsets.zero,
trailing: Switch(
value: autoSync,
onChanged: onAutoSyncChanged,
),
),
const SizedBox(height: 12),
Row( Row(
children: [ children: [
Text("Operation".tl), Text("Operation".tl),
@@ -428,21 +431,28 @@ class _WebdavSettingState extends State<_WebdavSetting> {
], ],
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
Container( AnimatedSize(
padding: const EdgeInsets.all(8), duration: const Duration(milliseconds: 200),
decoration: BoxDecoration( child: autoSync
color: Theme.of(context).colorScheme.primaryContainer, ? Container(
borderRadius: BorderRadius.circular(8), padding: const EdgeInsets.all(8),
), decoration: BoxDecoration(
child: Row( color: Theme.of(context).colorScheme.primaryContainer,
children: [ borderRadius: BorderRadius.circular(8),
const Icon(Icons.info_outline, size: 20), ),
const SizedBox(width: 8), child: Row(
Expanded( children: [
child: Text("Once the operation is successful, app will automatically sync data with the server.".tl), const Icon(Icons.info_outline, size: 20),
), const SizedBox(width: 8),
], Expanded(
), child: Text(
"Once the operation is successful, app will automatically sync data with the server."
.tl),
),
],
),
)
: const SizedBox.shrink(),
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
Center( Center(