radioOptionBuilder<T> function

Widget radioOptionBuilder<T>(
  1. FastRadioOption<T> option,
  2. FastRadioGroupState<T> field
)

Implementation

Widget radioOptionBuilder<T>(
    FastRadioOption<T> option, FastRadioGroupState<T> field) {
  final FastRadioGroupState<T>(:didChange, :enabled, :value, :widget) = field;
  final tile = RadioListTile<T>(
    activeColor: widget.activeColor,
    controlAffinity: widget.controlAffinity,
    fillColor: widget.fillColor,
    hoverColor: widget.hoverColor,
    groupValue: value,
    isThreeLine: option.isThreeLine,
    materialTapTargetSize: widget.materialTapTargetSize,
    mouseCursor: widget.mouseCursor,
    onChanged: enabled ? didChange : null,
    overlayColor: widget.overlayColor,
    secondary: option.secondary,
    selected: option.selected,
    selectedTileColor: widget.selectedTileColor,
    shape: widget.shapeBorder,
    splashRadius: widget.splashRadius,
    subtitle: option.subtitle,
    tileColor: widget.tileColor,
    title: option.title,
    toggleable: widget.toggleable,
    value: option.value,
    visualDensity: option.visualDensity,
  );

  return widget.orientation == FastRadioGroupOrientation.vertical
      ? tile
      : Expanded(child: tile);
}