summaryrefslogtreecommitdiffstats
path: root/lib/screen/widgets/gauges/speed_gauge_animation_wrapper.dart
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2024-01-05 18:50:51 -0500
committerScott Murray <scott.murray@konsulko.com>2024-01-05 18:52:32 -0500
commitdbb971abeaa2beff2a13e421f8cca83b3054db34 (patch)
tree049af6bf56c53534807f6cb5de9803dcb111c4e6 /lib/screen/widgets/gauges/speed_gauge_animation_wrapper.dart
parentda47b0611f7495fb9f4727449721c18c9a617217 (diff)
Fix unit handling
Fix distance unit handling with respect to the VSS signal for that, and add temperature unit support. Bug-AGL: SPEC-5045 Change-Id: I9b25c36c36d19da55f1b9bff7f380c55d592d5d6 Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Diffstat (limited to 'lib/screen/widgets/gauges/speed_gauge_animation_wrapper.dart')
-rw-r--r--lib/screen/widgets/gauges/speed_gauge_animation_wrapper.dart6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/screen/widgets/gauges/speed_gauge_animation_wrapper.dart b/lib/screen/widgets/gauges/speed_gauge_animation_wrapper.dart
index dfa4277..78b907e 100644
--- a/lib/screen/widgets/gauges/speed_gauge_animation_wrapper.dart
+++ b/lib/screen/widgets/gauges/speed_gauge_animation_wrapper.dart
@@ -16,12 +16,12 @@ class SpeedGauge extends HookConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final double speed = ref.watch(vehicleStatusProvider.select((p) => p.speed));
- final String units = ref.watch(vehicleStatusProvider.select((p) => p.vehicleDistanceUnit));
+ final DistanceUnit unit = ref.watch(vehicleStatusProvider.select((p) => p.distanceUnit));
const double minSpeed = 0;
const double maxSpeed = 240;
const Duration sweepDuration = Duration(milliseconds: 200);
- double speedScaling = (units == "mi") ? 0.621504 : 1.0;
+ double speedScaling = (unit == DistanceUnit.miles) ? 0.621504 : 1.0;
final animationController = useAnimationController(
lowerBound: minSpeed,
@@ -39,7 +39,7 @@ class SpeedGauge extends HookConsumerWidget {
low: minSpeed,
high: maxSpeed,
mainValue: animationController.value,
- label: (units == "mi") ? "mph" : "Km/h",
+ label: (unit == DistanceUnit.miles) ? "mph" : "km/h",
zeroTickLabel: minSpeed.toInt().toString(),
maxTickLabel: maxSpeed.toInt().toString(),
inPrimaryColor: gaugeColor?.inPrimary,