Serie Context Menu

This commit is contained in:
2025-11-04 17:33:12 +01:00
parent 982654273b
commit 3086a751ec
11 changed files with 929 additions and 423 deletions
@@ -31,7 +31,11 @@ final seriesGroupedProvider =
continue; // retry same offset with smaller page
}
// If we already have some data, return partial results to unblock UI
if (items.isNotEmpty) break; else rethrow;
if (items.isNotEmpty) {
break;
} else {
rethrow;
}
}
consecutiveFailures = 0;
if (page.isEmpty) break;
@@ -214,35 +214,6 @@ class _SeriesDetailScreenState extends ConsumerState<SeriesDetailScreen> {
bool _saved = false;
void _setEpisodeStatus(EpisodeItem ep, ItemStatus s) {
setState(() {
_pending[ep.id] = s;
// reflect change in local list so radios don't jump back after save
_seasons = {
for (final e in _seasons!.entries)
e.key: e.value
.map((it) => it.id == ep.id
? EpisodeItem(
id: it.id,
episodeNumber: it.episodeNumber,
seasonNumber: it.seasonNumber,
showName: it.showName,
name: it.name,
status: s,
resolution: it.resolution,
firstAirYear: it.firstAirYear,
showJson: it.showJson,
showStatus: it.showStatus,
showCliffhanger: it.showCliffhanger,
posterPath: it.posterPath,
showId: it.showId,
downloadPath: it.downloadPath,
)
: it)
.toList(),
};
});
}
Future<void> _setSeasonAll(int season, ItemStatus s) async {
final eps = _seasons?[season] ?? const <EpisodeItem>[];
@@ -285,10 +256,13 @@ class _SeriesDetailScreenState extends ConsumerState<SeriesDetailScreen> {
_resolution != _origResolution ||
_downloadPath != _origDownloadPath ||
_cliffhanger != _origCliffhanger;
return WillPopScope(
onWillPop: () async {
Navigator.of(context).pop(_saved ? 'updated' : null);
return false;
return PopScope(
canPop: true,
onPopInvokedWithResult: (didPop, result) async {
if (didPop) return;
if (context.mounted) {
Navigator.of(context).pop(_saved ? 'updated' : null);
}
},
child: Scaffold(
extendBodyBehindAppBar: true,
@@ -303,6 +277,7 @@ class _SeriesDetailScreenState extends ConsumerState<SeriesDetailScreen> {
onPressed: _tmdbId == null
? null
: () async {
final messenger = ScaffoldMessenger.of(context);
try {
final tmdb = ref.read(tmdbApiProvider);
final backend = ref.read(backendApiProvider);
@@ -353,17 +328,13 @@ class _SeriesDetailScreenState extends ConsumerState<SeriesDetailScreen> {
// ignore: unused_result
ref.invalidate(seriesGroupedProvider);
await _load();
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('TMDB Daten aktualisiert')),
);
}
messenger.showSnackBar(
const SnackBar(content: Text('TMDB Daten aktualisiert')),
);
} catch (e) {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('TMDB Update fehlgeschlagen: $e')),
);
}
messenger.showSnackBar(
SnackBar(content: Text('TMDB Update fehlgeschlagen: $e')),
);
}
},
),
@@ -573,7 +544,7 @@ class _SeriesDetailScreenState extends ConsumerState<SeriesDetailScreen> {
Radio<ItemStatus>(
value: rowStatus,
groupValue: (_pending[ep.id] ?? ep.status),
fillColor: const MaterialStatePropertyAll(Colors.white),
fillColor: const WidgetStatePropertyAll(Colors.white),
onChanged: (v) {
setState(() => _pending[ep.id] = rowStatus);
},
File diff suppressed because it is too large Load Diff