LinearGauge constructor
LinearGauge({
- Key? key,
- double? start = 0,
- double? end = 100,
- double? steps = 0,
- @Deprecated('Use ValueBar instead') double? value = 0,
- GaugeOrientation? gaugeOrientation = GaugeOrientation.horizontal,
- bool? showLinearGaugeContainer = true,
- LinearGaugeBoxDecoration? linearGaugeBoxDecoration = const LinearGaugeBoxDecoration(),
- double? labelTopMargin = 0.0,
- required RulerStyle? rulers,
- List<
RangeLinearGauge> ? rangeLinearGauge = const [], - List<
CustomRulerLabel> ? customLabels = const [], - ValueBarPosition? valueBarPosition = ValueBarPosition.center,
- List<
ValueBar> ? valueBar = const [], - List<
BasePointer> ? pointers = const [], - bool enableGaugeAnimation = false,
- double? extendLinearGauge = 0,
- bool fillExtend = false,
- double animationGap = 0,
- int animationDuration = 1000,
- Curve animationType = Curves.ease,
- List<
CustomCurve> ? curves = const [],
LinearGauge is a visualization of measurement widget with a linear scale values. LinearGauge as rich sets of config parameters which can be modified as per requirement
start
and end
is responsible to paint the values as a label.
LinearGauge(
steps: 2,
start: 0,
end: 100,
),
Implementation
LinearGauge({
Key? key,
this.start = 0,
this.end = 100,
this.steps = 0,
@Deprecated('Use ValueBar instead') this.value = 0,
this.gaugeOrientation = GaugeOrientation.horizontal,
this.showLinearGaugeContainer = true,
this.linearGaugeBoxDecoration = const LinearGaugeBoxDecoration(),
this.labelTopMargin = 0.0,
required this.rulers,
this.rangeLinearGauge = const [],
this.customLabels = const [],
this.valueBarPosition = ValueBarPosition.center,
this.valueBar = const [],
this.pointers = const [],
this.enableGaugeAnimation = false,
this.extendLinearGauge = 0,
this.fillExtend = false,
this.animationGap = 0,
this.animationDuration = 1000,
this.animationType = Curves.ease,
this.curves = const [],
}) : assert(() {
if (customLabels!.isNotEmpty) {
assert(customLabels.length >= 2,
"At least two CustomRulerLabel should be added");
assert((customLabels.first.value! < customLabels.last.value!),
"Start should be less then end");
}
if (rulers != null) {
if (gaugeOrientation == GaugeOrientation.horizontal) {
if (rulers.rulerPosition == RulerPosition.bottom ||
rulers.rulerPosition == RulerPosition.center ||
rulers.rulerPosition == RulerPosition.top) {
return true;
} else {
assert(
false,
'Invalid ruler position. Rulers must be horizontal,'
'positioned at top, bottom, or center.');
}
} else {
if (rulers.rulerPosition == RulerPosition.right ||
rulers.rulerPosition == RulerPosition.center ||
rulers.rulerPosition == RulerPosition.left) {
return true;
} else {
assert(
false,
'Invalid ruler position. Rulers must be vertical,'
'positioned at left, right, or center.');
}
}
}
return true;
}()),
super(key: key);