setCurrentMenuItem method
Change the current menu item.
Implementation
Future<void> setCurrentMenuItem(final int index) async {
if (index != menuItemIndex) {
stopSounds();
menuItemIndex = index;
final menuItem = widget.menuItems[index];
for (final sound in [menuItem.earcon, widget.selectItemSound]) {
if (sound != null && mounted) {
final handle = await context.playSound(sound);
soundHandles.add(handle);
}
}
setState(() {});
}
}