Area constructor
Area({
- double? size,
- double? flex,
- double? min,
- double? max,
- dynamic id,
- dynamic data,
- AreaWidgetBuilder? builder,
Implementation
Area(
{double? size,
double? flex,
double? min,
double? max,
dynamic id,
this.data,
this.builder})
: this.id = id != null ? id : _AreaId(),
_size = size,
_flex = flex,
_min = min,
_max = max {
if (size != null && flex != null) {
throw ArgumentError('Cannot provide both a size and a flex.');
}
NumUtil.validateDouble('size', size);
NumUtil.validateDouble('flex', flex);
NumUtil.validateDouble('min', min);
NumUtil.validateDouble('max', max);
if (size == null && flex == null) {
_flex = 1;
}
if (min != null && max != null && max < min) {
throw ArgumentError('The max needs to be greater than min.');
}
if (_flex != null) {
if (min != null) {
_flex = math.max(_flex!, min);
}
if (max != null) {
_flex = math.min(_flex!, max);
}
} else if (_size != null) {
if (min != null) {
_size = math.max(_size!, min);
}
if (max != null) {
_size = math.min(_size!, max);
}
}
}