toggle<S> static method
DiagramProperty<S, bool>
toggle<S>(
- String key, {
- required String label,
- required bool read(
- S subject
- String? verb,
- DiagramPropertyArgs<
S, bool> ? args, - S update(
- S subject,
- bool value
- DiagramPropertyGroup group = DiagramPropertyGroup.general,
- DiagramToggleStyle style = DiagramToggleStyle.standard,
- DiagramIcon? icon,
- bool visible(
- S subject
- bool enabled(
- S subject
- String editLabel(
- bool value
On or off, presented by style; a button or header toggle shows
icon.
Implementation
static DiagramProperty<S, bool> toggle<S>(
String key, {
required String label,
required bool Function(S subject) read,
String? verb,
DiagramPropertyArgs<S, bool>? args,
S Function(S subject, bool value)? update,
DiagramPropertyGroup group = DiagramPropertyGroup.general,
DiagramToggleStyle style = DiagramToggleStyle.standard,
DiagramIcon? icon,
bool Function(S subject)? visible,
bool Function(S subject)? enabled,
String Function(bool value)? editLabel,
}) {
if (icon == null &&
(style == DiagramToggleStyle.button ||
style == DiagramToggleStyle.header)) {
throw ArgumentError('An icon toggle needs an icon.');
}
return DiagramProperty._(
key,
label: label,
presentation: DiagramTogglePresentation._(style),
read: read,
verb: verb,
args: args,
update: update,
group: group,
icon: icon,
visible: visible,
enabled: enabled,
editLabel: editLabel,
);
}