choice<S, T> static method

DiagramProperty<S, T> choice<S, T>(
  1. String key, {
  2. required String label,
  3. required T read(
    1. S subject
    ),
  4. required List<DiagramPropertyOption<T>> options(
    1. S subject
    ),
  5. String? verb,
  6. DiagramPropertyArgs<S, T>? args,
  7. S update(
    1. S subject,
    2. T value
    )?,
  8. DiagramPropertyGroup group = DiagramPropertyGroup.general,
  9. DiagramChoiceStyle style = DiagramChoiceStyle.swatches,
  10. bool labeled = true,
  11. bool visible(
    1. S subject
    )?,
  12. bool enabled(
    1. S subject
    )?,
  13. String? hint(
    1. T value
    )?,
  14. String? check(
    1. T value
    )?,
  15. String editLabel(
    1. T value
    )?,
})

One of the options a subject offers. An inspector draws each option by its value type, or shows its icon or label.

Implementation

static DiagramProperty<S, T> choice<S, T>(
  String key, {
  required String label,
  required T Function(S subject) read,
  required List<DiagramPropertyOption<T>> Function(S subject) options,
  String? verb,
  DiagramPropertyArgs<S, T>? args,
  S Function(S subject, T value)? update,
  DiagramPropertyGroup group = DiagramPropertyGroup.general,
  DiagramChoiceStyle style = DiagramChoiceStyle.swatches,
  bool labeled = true,
  bool Function(S subject)? visible,
  bool Function(S subject)? enabled,
  String? Function(T value)? hint,
  String? Function(T value)? check,
  String Function(T value)? editLabel,
}) => DiagramProperty._(
  key,
  label: label,
  presentation: DiagramChoicePresentation<T>._(
    options: (subject) => options(subject as S),
    style: style,
    labeled: labeled,
  ),
  read: read,
  verb: verb,
  args: args,
  update: update,
  group: group,
  visible: visible,
  enabled: enabled,
  hint: hint,
  check: check,
  editLabel: editLabel,
);