From 181549209034012b4a72b0fb416e13671870d92e Mon Sep 17 00:00:00 2001 From: Decoder07 Date: Fri, 3 Nov 2023 19:57:51 +0530 Subject: [PATCH] Fixed linting errors --- .../hls_viewer_bottom_navigation_bar.dart | 2 +- .../lib/src/hls_viewer/hls_viewer_page.dart | 4 +- .../lib/src/meeting/meeting_header.dart | 501 +++++++++--------- 3 files changed, 250 insertions(+), 257 deletions(-) diff --git a/packages/hms_room_kit/lib/src/hls_viewer/hls_viewer_bottom_navigation_bar.dart b/packages/hms_room_kit/lib/src/hls_viewer/hls_viewer_bottom_navigation_bar.dart index 55484d2d6..d48687772 100644 --- a/packages/hms_room_kit/lib/src/hls_viewer/hls_viewer_bottom_navigation_bar.dart +++ b/packages/hms_room_kit/lib/src/hls_viewer/hls_viewer_bottom_navigation_bar.dart @@ -60,7 +60,7 @@ class HLSViewerBottomNavigationBar extends StatelessWidget { builder: (_, areStreamControlsVisible, __) { return AnimatedContainer( duration: const Duration(milliseconds: 200), - height: areStreamControlsVisible?40:0, + height: areStreamControlsVisible ? 40 : 0, child: areStreamControlsVisible ? Row( mainAxisAlignment: MainAxisAlignment.center, diff --git a/packages/hms_room_kit/lib/src/hls_viewer/hls_viewer_page.dart b/packages/hms_room_kit/lib/src/hls_viewer/hls_viewer_page.dart index cb8fadbfe..c0e66023a 100644 --- a/packages/hms_room_kit/lib/src/hls_viewer/hls_viewer_page.dart +++ b/packages/hms_room_kit/lib/src/hls_viewer/hls_viewer_page.dart @@ -137,7 +137,9 @@ class _HLSViewerPageState extends State { return AnimatedContainer( duration: const Duration( milliseconds: 200), - height: areStreamControlsVisible?100:0, + height: areStreamControlsVisible + ? 100 + : 0, child: areStreamControlsVisible ? const HLSViewerHeader() : Container(), diff --git a/packages/hms_room_kit/lib/src/meeting/meeting_header.dart b/packages/hms_room_kit/lib/src/meeting/meeting_header.dart index d677b5332..704703cfe 100644 --- a/packages/hms_room_kit/lib/src/meeting/meeting_header.dart +++ b/packages/hms_room_kit/lib/src/meeting/meeting_header.dart @@ -33,268 +33,259 @@ class _MeetingHeaderState extends State { selector: (_, meetingNavigationVisibilityController) => meetingNavigationVisibilityController.showControls, builder: (_, showControls, __) { - return - AnimatedContainer( - duration: const Duration(milliseconds: 200), - margin: const EdgeInsets.only( - left: 15, right: 15, top: 5, bottom: 5), - height: showControls?40:0, - child: showControls? Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - ///This renders the logo, live indicator, recording indicator, number of peers - Row( - children: [ - ///This renders the logo - ///If the logo is null, we render an empty SizedBox - ///If the logo is an svg, we render the svg - ///If the logo is an image, we render the image - HMSRoomLayout.roleLayoutData?.logo?.url == null - ? Container() - : HMSRoomLayout.roleLayoutData!.logo!.url! - .contains("svg") - ? SvgPicture.network( - HMSRoomLayout - .roleLayoutData!.logo!.url!, - height: 30, - width: 30, - ) - : Image.network( - HMSRoomLayout - .roleLayoutData!.logo!.url!, - height: 30, - width: 30, - ), - const SizedBox( - width: 12, - ), - - ///This renders the live status - ///If the HLS streaming is started, we render the live indicator - ///else we render an empty Container - /// - ///For hls streaming status we use the streamingType map from the [MeetingStore] - /// - ///If recording initialising state is true we show the loader - Selector( - selector: (_, meetingStore) => - meetingStore.streamingType['hls'] ?? false, - builder: (_, isHLSStarted, __) { - return isHLSStarted - ? Container( - height: 24, - width: 43, - decoration: BoxDecoration( - color: HMSThemeColors - .alertErrorDefault, - borderRadius: - BorderRadius.circular(4)), - child: Center( - child: HMSTitleText( - text: "LIVE", - fontSize: 10, - lineHeight: 16, - letterSpacing: 1.5, - textColor: HMSThemeColors - .alertErrorBrighter), - ), + return AnimatedContainer( + duration: const Duration(milliseconds: 200), + margin: + const EdgeInsets.only(left: 15, right: 15, top: 5, bottom: 5), + height: showControls ? 40 : 0, + child: showControls + ? Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + ///This renders the logo, live indicator, recording indicator, number of peers + Row( + children: [ + ///This renders the logo + ///If the logo is null, we render an empty SizedBox + ///If the logo is an svg, we render the svg + ///If the logo is an image, we render the image + HMSRoomLayout.roleLayoutData?.logo?.url == null + ? Container() + : HMSRoomLayout.roleLayoutData!.logo!.url! + .contains("svg") + ? SvgPicture.network( + HMSRoomLayout.roleLayoutData!.logo!.url!, + height: 30, + width: 30, ) - : Container(); - }), - const SizedBox( - width: 8, - ), - - ///This renders the recording status - ///If the recording is started, we render the recording indicator - ///else we render an empty Container - /// - ///For recording status we use the recordingType map from the [MeetingStore] - Selector>( - selector: (_, meetingStore) => Tuple4( - meetingStore.recordingType["browser"] ?? - false, - meetingStore.recordingType["server"] ?? - false, - meetingStore.recordingType["hls"] ?? false, - meetingStore - .isRecordingInInitialisingState), - builder: (_, data, __) { - return (data.item1 || - data.item2 || - data.item3) - ? SvgPicture.asset( - "packages/hms_room_kit/lib/src/assets/icons/record.svg", - height: 24, - width: 24, - colorFilter: ColorFilter.mode( - HMSThemeColors.alertErrorDefault, - BlendMode.srcIn), - ) - : data.item4 - ? SizedBox( - height: 24, - width: 24, - child: CircularProgressIndicator( - strokeWidth: 2, + : Image.network( + HMSRoomLayout.roleLayoutData!.logo!.url!, + height: 30, + width: 30, + ), + const SizedBox( + width: 12, + ), + + ///This renders the live status + ///If the HLS streaming is started, we render the live indicator + ///else we render an empty Container + /// + ///For hls streaming status we use the streamingType map from the [MeetingStore] + /// + ///If recording initialising state is true we show the loader + Selector( + selector: (_, meetingStore) => + meetingStore.streamingType['hls'] ?? false, + builder: (_, isHLSStarted, __) { + return isHLSStarted + ? Container( + height: 24, + width: 43, + decoration: BoxDecoration( color: HMSThemeColors - .onSurfaceHighEmphasis, - )) - : Container(); - }), - const SizedBox( - width: 8, - ), - - ///This renders the number of peers - ///If the HLS streaming is started, we render the number of peers - ///else we render an empty Container - Selector>( - selector: (_, meetingStore) => Tuple2( - meetingStore.streamingType['hls'] ?? false, - meetingStore.peersInRoom), - builder: (_, data, __) { - return data.item1 - ? Container( - width: 59, - height: 24, - constraints: const BoxConstraints( - minWidth: 59, maxWidth: 70), - decoration: BoxDecoration( - border: Border.all( - color: HMSThemeColors - .borderBright, - width: 1), - borderRadius: - const BorderRadius.all( - Radius.circular(4)), - color: HMSThemeColors - .backgroundDim - .withOpacity(0.64)), - child: Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - SvgPicture.asset( - "packages/hms_room_kit/lib/src/assets/icons/watching.svg", - width: 16, - height: 16, - colorFilter: ColorFilter.mode( - HMSThemeColors - .onSurfaceHighEmphasis, - BlendMode.srcIn), - semanticsLabel: "fl_watching", - ), - const SizedBox( - width: 4, - ), - HMSTitleText( - text: Utilities.formatNumber( - data.item2), + .alertErrorDefault, + borderRadius: + BorderRadius.circular(4)), + child: Center( + child: HMSTitleText( + text: "LIVE", fontSize: 10, - lineHeight: 10, + lineHeight: 16, letterSpacing: 1.5, textColor: HMSThemeColors - .onSurfaceHighEmphasis) - ], - )) - : Container(); - }) - ], - ), - Row( - children: [ - ///This renders the switch camera button - ///If the role is allowed to publish video, we render the switch camera button - ///else we render an empty SizedBox - /// - ///If the video is on we disable the button - Selector?>>( - selector: (_, meetingStore) => Tuple2( - meetingStore.isVideoOn, - meetingStore.localPeer?.role.publishSettings - ?.allowed ?? - []), - builder: (_, data, __) { - return (data.item2?.contains("video") ?? - false) - ? HMSEmbeddedButton( - onTap: () => { - if (data.item1) - { - context - .read() - .switchCamera() - } - }, - isActive: true, - onColor: HMSThemeColors.backgroundDim, - child: SvgPicture.asset( - "packages/hms_room_kit/lib/src/assets/icons/camera.svg", + .alertErrorBrighter), + ), + ) + : Container(); + }), + const SizedBox( + width: 8, + ), + + ///This renders the recording status + ///If the recording is started, we render the recording indicator + ///else we render an empty Container + /// + ///For recording status we use the recordingType map from the [MeetingStore] + Selector>( + selector: (_, meetingStore) => Tuple4( + meetingStore.recordingType["browser"] ?? + false, + meetingStore.recordingType["server"] ?? false, + meetingStore.recordingType["hls"] ?? false, + meetingStore.isRecordingInInitialisingState), + builder: (_, data, __) { + return (data.item1 || data.item2 || data.item3) + ? SvgPicture.asset( + "packages/hms_room_kit/lib/src/assets/icons/record.svg", + height: 24, + width: 24, colorFilter: ColorFilter.mode( - data.item1 - ? HMSThemeColors - .onSurfaceHighEmphasis - : HMSThemeColors - .onSurfaceLowEmphasis, + HMSThemeColors.alertErrorDefault, BlendMode.srcIn), - fit: BoxFit.scaleDown, - semanticsLabel: "fl_switch_camera", - ), - ) - : const SizedBox(); - }), - const SizedBox( - width: 16, - ), - - ///This renders the audio device selection button - ///If the role is allowed to publish audio, we render the audio device selection button - ///else we render an empty SizedBox - Selector( - selector: (_, meetingStore) => - meetingStore.currentAudioDeviceMode, - builder: (_, audioDevice, __) { - return HMSEmbeddedButton( - onTap: () { - ///If the platform is iOS, we use the iOS UI to switch audio output - ///on Android we use the [AudioSettingsBottomSheet] to switch audio output - if (Platform.isIOS) { - context - .read() - .switchAudioOutputUsingiOSUI(); - } else { - showModalBottomSheet( - isScrollControlled: true, - backgroundColor: - Colors.transparent, - context: context, - builder: (ctx) => - ChangeNotifierProvider.value( - value: context - .read(), - child: - const AudioSettingsBottomSheet())); - } - }, - onColor: HMSThemeColors.backgroundDim, - isActive: true, - child: SvgPicture.asset( - 'packages/hms_room_kit/lib/src/assets/icons/${Utilities.getAudioDeviceIconName(audioDevice)}.svg', - colorFilter: ColorFilter.mode( - HMSThemeColors - .onSurfaceHighEmphasis, - BlendMode.srcIn), - fit: BoxFit.scaleDown, - semanticsLabel: "settings_button", - )); - }), - ], - ) - ], - ):const SizedBox(), - ); + ) + : data.item4 + ? SizedBox( + height: 24, + width: 24, + child: CircularProgressIndicator( + strokeWidth: 2, + color: HMSThemeColors + .onSurfaceHighEmphasis, + )) + : Container(); + }), + const SizedBox( + width: 8, + ), + + ///This renders the number of peers + ///If the HLS streaming is started, we render the number of peers + ///else we render an empty Container + Selector>( + selector: (_, meetingStore) => Tuple2( + meetingStore.streamingType['hls'] ?? false, + meetingStore.peersInRoom), + builder: (_, data, __) { + return data.item1 + ? Container( + width: 59, + height: 24, + constraints: const BoxConstraints( + minWidth: 59, maxWidth: 70), + decoration: BoxDecoration( + border: Border.all( + color: + HMSThemeColors.borderBright, + width: 1), + borderRadius: + const BorderRadius.all( + Radius.circular(4)), + color: HMSThemeColors.backgroundDim + .withOpacity(0.64)), + child: Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + SvgPicture.asset( + "packages/hms_room_kit/lib/src/assets/icons/watching.svg", + width: 16, + height: 16, + colorFilter: ColorFilter.mode( + HMSThemeColors + .onSurfaceHighEmphasis, + BlendMode.srcIn), + semanticsLabel: "fl_watching", + ), + const SizedBox( + width: 4, + ), + HMSTitleText( + text: Utilities.formatNumber( + data.item2), + fontSize: 10, + lineHeight: 10, + letterSpacing: 1.5, + textColor: HMSThemeColors + .onSurfaceHighEmphasis) + ], + )) + : Container(); + }) + ], + ), + Row( + children: [ + ///This renders the switch camera button + ///If the role is allowed to publish video, we render the switch camera button + ///else we render an empty SizedBox + /// + ///If the video is on we disable the button + Selector?>>( + selector: (_, meetingStore) => Tuple2( + meetingStore.isVideoOn, + meetingStore.localPeer?.role.publishSettings + ?.allowed ?? + []), + builder: (_, data, __) { + return (data.item2?.contains("video") ?? false) + ? HMSEmbeddedButton( + onTap: () => { + if (data.item1) + { + context + .read() + .switchCamera() + } + }, + isActive: true, + onColor: HMSThemeColors.backgroundDim, + child: SvgPicture.asset( + "packages/hms_room_kit/lib/src/assets/icons/camera.svg", + colorFilter: ColorFilter.mode( + data.item1 + ? HMSThemeColors + .onSurfaceHighEmphasis + : HMSThemeColors + .onSurfaceLowEmphasis, + BlendMode.srcIn), + fit: BoxFit.scaleDown, + semanticsLabel: "fl_switch_camera", + ), + ) + : const SizedBox(); + }), + const SizedBox( + width: 16, + ), + + ///This renders the audio device selection button + ///If the role is allowed to publish audio, we render the audio device selection button + ///else we render an empty SizedBox + Selector( + selector: (_, meetingStore) => + meetingStore.currentAudioDeviceMode, + builder: (_, audioDevice, __) { + return HMSEmbeddedButton( + onTap: () { + ///If the platform is iOS, we use the iOS UI to switch audio output + ///on Android we use the [AudioSettingsBottomSheet] to switch audio output + if (Platform.isIOS) { + context + .read() + .switchAudioOutputUsingiOSUI(); + } else { + showModalBottomSheet( + isScrollControlled: true, + backgroundColor: Colors.transparent, + context: context, + builder: (ctx) => + ChangeNotifierProvider.value( + value: context + .read(), + child: + const AudioSettingsBottomSheet())); + } + }, + onColor: HMSThemeColors.backgroundDim, + isActive: true, + child: SvgPicture.asset( + 'packages/hms_room_kit/lib/src/assets/icons/${Utilities.getAudioDeviceIconName(audioDevice)}.svg', + colorFilter: ColorFilter.mode( + HMSThemeColors.onSurfaceHighEmphasis, + BlendMode.srcIn), + fit: BoxFit.scaleDown, + semanticsLabel: "settings_button", + )); + }), + ], + ) + ], + ) + : const SizedBox(), + ); }); } }