diff --git a/assets/translation.json b/assets/translation.json index fb4cf08..1aa4952 100644 --- a/assets/translation.json +++ b/assets/translation.json @@ -358,7 +358,7 @@ "Once the operation is successful, app will automatically sync data with the server.": "操作成功后, APP将自动与服务器同步数据", "Cache cleared": "缓存已清除", "Disabled": "已禁用", - "WebDAV Auto Sync": "WebDAV 自动同步", + "Auto Sync Data": "自动同步数据", "Mark all as read": "全部标记为已读", "Do you want to mark all as read?" : "您要全部标记为已读吗?", "Swipe down for previous chapter": "向下滑动查看上一章", @@ -372,7 +372,8 @@ "Refresh": "刷新", "Paging": "分页", "Continuous": "连续", - "Display mode of comic list": "漫画列表的显示模式" + "Display mode of comic list": "漫画列表的显示模式", + "A valid WebDav directory URL": "有效的WebDav目录URL" }, "zh_TW": { "Home": "首頁", @@ -733,7 +734,7 @@ "Once the operation is successful, app will automatically sync data with the server.": "操作成功後, APP將自動與伺服器同步資料", "Cache cleared": "快取已清除", "Disabled": "已停用", - "WebDAV Auto Sync": "WebDAV 自動同步", + "Auto Sync Data": "自動同步資料", "Mark all as read": "全部標記為已讀", "Do you want to mark all as read?" : "您要全部標記為已讀嗎?", "Swipe down for previous chapter": "向下滑動查看上一章", @@ -747,6 +748,7 @@ "Refresh": "刷新", "Paging": "分頁", "Continuous": "連續", - "Display mode of comic list": "漫畫列表的顯示模式" + "Display mode of comic list": "漫畫列表的顯示模式", + "A valid WebDav directory URL": "有效的WebDav目錄URL" } } diff --git a/lib/pages/settings/app.dart b/lib/pages/settings/app.dart index 4bb032f..e190d14 100644 --- a/lib/pages/settings/app.dart +++ b/lib/pages/settings/app.dart @@ -330,11 +330,10 @@ class _WebdavSettingState extends State<_WebdavSetting> { String url = ""; String user = ""; String pass = ""; - bool autoSync = false; + bool autoSync = true; bool isTesting = false; bool upload = true; - bool isEnabled = false; @override void initState() { @@ -349,8 +348,7 @@ class _WebdavSettingState extends State<_WebdavSetting> { url = configs[0]; user = configs[1]; pass = configs[2]; - isEnabled = true; - autoSync = appdata.implicitData['webdavAutoSync'] ?? false; + autoSync = appdata.implicitData['webdavAutoSync'] ?? true; } void onAutoSyncChanged(bool value) { @@ -368,16 +366,11 @@ class _WebdavSettingState extends State<_WebdavSetting> { body: SingleChildScrollView( child: Column( children: [ - const SizedBox(height: 12), - SwitchListTile( - title: Text("WebDAV Auto Sync".tl), - value: autoSync, - onChanged: onAutoSyncChanged, - ), const SizedBox(height: 12), TextField( - decoration: const InputDecoration( + decoration: InputDecoration( labelText: "URL", + hintText: "A valid WebDav directory URL".tl, border: OutlineInputBorder(), ), controller: TextEditingController(text: url), @@ -402,6 +395,16 @@ class _WebdavSettingState extends State<_WebdavSetting> { onChanged: (value) => pass = value, ), 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( children: [ Text("Operation".tl), @@ -428,21 +431,28 @@ class _WebdavSettingState extends State<_WebdavSetting> { ], ), const SizedBox(height: 16), - Container( - padding: const EdgeInsets.all(8), - decoration: BoxDecoration( - color: Theme.of(context).colorScheme.primaryContainer, - borderRadius: BorderRadius.circular(8), - ), - child: Row( - children: [ - 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), - ), - ], - ), + AnimatedSize( + duration: const Duration(milliseconds: 200), + child: autoSync + ? Container( + padding: const EdgeInsets.all(8), + decoration: BoxDecoration( + color: Theme.of(context).colorScheme.primaryContainer, + borderRadius: BorderRadius.circular(8), + ), + child: Row( + children: [ + 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), Center(