Implementation
Widget prepareView(EnxController obj, BuildContext context) {
final MediaQueryData mediaQueryData = MediaQuery.of(context);
final double heightOfDevice = mediaQueryData.size.height;
return Stack(
alignment: Alignment.center,
children: [
obj.isAudience?obj.isHlsStarted.value?AspectRatio(
aspectRatio: 3/2,
child:VideoPlayer(obj.videoController!),
)
:Text(
'Please wait, getting you connected...',
style: TextStyle(color: Colors.white, fontSize: 16.sp),
): obj.activeTalkerList.isEmpty
? Text(
'Wait for others to join',
style: TextStyle(color: Colors.white, fontSize: 16.sp),
)
: Align(
alignment: Alignment.center,
child: obj.isScreenShareStarted
? SizedBox(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height / 2.5,
child: obj.isScreenShareStarted
?AspectRatio(
aspectRatio: MediaQuery.of(context).size.width / MediaQuery.of(context).size.height / 2.5, // Maintain aspect ratio
child: EnxPlayerWidget(
obj.screenShareStream.toInt(),
local: false,
mScalingType: ScalingType.SCALE_ASPECT_FILL,
zMediaOverlay: false,
) )
: Container(),
)
: SizedBox(
height: MediaQuery.of(context).size.height,
child: kIsWeb?Center(
child: viewsize( obj, obj.activeTalkerList,
MediaQuery.of(context),
context),
):obj.isGridView
? MediaQuery.of(context).orientation ==
Orientation.portrait
? Column(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: renderStreamsGrid(
obj,
obj.activeTalkerList,
MediaQuery.of(context),
context))
: Row(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: renderStreamsGrid(
obj,
obj.activeTalkerList,
MediaQuery.of(context),
context))
: viewFloat(context, obj),
),
),
TranslationAnimatedWidget(
enabled: obj.isShowHide, //will forward/reverse the animation
curve: Curves.easeIn,
duration: const Duration(seconds: 1),
child: Align(
alignment: Alignment.bottomCenter,
child: ConstrainedBox(
constraints: BoxConstraints(
maxHeight:
MediaQuery.of(context).orientation == Orientation.portrait
? MediaQuery.of(context).size.height / 1.58
: MediaQuery.of(context).size.height / 1.3,
//maximum height set to 100% of vertical height
//maximum width set to 100% of width
),
child: SnappingSheet(
grabbingHeight: MediaQuery.of(context).orientation==Orientation.portrait?110:100,
lockOverflowDrag: true,
onSheetMoved: (sheetPosition) {
if (kDebugMode) {
print("Current position ${sheetPosition.pixels}");
}
},
onSnapCompleted: (sheetPosition, snappingPosition) {
if (kDebugMode) {
print("compl position ${sheetPosition.pixels}");
print("compl snapping position ${snappingPosition}");
}
obj.positionCom.value = sheetPosition.pixels;
},
onSnapStart: (sheetPosition, snappingPosition) {
if (kDebugMode) {
print("Current position ${sheetPosition.pixels}");
print("Next snapping position $snappingPosition");
}
},
// TODO: Add your grabbing widget here,
grabbing: Wrap(children: [
Center(
child: Container(
height: MediaQuery.of(context).orientation==Orientation.portrait?MediaQuery.of(context).size.height/22:MediaQuery.of(context).size.height/13,
width: MediaQuery.of(context).orientation==Orientation.portrait?MediaQuery.of(context).size.width:MediaQuery.of(context).size.height,
decoration: const BoxDecoration(
borderRadius: BorderRadius.only(topLeft: Radius.circular(15.0),topRight:Radius.circular(15.0)), color: Colors.white),
child: Center(
child: Icon(
obj.positionUpdate > 70
? Icons.keyboard_arrow_down
: Icons.keyboard_arrow_up,
size: 40,
color: Colors.grey,
)),
),
),
Center(
child: EnxVideoButtons(
enxController: obj,
),
),
]),
sheetBelow: SnappingSheetContent(
// TODO: Add your sheet content here
child: obj.isAudience?Container():Align(
alignment: Alignment.topCenter,
child: Container(
width: MediaQuery.of(context).orientation==Orientation.portrait?MediaQuery.of(context).size.width:MediaQuery.of(context).size.height,
color: Colors.white,
child: ParticipantScreenNew(obj, context)),
),
)),
),
),
),
Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Visibility(
visible: obj.isShowConnectedTime ,
child: Align(
alignment: Alignment.topLeft,
child: Padding(
padding: EdgeInsets.only(top: 5.h, right: 20.h),
child:Container(
margin: EdgeInsets.only(left: 20.w,top: 20.w),
padding: EdgeInsets.all(8.w),
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(15.w)),
child: Text(
obj.timerData(),
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 15.h),
),
),
),
),
),
Visibility(
visible: obj.isRecord ? true : false,
child: Align(
alignment: Alignment.topCenter,
child: Padding(
padding: EdgeInsets.only(top: 5.h, right: 20.h),
child: BlinkingPoint(
xCoor: 20.0, // The x coordinate of the point
yCoor: 20.0, // The y coordinate of the point
pointColor:
CustomColors.themeColor, // The color of the point
pointSize: 8.0.w, // The size of the point)
),
),
),
),
Visibility(
visible: EnxSetting.instance.showGoLiveIndicator?obj.isShowIndicator.value ? true : false:false,
child: Container(
color: Colors.red,
margin: EdgeInsets.only(top:8.0) ,// Background color
padding: EdgeInsets.only(left: 10.0,top: 6.0,right: 10.0,bottom: 6.0), // Padding around the text
child: Text(
'Live',
style: TextStyle(
color: Colors.white, // Text color
fontSize: 15.h // Text size
),
),
),
)
],
),
obj.isAudience?Container(): Visibility(
visible:!(EnxSetting.instance.isAudioOnlyCalls || obj.isVideoMute||obj.isShowAnnotationView),
child: DraggableWidget(
bottomMargin: 50.w,
topMargin: 80.w,
intialVisibility: true,
horizontalSpace: 20.w,
shadowBorderRadius: 10.w,
initialPosition: AnchoringPosition.topRight,
child: localView(kIsWeb?150:100, kIsWeb?150:100,obj,context)),
),
],
);
}