mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-08 19:17:53 +08:00
feat: change single episode monitoring status
This commit is contained in:
@@ -35,7 +35,8 @@ CustomTransitionPage buildPageWithDefaultTransition<T>({
|
||||
reverseTransitionDuration: Duration.zero,
|
||||
key: state.pageKey,
|
||||
child: child,
|
||||
transitionsBuilder: (context, animation, secondaryAnimation, child) => child,
|
||||
transitionsBuilder: (context, animation, secondaryAnimation, child) =>
|
||||
child,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -123,14 +124,22 @@ class _MyAppState extends ConsumerState<MyApp> {
|
||||
child: MaterialApp.router(
|
||||
title: 'Polaris 影视追踪下载',
|
||||
theme: ThemeData(
|
||||
fontFamily: "NotoSansSC",
|
||||
colorScheme: ColorScheme.fromSeed(
|
||||
seedColor: Colors.blueAccent,
|
||||
brightness: Brightness.dark,
|
||||
surface: Colors.black54),
|
||||
useMaterial3: true,
|
||||
//scaffoldBackgroundColor: Color.fromARGB(255, 26, 24, 24)
|
||||
),
|
||||
fontFamily: "NotoSansSC",
|
||||
colorScheme: ColorScheme.fromSeed(
|
||||
seedColor: Colors.blueAccent,
|
||||
brightness: Brightness.dark,
|
||||
surface: Colors.black54),
|
||||
useMaterial3: true,
|
||||
//scaffoldBackgroundColor: Color.fromARGB(255, 26, 24, 24)
|
||||
tooltipTheme: TooltipThemeData(
|
||||
textStyle: const TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black54,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
)),
|
||||
routerConfig: router,
|
||||
),
|
||||
);
|
||||
|
||||
@@ -33,6 +33,7 @@ class APIs {
|
||||
static final logsBaseUrl = "$_baseUrl/api/v1/logs/";
|
||||
static final logFilesUrl = "$_baseUrl/api/v1/setting/logfiles";
|
||||
static final aboutUrl = "$_baseUrl/api/v1/setting/about";
|
||||
static final changeMonitoringUrl = "$_baseUrl/api/v1/setting/monitoring";
|
||||
|
||||
static final notifierAllUrl = "$_baseUrl/api/v1/notifier/all";
|
||||
static final notifierDeleteUrl = "$_baseUrl/api/v1/notifier/id/";
|
||||
|
||||
@@ -48,6 +48,19 @@ class SeriesDetailData
|
||||
var name = (sp.data as Map<String, dynamic>)["name"];
|
||||
return name;
|
||||
}
|
||||
|
||||
Future<void> changeMonitoringStatus(int episodeId, bool b) async {
|
||||
final dio = APIs.getDio();
|
||||
var resp = await dio.post(APIs.changeMonitoringUrl, data: {
|
||||
"episode_id": episodeId,
|
||||
"monitor": b,
|
||||
});
|
||||
var sp = ServerResponse.fromJson(resp.data);
|
||||
if (sp.code != 0) {
|
||||
throw sp.message;
|
||||
}
|
||||
ref.invalidateSelf();
|
||||
}
|
||||
}
|
||||
|
||||
class SeriesDetails {
|
||||
|
||||
@@ -57,15 +57,33 @@ class _TvDetailsPageState extends ConsumerState<TvDetailsPage> {
|
||||
child: Icon(Icons.download_done),
|
||||
)
|
||||
: (ep.monitored == true
|
||||
? const Tooltip(
|
||||
? Tooltip(
|
||||
message: "监控中",
|
||||
child: Icon(Icons.alarm),
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
ref
|
||||
.read(mediaDetailsProvider(
|
||||
widget.seriesId)
|
||||
.notifier)
|
||||
.changeMonitoringStatus(
|
||||
ep.id!, false);
|
||||
},
|
||||
icon: const Icon(Icons.alarm)),
|
||||
)
|
||||
: const Opacity(
|
||||
: Opacity(
|
||||
opacity: 0.7,
|
||||
child: Tooltip(
|
||||
message: "未监控",
|
||||
child: Icon(Icons.alarm_off),
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
ref
|
||||
.read(mediaDetailsProvider(
|
||||
widget.seriesId)
|
||||
.notifier)
|
||||
.changeMonitoringStatus(
|
||||
ep.id!, true);
|
||||
},
|
||||
icon: const Icon(Icons.alarm_off)),
|
||||
),
|
||||
)))),
|
||||
),
|
||||
@@ -88,10 +106,10 @@ class _TvDetailsPageState extends ConsumerState<TvDetailsPage> {
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
IconButton(
|
||||
Tooltip(message: "查看可用资源",child: IconButton(
|
||||
onPressed: () => showAvailableTorrents(widget.seriesId,
|
||||
ep.seasonNumber ?? 0, ep.episodeNumber ?? 0),
|
||||
icon: const Icon(Icons.manage_search))
|
||||
icon: const Icon(Icons.manage_search)),)
|
||||
],
|
||||
))
|
||||
]);
|
||||
@@ -136,10 +154,10 @@ class _TvDetailsPageState extends ConsumerState<TvDetailsPage> {
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
IconButton(
|
||||
Tooltip(message: "查看可用资源",child: IconButton(
|
||||
onPressed: () =>
|
||||
showAvailableTorrents(widget.seriesId, k, 0),
|
||||
icon: const Icon(Icons.manage_search))
|
||||
icon: const Icon(Icons.manage_search)),)
|
||||
],
|
||||
))
|
||||
], rows: m[k]!),
|
||||
|
||||
@@ -68,13 +68,10 @@ class _DetailCardState extends ConsumerState<DetailCard> {
|
||||
const SizedBox(
|
||||
width: 30,
|
||||
),
|
||||
Text(
|
||||
Expanded(child: Text(
|
||||
"${widget.details.mediaType == "tv" ? widget.details.storage!.tvPath : widget.details.storage!.moviePath}"
|
||||
"${widget.details.targetDir}"),
|
||||
const SizedBox(
|
||||
width: 30,
|
||||
),
|
||||
],
|
||||
"${widget.details.targetDir}"),)
|
||||
],
|
||||
),
|
||||
const Divider(thickness: 1, height: 1),
|
||||
Text(
|
||||
|
||||
Reference in New Issue
Block a user