mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-10 20:17:49 +08:00
fix: storage selector
This commit is contained in:
@@ -156,6 +156,7 @@ class _SearchPageState extends ConsumerState<SearchPage> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
DropdownMenu(
|
DropdownMenu(
|
||||||
|
width: 200,
|
||||||
label: const Text("清晰度"),
|
label: const Text("清晰度"),
|
||||||
initialSelection: resSelected,
|
initialSelection: resSelected,
|
||||||
dropdownMenuEntries: const [
|
dropdownMenuEntries: const [
|
||||||
@@ -175,6 +176,7 @@ class _SearchPageState extends ConsumerState<SearchPage> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
DropdownMenu(
|
DropdownMenu(
|
||||||
|
width: 200,
|
||||||
label: const Text("存储位置"),
|
label: const Text("存储位置"),
|
||||||
initialSelection: storageSelected,
|
initialSelection: storageSelected,
|
||||||
dropdownMenuEntries: v
|
dropdownMenuEntries: v
|
||||||
|
|||||||
@@ -395,51 +395,58 @@ class _SystemSettingsPageState extends ConsumerState<SystemSettingsPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String selectImpl = s.implementation == null ? "local" : s.implementation!;
|
String selectImpl = s.implementation == null ? "local" : s.implementation!;
|
||||||
final widgets = <Widget>[
|
final widgets =
|
||||||
DropdownMenu(
|
StatefulBuilder(builder: (BuildContext context, StateSetter setState) {
|
||||||
label: const Text("类型"),
|
return Column(
|
||||||
onSelected: (value) {
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
setState(() {
|
children: <Widget>[
|
||||||
selectImpl = value!;
|
DropdownMenu(
|
||||||
});
|
label: const Text("类型"),
|
||||||
},
|
onSelected: (value) {
|
||||||
initialSelection: selectImpl,
|
setState(() {
|
||||||
dropdownMenuEntries: const [
|
selectImpl = value!;
|
||||||
DropdownMenuEntry(value: "local", label: "本地存储"),
|
});
|
||||||
DropdownMenuEntry(value: "webdav", label: "webdav")
|
},
|
||||||
|
initialSelection: selectImpl,
|
||||||
|
dropdownMenuEntries: const [
|
||||||
|
DropdownMenuEntry(value: "local", label: "本地存储"),
|
||||||
|
DropdownMenuEntry(value: "webdav", label: "webdav")
|
||||||
|
],
|
||||||
|
),
|
||||||
|
TextField(
|
||||||
|
decoration: const InputDecoration(labelText: "名称"),
|
||||||
|
controller: nameController,
|
||||||
|
),
|
||||||
|
selectImpl != "local"
|
||||||
|
? Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
TextField(
|
||||||
|
decoration: const InputDecoration(labelText: "Webdav地址"),
|
||||||
|
controller: urlController,
|
||||||
|
),
|
||||||
|
TextField(
|
||||||
|
decoration: const InputDecoration(labelText: "用户"),
|
||||||
|
controller: userController,
|
||||||
|
),
|
||||||
|
TextField(
|
||||||
|
decoration: const InputDecoration(labelText: "密码"),
|
||||||
|
controller: passController,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
TextField(
|
||||||
|
decoration: const InputDecoration(labelText: "电视剧路径"),
|
||||||
|
controller: tvPathController,
|
||||||
|
),
|
||||||
|
TextField(
|
||||||
|
decoration: const InputDecoration(labelText: "电影路径"),
|
||||||
|
controller: moviePathController,
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
);
|
||||||
TextField(
|
});
|
||||||
decoration: const InputDecoration(labelText: "名称"),
|
|
||||||
controller: nameController,
|
|
||||||
),
|
|
||||||
selectImpl != "local"
|
|
||||||
? Column(
|
|
||||||
children: [
|
|
||||||
TextField(
|
|
||||||
decoration: const InputDecoration(labelText: "Webdav地址"),
|
|
||||||
controller: urlController,
|
|
||||||
),
|
|
||||||
TextField(
|
|
||||||
decoration: const InputDecoration(labelText: "用户"),
|
|
||||||
controller: userController,
|
|
||||||
),
|
|
||||||
TextField(
|
|
||||||
decoration: const InputDecoration(labelText: "密码"),
|
|
||||||
controller: passController,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
: Container(),
|
|
||||||
TextField(
|
|
||||||
decoration: const InputDecoration(labelText: "电视剧路径"),
|
|
||||||
controller: tvPathController,
|
|
||||||
),
|
|
||||||
TextField(
|
|
||||||
decoration: const InputDecoration(labelText: "电影路径"),
|
|
||||||
controller: moviePathController,
|
|
||||||
)
|
|
||||||
];
|
|
||||||
onSubmit() async {
|
onSubmit() async {
|
||||||
return ref.read(storageSettingProvider.notifier).addStorage(Storage(
|
return ref.read(storageSettingProvider.notifier).addStorage(Storage(
|
||||||
name: nameController.text,
|
name: nameController.text,
|
||||||
@@ -458,7 +465,7 @@ class _SystemSettingsPageState extends ConsumerState<SystemSettingsPage> {
|
|||||||
return ref.read(storageSettingProvider.notifier).deleteStorage(s.id!);
|
return ref.read(storageSettingProvider.notifier).deleteStorage(s.id!);
|
||||||
}
|
}
|
||||||
|
|
||||||
return showSettingDialog('存储', s.id != null, widgets, onSubmit, onDelete);
|
return showSettingDialog('存储', s.id != null, [widgets], onSubmit, onDelete);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> showSettingDialog(
|
Future<void> showSettingDialog(
|
||||||
|
|||||||
Reference in New Issue
Block a user