mirror of
https://github.com/nostrlabs-io/zap-stream-flutter.git
synced 2025-06-16 20:08:50 +00:00
fix: filter non-m3u8 streams
This commit is contained in:
@ -24,6 +24,7 @@ class StreamGrid extends StatelessWidget {
|
|||||||
final streams =
|
final streams =
|
||||||
events
|
events
|
||||||
.map((e) => StreamEvent(e))
|
.map((e) => StreamEvent(e))
|
||||||
|
.where((e) => e.info.stream?.contains(".m3u8") ?? false)
|
||||||
.sortedBy((a) => a.info.starts ?? a.event.createdAt)
|
.sortedBy((a) => a.info.starts ?? a.event.createdAt)
|
||||||
.reversed;
|
.reversed;
|
||||||
final live = streams.where((s) => s.info.status == StreamStatus.live);
|
final live = streams.where((s) => s.info.status == StreamStatus.live);
|
||||||
@ -32,11 +33,12 @@ class StreamGrid extends StatelessWidget {
|
|||||||
return Column(
|
return Column(
|
||||||
spacing: 16,
|
spacing: 16,
|
||||||
children: [
|
children: [
|
||||||
if (showLive && live.isNotEmpty) _streamGroup(context, "Live", live),
|
if (showLive && live.isNotEmpty)
|
||||||
|
_streamGroup(context, "Live", live.toList()),
|
||||||
if (showPlanned && planned.isNotEmpty)
|
if (showPlanned && planned.isNotEmpty)
|
||||||
_streamGroup(context, "Planned", planned),
|
_streamGroup(context, "Planned", planned.toList()),
|
||||||
if (showEnded && ended.isNotEmpty)
|
if (showEnded && ended.isNotEmpty)
|
||||||
_streamGroup(context, "Ended", ended),
|
_streamGroup(context, "Ended", ended.toList()),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -64,22 +66,18 @@ class StreamGrid extends StatelessWidget {
|
|||||||
Widget _streamGroup(
|
Widget _streamGroup(
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
String title,
|
String title,
|
||||||
Iterable<StreamEvent> events,
|
List<StreamEvent> events,
|
||||||
) {
|
) {
|
||||||
final eventList = events.toList();
|
|
||||||
|
|
||||||
// profide fixed item size for performance
|
|
||||||
final q = MediaQuery.of(context);
|
|
||||||
return Column(
|
return Column(
|
||||||
spacing: 16,
|
spacing: 16,
|
||||||
children: [
|
children: [
|
||||||
_streamTitle(title),
|
_streamTitle(title),
|
||||||
ListView.builder(
|
ListView.builder(
|
||||||
itemCount: eventList.length,
|
itemCount: events.length,
|
||||||
primary: false,
|
primary: false,
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
itemBuilder: (ctx, idx) {
|
itemBuilder: (ctx, idx) {
|
||||||
final stream = eventList[idx];
|
final stream = events[idx];
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.symmetric(vertical: 8),
|
padding: EdgeInsets.symmetric(vertical: 8),
|
||||||
child: StreamTileWidget(stream),
|
child: StreamTileWidget(stream),
|
||||||
|
Reference in New Issue
Block a user