mirror of
https://github.com/simon-ding/polaris.git
synced 2026-05-26 20:47:57 +08:00
feat: do not modify buildin downloader
This commit is contained in:
@@ -290,6 +290,10 @@ class DownloadClient {
|
|||||||
data["remove_failed_downloads"] = removeFailedDownloads;
|
data["remove_failed_downloads"] = removeFailedDownloads;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool idExists() {
|
||||||
|
return id != null && id != 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class StorageSettingData extends AutoDisposeAsyncNotifier<List<Storage>> {
|
class StorageSettingData extends AutoDisposeAsyncNotifier<List<Storage>> {
|
||||||
|
|||||||
@@ -68,11 +68,13 @@ class _DownloaderState extends ConsumerState<DownloaderSettings> {
|
|||||||
children: [
|
children: [
|
||||||
FormBuilderTextField(
|
FormBuilderTextField(
|
||||||
name: "name",
|
name: "name",
|
||||||
|
enabled: client.idExists(),
|
||||||
decoration: const InputDecoration(labelText: "名称"),
|
decoration: const InputDecoration(labelText: "名称"),
|
||||||
validator: FormBuilderValidators.required(),
|
validator: FormBuilderValidators.required(),
|
||||||
autovalidateMode: AutovalidateMode.onUserInteraction),
|
autovalidateMode: AutovalidateMode.onUserInteraction),
|
||||||
FormBuilderTextField(
|
FormBuilderTextField(
|
||||||
name: "url",
|
name: "url",
|
||||||
|
enabled: client.idExists(),
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
labelText: "地址", hintText: "http://127.0.0.1:9091"),
|
labelText: "地址", hintText: "http://127.0.0.1:9091"),
|
||||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
@@ -80,6 +82,7 @@ class _DownloaderState extends ConsumerState<DownloaderSettings> {
|
|||||||
),
|
),
|
||||||
FormBuilderTextField(
|
FormBuilderTextField(
|
||||||
name: "priority",
|
name: "priority",
|
||||||
|
enabled: client.idExists(),
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
labelText: "优先级", helperText: "1-50, 1最高优先级,50最低优先级"),
|
labelText: "优先级", helperText: "1-50, 1最高优先级,50最低优先级"),
|
||||||
validator: FormBuilderValidators.integer(),
|
validator: FormBuilderValidators.integer(),
|
||||||
@@ -96,6 +99,7 @@ class _DownloaderState extends ConsumerState<DownloaderSettings> {
|
|||||||
children: [
|
children: [
|
||||||
FormBuilderSwitch(
|
FormBuilderSwitch(
|
||||||
name: "auth",
|
name: "auth",
|
||||||
|
enabled: client.idExists(),
|
||||||
title: const Text("需要认证"),
|
title: const Text("需要认证"),
|
||||||
initialValue: _enableAuth,
|
initialValue: _enableAuth,
|
||||||
onChanged: (v) {
|
onChanged: (v) {
|
||||||
@@ -162,7 +166,7 @@ class _DownloaderState extends ConsumerState<DownloaderSettings> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return showSettingDialog(
|
return showSettingDialog(
|
||||||
context, title, client.id != null, body, onSubmit, onDelete);
|
context, title, client.idExists(), body, onSubmit, onDelete);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> showSelections() {
|
Future<void> showSelections() {
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
flutter run -d edge --no-web-resources-cdn --web-browser-flag "--disable-web-security"
|
flutter run -d chrome --no-web-resources-cdn --web-browser-flag "--disable-web-security"
|
||||||
Reference in New Issue
Block a user