showAudioDeviceDialog method
Implementation
Future<void> showAudioDeviceDialog(BuildContext context) async {
String? device = await showModalBottomSheet(
context: context,
builder: (context) {
var selected = MeetingModel().selectedAudioDevice;
var selectedIcon = Icon(Icons.check, color: AppColors.primaryBgColor);
var items =
MeetingModel().deviceList
.whereType<String>()
.map(
(e) => ListTile(
leading: Icon(
e.toLowerCase().contains('speaker')
? Icons.volume_up_outlined
: e.toLowerCase().contains('earphone') ||
e.toLowerCase().contains('headphone')
? Icons.bluetooth_outlined
: Icons.hearing_outlined,
),
title: Text(e),
onTap: () {
Navigator.pop(context, e);
},
trailing: selected == e ? selectedIcon : null,
),
)
.toList();
return SizedBox(
height: 200,
child: ListView(padding: const EdgeInsets.all(8), children: items),
);
},
);
if (device == null) return;
MeetingModel().updateCurrentDevice(device);
setState(() {
currentAudioDevice = device;
});
}