changeSpeaker method
Implementation
changeSpeaker(BuildContext context) {
// speakerOff(!speakerOff.value);
debugPrint("availableAudioList.length ${availableAudioList.length}");
//if connected other audio devices
// if (availableAudioList.length > 2) {
showDialog(
context: context,
builder: (BuildContext context) {
return Dialog(
// backgroundColor:
// MirrorflyUikit.theme == "dark" ? darkPopupColor : Colors.white,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Obx(() {
return ListView.builder(
shrinkWrap: true,
itemCount: availableAudioList.length,
itemBuilder: (context, index) {
var audioItem = availableAudioList[index];
debugPrint("audio item name ${audioItem.name}");
return Obx(() {
return ListTile(
contentPadding: const EdgeInsets.only(left: 10),
title: Text(audioItem.name ?? "",
style: const TextStyle(
fontSize: 14, fontWeight: FontWeight.normal)),
trailing: audioItem.type == audioOutputType.value
? const Icon(
Icons.check_outlined,
color: Colors.green,
)
: const SizedBox.shrink(),
onTap: () {
if (audioOutputType.value != audioItem.type) {
// Get.back();
// Navigator.pop(context);
MirrorflyUikit.instance.navigationManager
.navigateBack(context: context);
debugPrint(
"selected audio item ${audioItem.type}");
audioOutputType(audioItem.type);
Mirrorfly.routeAudioTo(
routeType: audioItem.type ?? "");
} else {
LogMessage.d("routeAudioOption",
"clicked on same audio type selected");
}
},
);
});
});
}),
),
);
});
}