From fe30ada3eff905f96e7207090cb63bd6dbe8615c Mon Sep 17 00:00:00 2001 From: cloudwebrtc Date: Mon, 16 Dec 2024 17:45:21 +0800 Subject: [PATCH] fix analyze. --- example/lib/theme.dart | 8 +++--- example/lib/widgets/participant.dart | 33 +++++++++++----------- example/lib/widgets/participant_info.dart | 2 +- example/lib/widgets/participant_stats.dart | 2 +- example/lib/widgets/text_field.dart | 2 +- lib/src/core/engine.dart | 10 +++---- lib/src/publication/remote.dart | 5 ++-- 7 files changed, 29 insertions(+), 33 deletions(-) diff --git a/example/lib/theme.dart b/example/lib/theme.dart index 53f9a9cb..09b6fca8 100644 --- a/example/lib/theme.dart +++ b/example/lib/theme.dart @@ -44,7 +44,7 @@ class LiveKitTheme { // backgroundColor: WidgetStateProperty.all(accentColor), backgroundColor: WidgetStateProperty.resolveWith((states) { if (states.contains(WidgetState.disabled)) { - return accentColor.withOpacity(0.5); + return accentColor.withValues(alpha: 0.5); } return accentColor; }), @@ -59,13 +59,13 @@ class LiveKitTheme { if (states.contains(WidgetState.selected)) { return accentColor; } - return accentColor.withOpacity(0.3); + return accentColor.withValues(alpha: 0.3); }), thumbColor: WidgetStateProperty.resolveWith((states) { if (states.contains(WidgetState.selected)) { return Colors.white; } - return Colors.white.withOpacity(0.3); + return Colors.white.withValues(alpha: 0.3); }), ), dialogTheme: DialogTheme( @@ -87,7 +87,7 @@ class LiveKitTheme { color: LKColors.lkBlue, ), hintStyle: TextStyle( - color: LKColors.lkBlue.withOpacity(.5), + color: LKColors.lkBlue.withValues(alpha: 5), ), enabledBorder: InputBorder.none, focusedBorder: InputBorder.none, diff --git a/example/lib/widgets/participant.dart b/example/lib/widgets/participant.dart index 1e090646..488d1132 100644 --- a/example/lib/widgets/participant.dart +++ b/example/lib/widgets/participant.dart @@ -176,19 +176,19 @@ abstract class _ParticipantWidgetState right: 30, child: ParticipantStatsWidget( participant: widget.participant, - )), - if(activeAudioTrack != null && !activeAudioTrack!.muted) Positioned( - top: 10, - right: 10, - left: 10, - bottom: 10, - child: SoundWaveformWidget( - key: ValueKey(activeAudioTrack!.hashCode), - audioTrack: activeAudioTrack!, - width: 8, - ), - ), - + )), + if (activeAudioTrack != null && !activeAudioTrack!.muted) + Positioned( + top: 10, + right: 10, + left: 10, + bottom: 10, + child: SoundWaveformWidget( + key: ValueKey(activeAudioTrack!.hashCode), + audioTrack: activeAudioTrack!, + width: 8, + ), + ), ], ), ); @@ -279,7 +279,7 @@ class RemoteTrackPublicationMenuWidget extends StatelessWidget { @override Widget build(BuildContext context) => Material( - color: Colors.black.withOpacity(0.3), + color: Colors.black.withValues(alpha: 0.3), child: PopupMenuButton( tooltip: 'Subscribe menu', icon: Icon(icon, @@ -317,7 +317,7 @@ class RemoteTrackFPSMenuWidget extends StatelessWidget { @override Widget build(BuildContext context) => Material( - color: Colors.black.withOpacity(0.3), + color: Colors.black.withValues(alpha: 0.3), child: PopupMenuButton( tooltip: 'Preferred FPS', icon: Icon(icon, color: Colors.white), @@ -351,7 +351,7 @@ class RemoteTrackQualityMenuWidget extends StatelessWidget { @override Widget build(BuildContext context) => Material( - color: Colors.black.withOpacity(0.3), + color: Colors.black.withValues(alpha: 0.3), child: PopupMenuButton( tooltip: 'Preferred Quality', icon: Icon(icon, color: Colors.white), @@ -373,4 +373,3 @@ class RemoteTrackQualityMenuWidget extends StatelessWidget { ), ); } - diff --git a/example/lib/widgets/participant_info.dart b/example/lib/widgets/participant_info.dart index 52a40f2a..1064b5fe 100644 --- a/example/lib/widgets/participant_info.dart +++ b/example/lib/widgets/participant_info.dart @@ -43,7 +43,7 @@ class ParticipantInfoWidget extends StatelessWidget { @override Widget build(BuildContext context) => Container( - color: Colors.black.withOpacity(0.3), + color: Colors.black.withValues(alpha: 0.3), padding: const EdgeInsets.symmetric( vertical: 7, horizontal: 10, diff --git a/example/lib/widgets/participant_stats.dart b/example/lib/widgets/participant_stats.dart index c6342707..09231fc1 100644 --- a/example/lib/widgets/participant_stats.dart +++ b/example/lib/widgets/participant_stats.dart @@ -148,7 +148,7 @@ class _ParticipantStatsWidgetState extends State { @override Widget build(BuildContext context) { return Container( - color: Colors.black.withOpacity(0.3), + color: Colors.black.withValues(alpha: 0.3), padding: const EdgeInsets.symmetric( vertical: 8, horizontal: 8, diff --git a/example/lib/widgets/text_field.dart b/example/lib/widgets/text_field.dart index db9c42d6..f4173f3d 100644 --- a/example/lib/widgets/text_field.dart +++ b/example/lib/widgets/text_field.dart @@ -31,7 +31,7 @@ class LKTextField extends StatelessWidget { decoration: BoxDecoration( border: Border.all( width: 1, - color: Colors.white.withOpacity(.3), + color: Colors.white.withValues(alpha: .3), ), borderRadius: BorderRadius.circular(8), ), diff --git a/lib/src/core/engine.dart b/lib/src/core/engine.dart index c5ebe68f..be15ebf8 100644 --- a/lib/src/core/engine.dart +++ b/lib/src/core/engine.dart @@ -1087,12 +1087,10 @@ extension EnginePrivateMethods on Engine { extension EngineInternalMethods on Engine { @internal - List dataChannelInfo() => - [_reliableDCPub, _lossyDCPub] - .whereNotNull() - .where((e) => e.id != -1) - .map((e) => e.toLKInfoType()) - .toList(); + List dataChannelInfo() => [ + _reliableDCPub, + _lossyDCPub + ].nonNulls.where((e) => e.id != -1).map((e) => e.toLKInfoType()).toList(); @internal Future createSimulcastTransceiverSender( LocalVideoTrack track, diff --git a/lib/src/publication/remote.dart b/lib/src/publication/remote.dart index bcb03d6c..5daa170f 100644 --- a/lib/src/publication/remote.dart +++ b/lib/src/publication/remote.dart @@ -17,7 +17,6 @@ import 'dart:math'; import 'package:flutter/widgets.dart'; -import 'package:collection/collection.dart'; import 'package:meta/meta.dart'; import '../core/signal_client.dart'; @@ -155,9 +154,9 @@ class RemoteTrackPublication // filter visible build contexts final viewSizes = videoTrack.viewKeys .map((e) => e.currentContext) - .whereNotNull() + .nonNulls .map((e) => e.findRenderObject() as RenderBox?) - .whereNotNull() + .nonNulls .where((e) => e.hasSize) .map((e) => e.size);