buildCameraButton method
Implementation
Widget buildCameraButton() {
return ValueListenableBuilder(
valueListenable: DeviceStore.shared.state.cameraStatus,
builder: (context, status, child) {
final isOn = status == DeviceStatus.on;
return GestureDetector(
onTap: () async {
if (isOn) {
DeviceStore.shared.closeLocalCamera();
} else {
final isFrontCamera = DeviceStore.shared.state.isFrontCamera.value;
DeviceStore.shared.openLocalCamera(isFrontCamera);
}
ImState.callCameraIsOnNotifiers.value = !isOn;
},
behavior: HitTestBehavior.opaque,
child: Opacity(
opacity: isOn ? 1 : 0.2,
child: Container(
width: 50,
height: 50,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30),
color: Colors.black87.withAlpha(100),
),
child: Image.asset(isOn ? 'assets/images/camera_on.png' : 'assets/images/camera_off.png', fit: BoxFit.cover, package: 'im_plugin_tencent', width: 30, height: 30,),
),
),
);
},
);
}