-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathjoin_view.dart
134 lines (130 loc) · 5.58 KB
/
join_view.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
import 'package:flutter/material.dart';
import 'package:responsive_framework/responsive_framework.dart';
import 'package:videosdk/videosdk.dart';
import 'package:videosdk_flutter_example/constants/colors.dart';
class JoinView extends StatelessWidget {
final RTCVideoRenderer? cameraRenderer;
final bool isMicOn;
final bool isCameraOn;
final VoidCallback onMicToggle;
final VoidCallback onCameraToggle;
const JoinView({
Key? key,
required this.cameraRenderer,
required this.isMicOn,
required this.isCameraOn,
required this.onMicToggle,
required this.onCameraToggle,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Column(
children: [
LayoutBuilder(
builder: (context, constraints) {
double aspectRatio =
ResponsiveValue<double>(context, conditionalValues: [
Condition.equals(name: MOBILE, value: 1 / 1.5),
Condition.equals(name: TABLET, value: 16 / 10),
Condition.largerThan(name: TABLET, value: 16 / 9),
]).value!;
double height =
ResponsiveValue<double>(context, conditionalValues: [
Condition.equals(name: MOBILE, value: 400),
Condition.equals(
name: TABLET, value: constraints.maxWidth / aspectRatio),
Condition.largerThan(
name: TABLET, value: constraints.maxWidth / aspectRatio),
]).value!;
double width = ResponsiveValue<double>(context, conditionalValues: [
Condition.equals(
name: MOBILE, value: constraints.maxWidth * 0.7),
Condition.equals(name: TABLET, value: constraints.maxWidth),
Condition.largerThan(name: TABLET, value: constraints.maxWidth),
]).value!;
return SizedBox(
height: height,
width: width,
child: Stack(
alignment: Alignment.topCenter,
children: [
AspectRatio(
aspectRatio: aspectRatio,
child: cameraRenderer != null
? ClipRRect(
borderRadius: BorderRadius.circular(12),
child: RTCVideoView(
cameraRenderer as RTCVideoRenderer,
objectFit: RTCVideoViewObjectFit
.RTCVideoViewObjectFitCover,
),
)
: Container(
decoration: BoxDecoration(
color: black800,
borderRadius: BorderRadius.circular(12)),
child: const Center(
child: Text(
"Camera is turned off",
),
),
),
),
Positioned(
bottom: 20,
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
onPressed: onMicToggle,
style: ElevatedButton.styleFrom(
shape: const CircleBorder(),
padding: EdgeInsets.all(
ResponsiveValue<double>(context,
conditionalValues: [
Condition.equals(name: MOBILE, value: 12),
Condition.equals(name: TABLET, value: 15),
Condition.equals(
name: DESKTOP, value: 18),
]).value!,
),
backgroundColor: isMicOn ? Colors.white : red,
foregroundColor: Colors.black,
),
child: Icon(isMicOn ? Icons.mic : Icons.mic_off,
color: isMicOn ? grey : Colors.white),
),
ElevatedButton(
onPressed: onCameraToggle,
style: ElevatedButton.styleFrom(
shape: const CircleBorder(),
padding: EdgeInsets.all(
ResponsiveValue<double>(context,
conditionalValues: [
Condition.equals(name: MOBILE, value: 12),
Condition.equals(name: TABLET, value: 15),
Condition.equals(
name: DESKTOP, value: 18),
]).value!,
),
backgroundColor: isCameraOn ? Colors.white : red,
),
child: Icon(
isCameraOn ? Icons.videocam : Icons.videocam_off,
color: isCameraOn ? grey : Colors.white,
),
),
],
),
),
),
],
),
);
},
),
],
);
}
}