buildMicrophoneButton method
Widget
buildMicrophoneButton(
)
Implementation
Widget buildMicrophoneButton() {
return ValueListenableBuilder(
valueListenable: DeviceStore.shared.state.microphoneStatus,
builder: (ctx, status, _) {
final isOn = status == DeviceStatus.on;
return GestureDetector(
onTap: () async {
if (isOn) {
DeviceStore.shared.closeLocalMicrophone();
} else {
await DeviceStore.shared.openLocalMicrophone();
}
ImState.callMicrophoneIsOnNotifiers.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/microphone_on.png' : 'assets/images/microphone_off.png', fit: BoxFit.cover, package: 'im_plugin_tencent', width: 30, height: 30,),
),
),
);
},
);
}