Skip to content

Commit

Permalink
Added empty room screens
Browse files Browse the repository at this point in the history
  • Loading branch information
Decoder07 committed May 27, 2024
1 parent 23366b8 commit e641512
Show file tree
Hide file tree
Showing 6 changed files with 199 additions and 37 deletions.
3 changes: 3 additions & 0 deletions packages/hms_room_kit/lib/src/assets/icons/add_peer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions packages/hms_room_kit/lib/src/meeting/empty_room_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
library;

///Package imports
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:hms_room_kit/hms_room_kit.dart';

///[EmptyRoomScreen] is a widget that is used to render the empty room screen
///This screen is shown when there is only single publisher
class EmptyRoomScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
CircleAvatar(
backgroundColor: HMSThemeColors.surfaceDefault,
radius: 40,
child: SvgPicture.asset(
"packages/hms_room_kit/lib/src/assets/icons/add_peer.svg",
height: 37,
width: 37,
colorFilter: ColorFilter.mode(
HMSThemeColors.onSurfaceHighEmphasis, BlendMode.srcIn),
),
),
const SizedBox(
height: 24,
),
HMSTitleText(
text: "You’re the first to join",
textColor: HMSThemeColors.onSurfaceHighEmphasis,
fontSize: 24,
lineHeight: 32,
),
const SizedBox(
height: 8,
),
HMSTitleText(
text:
"Sit back and relax till others join",
textColor: HMSThemeColors.onSurfaceMediumEmphasis,
fontWeight: FontWeight.w400,
maxLines: 3,
)
],
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'dart:io';

///Package imports
import 'package:flutter/material.dart';
import 'package:hms_room_kit/src/meeting/waiting_room_screen.dart';
import 'package:hmssdk_flutter/hmssdk_flutter.dart';
import 'package:provider/provider.dart';
import 'package:tuple/tuple.dart';
Expand Down Expand Up @@ -43,6 +44,7 @@ class MeetingGridComponent extends StatelessWidget {
color: Colors.transparent,
height: double.infinity,
width: double.infinity,
child: WaitingRoomScreen(),
));
}
return Selector<MeetingStore, Tuple2<MeetingMode, HMSPeer?>>(
Expand Down
101 changes: 101 additions & 0 deletions packages/hms_room_kit/lib/src/meeting/waiting_room_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
library;

///Package imports
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:provider/provider.dart';

///Project imports
import 'package:hms_room_kit/hms_room_kit.dart';
import 'package:hms_room_kit/src/meeting/meeting_store.dart';

///[WaitingRoomScreen] is a widget that is used to render the waiting room screen
///This is rendered when the user is waiting for the host to join
///or when the user has only screenshare option
class WaitingRoomScreen extends StatelessWidget {

///[showScreenshareOption] is a function that returns true if the user has only screenshare option
bool showScreenshareOption(MeetingStore meetingStore) {
return (!(meetingStore.localPeer?.role.publishSettings?.allowed
.contains("video") ??
true) &&
(meetingStore.localPeer?.role.publishSettings?.allowed
.contains("screen") ??
false) &&
!(meetingStore.localPeer?.role.publishSettings?.allowed
.contains("audio") ??
true));
}

@override
Widget build(BuildContext context) {
var meetingStore = context.watch<MeetingStore>();

return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: showScreenshareOption(meetingStore)
? [
CircleAvatar(
backgroundColor: HMSThemeColors.surfaceDefault,
radius: 40,
child: SvgPicture.asset(
"packages/hms_room_kit/lib/src/assets/icons/screen_share.svg",
height: 37,
width: 37,
colorFilter: ColorFilter.mode(
HMSThemeColors.onSurfaceHighEmphasis, BlendMode.srcIn),
),
),
const SizedBox(
height: 24,
),
HMSTitleText(
text: "Ready to present",
textColor: HMSThemeColors.onSurfaceHighEmphasis,
fontSize: 24,
lineHeight: 32,
),
const SizedBox(
height: 8,
),
HMSTitleText(
text:
"Select the screenshare button \nfrom the menu to start presenting.",
textColor: HMSThemeColors.onSurfaceMediumEmphasis,
fontWeight: FontWeight.w400,
maxLines: 3,
)
]
: [
CircleAvatar(
backgroundColor: HMSThemeColors.surfaceDefault,
radius: 40,
child: SvgPicture.asset(
"packages/hms_room_kit/lib/src/assets/icons/add_peer.svg",
height: 37,
width: 37,
colorFilter: ColorFilter.mode(
HMSThemeColors.onSurfaceHighEmphasis, BlendMode.srcIn),
),
),
const SizedBox(
height: 24,
),
HMSTitleText(
text: "Waiting for Host to join",
textColor: HMSThemeColors.onSurfaceHighEmphasis,
fontSize: 24,
lineHeight: 32,
),
const SizedBox(
height: 8,
),
HMSTitleText(
text: "Sit back and relax",
textColor: HMSThemeColors.onSurfaceMediumEmphasis,
fontWeight: FontWeight.w400,
)
],
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ class _AppUtilitiesBottomSheetState extends State<AppUtilitiesBottomSheet> {
? "Recording"
: "Record",
),
if (meetingStore.isNoiseCancellationAvailable &&
if (meetingStore.isNoiseCancellationAvailable && meetingStore.localPeer?.audioTrack != null &&
meetingStore.isMicOn)
MoreOptionItem(
onTap: () async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ import 'package:provider/provider.dart';
///Project imports
import 'package:hms_room_kit/src/model/peer_track_node.dart';
import 'package:hms_room_kit/src/widgets/common_widgets/inset_tile.dart';
import 'package:hms_room_kit/src/widgets/grid_layouts/listenable_peer_widget.dart';
import 'package:hms_room_kit/src/widgets/meeting_modes/custom_one_to_one_grid.dart';
import 'package:hms_room_kit/src/widgets/peer_widgets/inset_collapsed_view.dart';
import 'package:hms_room_kit/src/layout_api/hms_room_layout.dart';
import 'package:hms_room_kit/src/meeting/empty_room_screen.dart';

///[OneToOneMode] is used to render the meeting screen in inset Tile mode
class OneToOneMode extends StatefulWidget {
Expand Down Expand Up @@ -88,43 +89,49 @@ class _OneToOneModeState extends State<OneToOneMode> {
)

///This handles the case where local peer is the only peer in the room with audio or video track
: (oneToOnePeer != null && widget.peerTracks.length == 1)
? ListenablePeerWidget(
peerTracks: [oneToOnePeer!],
index: 0,
)
// : (oneToOnePeer != null && widget.peerTracks.length == 1)
// ? ListenablePeerWidget(
// peerTracks: [oneToOnePeer!],
// index: 0,
// )

///This handles when the local peer is also present as well as the other peers are also there.
///i.e. this handles the normal flow
: Stack(
children: [
CustomOneToOneGrid(
peerTracks: widget.peerTracks,
),
DraggableWidget(
dragAnimationScale: 1,
topMargin: 10,
bottomMargin: Platform.isIOS
? widget.bottomMargin + 20
: widget.bottomMargin,
horizontalSpace: 8,
child: isMinimized
? InsetCollapsedView(
///This handles when the local peer is also present as well as the other peers are also there.
///i.e. this handles the normal flow
: Stack(
children: [
///If there is only one peer in the room and the peer is local peer
///we show the empty room screen
///This is the case when the local peer is the only peer in the room
///else we show the normal grid view
(widget.peerTracks.length == 1 && oneToOnePeer != null && HMSRoomLayout.peerType==PeerRoleType.conferencing)
? Center(child: EmptyRoomScreen())
: CustomOneToOneGrid(
peerTracks: widget.peerTracks,
),
DraggableWidget(
dragAnimationScale: 1,
topMargin: 10,
bottomMargin: Platform.isIOS
? widget.bottomMargin + 20
: widget.bottomMargin,
horizontalSpace: 8,
child: isMinimized
? InsetCollapsedView(
callbackFunction: toggleMinimizedView,
)
: ClipRRect(
borderRadius: BorderRadius.circular(16.0),
child: ChangeNotifierProvider.value(
key: ValueKey(
oneToOnePeer?.uid ?? "" "video_view"),
value: oneToOnePeer,
child: InsetTile(
callbackFunction: toggleMinimizedView,
)
: ClipRRect(
borderRadius: BorderRadius.circular(16.0),
child: ChangeNotifierProvider.value(
key: ValueKey(oneToOnePeer?.uid ??
"" "video_view"),
value: oneToOnePeer,
child: InsetTile(
callbackFunction: toggleMinimizedView,
),
),
))
],
),
),
),
))
],
),
),
);
}
Expand Down

0 comments on commit e641512

Please sign in to comment.