build method

  1. @override
Component build(
  1. BuildContext context
)

Describes the part of the user interface represented by this component.

Implementation

@override
Component build(BuildContext context) {
  final selectedOptions = state.getSelectedOptionsFor(config) ?? {};
  final focusedOptionIndex = state.getFocusedOptionIndexFor(config);

  return FormConfigurationLayout(
    config: config,
    child: Wrap(
      spacing: 2,
      children: [
        for (final option in config.options.indexed)
          _FormOptionCheckbox(
            option: option.$2,
            focused: focused && focusedOptionIndex == option.$1,
            selected: selectedOptions.contains(option.$2),
            onTap: () {
              state.updateSelectedOption(config, option.$2);
              rebuild();
            },
          ),
      ],
    ),
  );
}