onConfirmTap method
Pops the dialog from the navigation stack and returns the selected values. Calls the onConfirm function if one was provided.
Implementation
void onConfirmTap(
    BuildContext ctx, List<T> selectedValues, Function(List<T>)? onConfirm) {
  Navigator.pop(ctx, selectedValues);
  if (onConfirm != null) {
    onConfirm(selectedValues);
  }
}