example clean up
This commit is contained in:
@@ -84,22 +84,12 @@ abstract class _ParticipantWidgetState<T extends ParticipantWidget>
|
|||||||
super.didUpdateWidget(oldWidget);
|
super.didUpdateWidget(oldWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
// register for change so Flutter will re-build the widget upon change
|
// Notify Flutter that UI re-build is required, but we don't set anything here
|
||||||
void _onParticipantChanged() {
|
// since the updated values are computed properties.
|
||||||
//
|
void _onParticipantChanged() => setState(() {});
|
||||||
setState(() {
|
|
||||||
// For simplification, We are assuming here
|
|
||||||
// there is only 1 video / audio tracks.
|
|
||||||
// firstAudioPub = widget.participant.audioTracks.firstOrNull;
|
|
||||||
// firstVideoPub = widget.participant.videoTracks.firstOrNull;
|
|
||||||
// if (firstVideoPub is RemoteTrackPublication) {
|
|
||||||
// (firstVideoPub as RemoteTrackPublication).videoQuality = widget.quality;
|
|
||||||
// }
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Widgets to stack above
|
// Widgets to show above the info bar
|
||||||
List<Widget> above() => [];
|
List<Widget> extraWidgets() => [];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext ctx) => Container(
|
Widget build(BuildContext ctx) => Container(
|
||||||
@@ -134,7 +124,7 @@ abstract class _ParticipantWidgetState<T extends ParticipantWidget>
|
|||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
...above(),
|
...extraWidgets(),
|
||||||
ParticipantInfoWidget(
|
ParticipantInfoWidget(
|
||||||
title: widget.participant.identity,
|
title: widget.participant.identity,
|
||||||
audioAvailable: firstAudioPublication?.muted == false &&
|
audioAvailable: firstAudioPublication?.muted == false &&
|
||||||
@@ -189,17 +179,18 @@ class _RemoteParticipantWidgetState
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<Widget> above() => [
|
List<Widget> extraWidgets() => [
|
||||||
Row(
|
Row(
|
||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
|
// Menu for RemoteTrackPublication<RemoteVideoTrack>
|
||||||
if (firstVideoPublication != null)
|
if (firstVideoPublication != null)
|
||||||
RemoteTrackPublicationMenuWidget(
|
RemoteTrackPublicationMenuWidget(
|
||||||
pub: firstVideoPublication!,
|
pub: firstVideoPublication!,
|
||||||
icon: EvaIcons.videoOutline,
|
icon: EvaIcons.videoOutline,
|
||||||
),
|
),
|
||||||
// Menu for Audio RemoteTrackPublication
|
// Menu for RemoteTrackPublication<RemoteAudioTrack>
|
||||||
if (firstAudioPublication != null)
|
if (firstAudioPublication != null)
|
||||||
RemoteTrackPublicationMenuWidget(
|
RemoteTrackPublicationMenuWidget(
|
||||||
pub: firstAudioPublication!,
|
pub: firstAudioPublication!,
|
||||||
@@ -221,24 +212,19 @@ class RemoteTrackPublicationMenuWidget extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => Material(
|
Widget build(BuildContext context) => Material(
|
||||||
// type: MaterialType.card,
|
|
||||||
color: Colors.black.withOpacity(0.3),
|
color: Colors.black.withOpacity(0.3),
|
||||||
// shape: CircleBorder(),
|
|
||||||
child: PopupMenuButton<Function>(
|
child: PopupMenuButton<Function>(
|
||||||
// shape: CircleBorder(),
|
|
||||||
icon: Icon(icon),
|
icon: Icon(icon),
|
||||||
onSelected: (value) => value(),
|
onSelected: (value) => value(),
|
||||||
itemBuilder: (BuildContext context) {
|
itemBuilder: (BuildContext context) {
|
||||||
return <PopupMenuEntry<Function>>[
|
return <PopupMenuEntry<Function>>[
|
||||||
//
|
|
||||||
// Subscribe/Unsubscribe
|
// Subscribe/Unsubscribe
|
||||||
//
|
|
||||||
if (pub.subscribed == false)
|
if (pub.subscribed == false)
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
child: const Text('Subscribe'),
|
child: const Text('Subscribe'),
|
||||||
value: () => pub.subscribed = true,
|
value: () => pub.subscribed = true,
|
||||||
),
|
)
|
||||||
if (pub.subscribed == true)
|
else if (pub.subscribed == true)
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
child: const Text('Un-subscribe'),
|
child: const Text('Un-subscribe'),
|
||||||
value: () => pub.subscribed = false,
|
value: () => pub.subscribed = false,
|
||||||
|
|||||||
Reference in New Issue
Block a user