From 19104323648a1d5fca866ea82057eefdbb8db936 Mon Sep 17 00:00:00 2001 From: omkar Date: Sat, 1 Feb 2025 12:01:58 +0530 Subject: [PATCH] fix: when no stream available fixed the loader --- .../service/stremio_addon_service.dart | 5 --- .../stremio/containers/stream_list.dart | 38 ++++++++++++------- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/lib/features/streamio_addons/service/stremio_addon_service.dart b/lib/features/streamio_addons/service/stremio_addon_service.dart index 7c60147..4ebf828 100644 --- a/lib/features/streamio_addons/service/stremio_addon_service.dart +++ b/lib/features/streamio_addons/service/stremio_addon_service.dart @@ -79,11 +79,6 @@ class StremioAddonService { ), ); - if (body.streams.isEmpty) { - _logger.finer('No stream data found for URL: $url'); - continue; - } - streams.addAll( body.streams.toList(), ); diff --git a/lib/features/widgetter/plugins/stremio/containers/stream_list.dart b/lib/features/widgetter/plugins/stremio/containers/stream_list.dart index b3b5e51..f8a3823 100644 --- a/lib/features/widgetter/plugins/stremio/containers/stream_list.dart +++ b/lib/features/widgetter/plugins/stremio/containers/stream_list.dart @@ -298,12 +298,14 @@ class _StreamioStreamListState extends State { ); } - context.push( - url + query.join("&"), - extra: { - "meta": widget.meta, - }, - ); + if (mounted) { + context.push( + url + query.join("&"), + extra: { + "meta": widget.meta, + }, + ); + } } } : null, @@ -527,14 +529,22 @@ class _StreamioStreamListState extends State { ), ), Expanded( - child: ListView.separated( - itemCount: filteredStreams.length, - separatorBuilder: (context, index) => const Divider(height: 1), - itemBuilder: (context, index) { - final streamData = filteredStreams[index]; - return _buildStreamCard(streamData, theme); - }, - ), + child: filteredStreams.isEmpty + ? Center( + child: Text( + "No streams found", + style: theme.textTheme.titleMedium, + ), + ) + : ListView.separated( + itemCount: filteredStreams.length, + separatorBuilder: (context, index) => + const Divider(height: 1), + itemBuilder: (context, index) { + final streamData = filteredStreams[index]; + return _buildStreamCard(streamData, theme); + }, + ), ), ], ),