chore: update watchlist

This commit is contained in:
Simon Ding
2024-09-04 15:55:15 +08:00
parent e4c111ac2a
commit 5d4429bf7c
5 changed files with 115 additions and 10 deletions

View File

@@ -17,7 +17,7 @@ Future<void> showSettingDialog(
content: SingleChildScrollView(
child: SizedBox(
width: 400,
child: body,
child: SelectionArea(child: body),
),
),
actions: <Widget>[

View File

@@ -17,6 +17,7 @@ class Importlist extends ConsumerStatefulWidget {
}
class _ImportlistState extends ConsumerState<Importlist> {
String? _selectedType;
@override
Widget build(BuildContext context) {
var importlists = ref.watch(importlistProvider);
@@ -42,16 +43,39 @@ class _ImportlistState extends ConsumerState<Importlist> {
Future<void> showImportlistDetails(ImportList list) {
final _formKey = GlobalKey<FormBuilderState>();
setState(() {
_selectedType = list.type;
});
var body = FormBuilder(
key: _formKey,
initialValue: {
"name": list.name,
"url": list.url,
"qulity": list.qulity,
"type": list.type,
"storage_id": list.storageId
},
child: Column(
children: [
FormBuilderDropdown(
name: "type",
decoration: const InputDecoration(
labelText: "类型",
hintText:
"Plex Watchlist: https://support.plex.tv/articles/universal-watchlist/"),
items: const [
DropdownMenuItem(value: "plex", child: Text("Plex Watchlist")),
],
onChanged: (value) {
setState(() {
_selectedType = value;
});
},
),
_selectedType == "plex"
? const Text(
"Plex Watchlist: https://support.plex.tv/articles/universal-watchlist/")
: const Text(""),
FormBuilderTextField(
name: "name",
decoration: Commons.requiredTextFieldStyle(text: "名称"),
@@ -103,12 +127,12 @@ class _ImportlistState extends ConsumerState<Importlist> {
onSubmit() async {
if (_formKey.currentState!.saveAndValidate()) {
var values = _formKey.currentState!.value;
return ref.read(importlistProvider.notifier).addImportlist(ImportList(
id: list.id,
name: values["name"],
url: values["url"],
type: "plex",
type: values["type"],
qulity: values["qulity"],
storageId: values["storage_id"],
));