onAlternativePresetClicked method

void onAlternativePresetClicked(
  1. UIEvent? event,
  2. DatepickerPreset parent,
  3. DatepickerPreset alternative
)

Implementation

void onAlternativePresetClicked(
    UIEvent? event, DatepickerPreset parent, DatepickerPreset alternative) {
  // Replace parent preset with alternative in main menu.
  for (var i = 0; i < _presets.length; i++) {
    if (_presets[i] == parent) {
      _presets[i] = alternative;
      if (useMenuForPresets) _updateValidPresets(); // to refresh the menu
      break;
    }
  }
  onRangeClicked(event, alternative.range);
}