From dbb971abeaa2beff2a13e421f8cca83b3054db34 Mon Sep 17 00:00:00 2001 From: Scott Murray Date: Fri, 5 Jan 2024 18:50:51 -0500 Subject: 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 --- lib/screen/widgets/gauges/speed_gauge_animation_wrapper.dart | 6 +++--- lib/screen/widgets/turn_signal.dart | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'lib/screen/widgets') 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, diff --git a/lib/screen/widgets/turn_signal.dart b/lib/screen/widgets/turn_signal.dart index 446fbb8..861ffd4 100644 --- a/lib/screen/widgets/turn_signal.dart +++ b/lib/screen/widgets/turn_signal.dart @@ -6,13 +6,13 @@ import 'package:hooks_riverpod/hooks_riverpod.dart'; class TurnSignal extends HookConsumerWidget { final double screenHeight; - final bool isLefton; - final bool isRighton; + final bool isLeftOn; + final bool isRightOn; const TurnSignal({ Key? key, required this.screenHeight, - required this.isLefton, - required this.isRighton, + required this.isLeftOn, + required this.isRightOn, }) : super(key: key); double calcPadding(double value, double height) { // values wrt to values at 720 height @@ -38,7 +38,7 @@ class TurnSignal extends HookConsumerWidget { children: [ Image.asset( "images/left.png", - color: (isLefton) + color: (isLeftOn) ? Color.lerp( Colors.black, const Color.fromARGB(255, 99, 251, 104), @@ -48,7 +48,7 @@ class TurnSignal extends HookConsumerWidget { ), Image.asset( "images/right.png", - color: (isRighton) + color: (isRightOn) ? Color.lerp( Colors.black, const Color.fromARGB(255, 99, 251, 104), -- cgit