feat: option to enable adult content

This commit is contained in:
Simon Ding
2024-08-19 16:39:34 +08:00
parent 10e6e99990
commit 821d6859ff
7 changed files with 56 additions and 25 deletions

View File

@@ -54,6 +54,7 @@ class GeneralSetting {
bool? enablePlexmatch;
bool? allowQiangban;
bool? enableNfo;
bool? enableAdult;
GeneralSetting(
{this.tmdbApiKey,
@@ -62,7 +63,8 @@ class GeneralSetting {
this.proxy,
this.enablePlexmatch,
this.enableNfo,
this.allowQiangban});
this.allowQiangban,
this.enableAdult});
factory GeneralSetting.fromJson(Map<String, dynamic> json) {
return GeneralSetting(
@@ -70,6 +72,7 @@ class GeneralSetting {
downloadDIr: json["download_dir"],
logLevel: json["log_level"],
proxy: json["proxy"],
enableAdult: json["enable_adult_content"]??false,
allowQiangban: json["allow_qiangban"] ?? false,
enableNfo: json["enable_nfo"] ?? false,
enablePlexmatch: json["enable_plexmatch"] ?? false);
@@ -84,6 +87,7 @@ class GeneralSetting {
data["enable_plexmatch"] = enablePlexmatch;
data["allow_qiangban"] = allowQiangban;
data["enable_nfo"] = enableNfo;
data["enable_adult_content"] = enableAdult;
return data;
}
}

View File

@@ -37,6 +37,7 @@ class _GeneralState extends ConsumerState<GeneralSettings> {
"enable_plexmatch": v.enablePlexmatch,
"allow_qiangban": v.allowQiangban,
"enable_nfo": v.enableNfo,
"enable_adult": v.enableAdult,
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -81,6 +82,14 @@ class _GeneralState extends ConsumerState<GeneralSettings> {
validator: FormBuilderValidators.required(),
),
),
SizedBox(
width: 300,
child: FormBuilderSwitch(
decoration:
const InputDecoration(icon: Icon(Icons.back_hand)),
name: "enable_adult",
title: const Text("是否显示成人内容")),
),
SizedBox(
width: 300,
child: FormBuilderSwitch(
@@ -92,16 +101,17 @@ class _GeneralState extends ConsumerState<GeneralSettings> {
SizedBox(
width: 300,
child: FormBuilderSwitch(
decoration:
const InputDecoration(icon: Icon(Icons.library_books), helperText: "emby/kodi等软件刮削需要"),
decoration: const InputDecoration(
icon: Icon(Icons.library_books),
helperText: "emby/kodi等软件刮削需要"),
name: "enable_nfo",
title: const Text("nfo 文件支持")),
),
SizedBox(
width: 300,
child: FormBuilderSwitch(
decoration:
const InputDecoration(icon: Icon(Icons.remove_circle)),
decoration: const InputDecoration(
icon: Icon(Icons.remove_circle)),
name: "allow_qiangban",
title: const Text("是否下载枪版资源")),
),
@@ -124,6 +134,7 @@ class _GeneralState extends ConsumerState<GeneralSettings> {
logLevel: values["log_level"],
proxy: values["proxy"],
allowQiangban: values["allow_qiangban"],
enableAdult: values["enable_adult"],
enableNfo: values["enable_nfo"],
enablePlexmatch:
values["enable_plexmatch"]))