number<S> static method
DiagramProperty<S, double>
number<S>(
- String key, {
- required String label,
- required double read(
- S subject
- String? verb,
- DiagramPropertyArgs<
S, double> ? args, - S update(
- S subject,
- double value
- DiagramPropertyGroup group = DiagramPropertyGroup.general,
- double min = 0,
- double max = 1000000,
- double step = 1,
- String unit = '',
- int? precision,
- DiagramNumberStyle style = DiagramNumberStyle.stepper,
- (double, double) bounds(
- S subject
- bool visible(
- S subject
- bool enabled(
- S subject
- String? check(
- double value
- String editLabel(
- double value
A number between min and max, changed in steps. precision sets
the displayed decimal places; by default it follows step. bounds
narrows the range for a subject.
Implementation
static DiagramProperty<S, double> number<S>(
String key, {
required String label,
required double Function(S subject) read,
String? verb,
DiagramPropertyArgs<S, double>? args,
S Function(S subject, double value)? update,
DiagramPropertyGroup group = DiagramPropertyGroup.general,
double min = 0,
double max = 1000000,
double step = 1,
String unit = '',
int? precision,
DiagramNumberStyle style = DiagramNumberStyle.stepper,
(double min, double max) Function(S subject)? bounds,
bool Function(S subject)? visible,
bool Function(S subject)? enabled,
String? Function(double value)? check,
String Function(double value)? editLabel,
}) {
if (!min.isFinite || !max.isFinite || min > max || step <= 0) {
throw ArgumentError('A number needs finite ordered bounds and a step.');
}
return DiagramProperty._(
key,
label: label,
presentation: DiagramNumberPresentation._(
min: min,
max: max,
step: step,
unit: unit,
precision: precision,
style: style,
bounds: bounds == null ? null : (subject) => bounds(subject as S),
),
read: read,
verb: verb,
args: args,
update: update,
group: group,
visible: visible,
enabled: enabled,
check: check,
editLabel: editLabel,
);
}