diff --git a/assets/translation.json b/assets/translation.json index fa5b53d..44f5018 100644 --- a/assets/translation.json +++ b/assets/translation.json @@ -353,7 +353,11 @@ "No updates found": "未找到更新", "All Comics": "全部漫画", "The comic will be marked as no updates as soon as you read it.": "漫画将在您阅读后立即标记为无更新", - "Disable": "禁用" + "Disable": "禁用", + "Once the operation is successful, app will automatically sync data with the server.": "操作成功后, APP将自动与服务器同步数据", + "Webdav is enabled." : "已启用Webdav", + "Cache cleared": "缓存已清除", + "Disabled": "已禁用" }, "zh_TW": { "Home": "首頁", @@ -709,6 +713,10 @@ "No updates found": "未找到更新", "All Comics": "全部漫畫", "The comic will be marked as no updates as soon as you read it.": "漫畫將在您閱讀後立即標記為無更新", - "Disable": "禁用" + "Disable": "禁用", + "Once the operation is successful, app will automatically sync data with the server.": "操作成功後, APP將自動與服務器同步數據", + "Webdav is enabled." : "已啟用Webdav", + "Cache cleared": "緩存已清除", + "Disabled": "已禁用" } } \ No newline at end of file diff --git a/lib/pages/settings/app.dart b/lib/pages/settings/app.dart index c324af9..3415aea 100644 --- a/lib/pages/settings/app.dart +++ b/lib/pages/settings/app.dart @@ -332,8 +332,8 @@ class _WebdavSettingState extends State<_WebdavSetting> { String pass = ""; bool isTesting = false; - bool upload = true; + bool isEnabled = false; @override void initState() { @@ -348,6 +348,7 @@ class _WebdavSettingState extends State<_WebdavSetting> { url = configs[0]; user = configs[1]; pass = configs[2]; + isEnabled = true; } @override @@ -411,6 +412,49 @@ 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), + ), + ], + ), + ), + if (isEnabled) + Container( + padding: const EdgeInsets.all(8), + decoration: BoxDecoration( + color: Theme.of(context).colorScheme.primaryContainer, + borderRadius: BorderRadius.circular(8), + ), + child: Row( + children: [ + const Icon(Icons.sync, size: 20), + const SizedBox(width: 8), + Expanded( + child: Text("Webdav is enabled.".tl), + ), + Button.text( + onPressed: () { + appdata.settings['webdav'] = []; + appdata.saveData(); + context.showMessage(message: "Disabled".tl); + App.rootPop(); + }, + child: Text("Disable".tl), + ) + ], + ), + ).paddingTop(16), + const SizedBox(height: 16), Center( child: Button.filled( isLoading: isTesting,