selectConfigOption method

void selectConfigOption()

Updates the selected FormSelectionConfig for the focused FormConfig.

Implementation

void selectConfigOption() {
  final config = configurations[_focusedConfigIndex];
  if (config is! FormSelectionConfig) return;
  final configState = _focusedOptionState[config];
  if (configState == null) return;

  // Invert the focused option for config with boolean options
  // to select correct option since the UI only displays 'Enabled' option
  if (config.isBoolean) {
    final selectedOption = getSelectedOptionFor(config);
    final unselectedOptionIndex = config.options.indexWhere(
      (e) => e != selectedOption,
    );
    configState._focusedOptionIndex = unselectedOptionIndex;
  }

  final focusedOptionIndex = configState.focusedOptionIndex;
  final newOption = config.options[focusedOptionIndex];
  _updateSelectedOption(config, newOption);
  _updateState();
}