From 80a4f8d75a66c22a23e825d4c0fb4065e2e58cb8 Mon Sep 17 00:00:00 2001 From: Scott Murray Date: Sun, 24 Sep 2023 12:45:03 -0400 Subject: Rework to use KUKSA.val databroker gRPC API Rework to move from the WebSocket API with the older KUKSA.val server to the gRPC "VAL" API of the databroker. Changes include: - All VISS WebSocket API code has been removed, and the signal providers replumbed to be driven by a new VssClient class with a dashboard-specific child class to hold all the gRPC API handling. - The generated code for the VAL API and its dependencies has been checked in under lib/generated, as there still does not seem to be a good way to generate it during the Flutter build. - The "flutter-" prefix has been dropped from the configuration file name (i.e. it's now just "cluster-dashboard.yaml") to match the naming used for the other Flutter applications. The authorization token field name has been renamed to "authorization", and there are new "use-tls" and "ca-certificate" configuration fields. TLS is disabled by default for now, and the default CA certificate is /etc/kuksa.val/CA.pem. - Bumped minimum SDK version to 2.18 in pubspec.yaml to enable "super" keyword support. This matches what the version was set to in the other applications. - The unused navigation support has been removed to simplify maintenance, as it is more likely that it will be replaced with something else in the future than fixed to be usable. - Removed .dart_tool generated output that had been checked in, and added .gitignore file from flutter-homescreen so that things will hopefully stay clean in the future. Since pubspec.lock is not checked in here, it has also been added to .gitignore. Bug-AGL: SPEC-4762 Signed-off-by: Scott Murray Change-Id: Id35c569cdbb8476a527717ece7b4bb369c4874b7 --- .../gauges/rpm_gauge_animation_wrapper.dart | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 lib/screen/widgets/gauges/rpm_gauge_animation_wrapper.dart (limited to 'lib/screen/widgets/gauges/rpm_gauge_animation_wrapper.dart') diff --git a/lib/screen/widgets/gauges/rpm_gauge_animation_wrapper.dart b/lib/screen/widgets/gauges/rpm_gauge_animation_wrapper.dart new file mode 100644 index 0000000..fa76bd8 --- /dev/null +++ b/lib/screen/widgets/gauges/rpm_gauge_animation_wrapper.dart @@ -0,0 +1,50 @@ +// SPDX-License-Identifier: Apache-2.0 + +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_hooks/flutter_hooks.dart'; +import 'package:hooks_riverpod/hooks_riverpod.dart'; +import 'package:flutter_cluster_dashboard/screen/widgets/gauges/gauge_props.dart'; +import 'package:flutter_cluster_dashboard/screen/widgets/gauges/gauge_widget.dart'; +import 'package:flutter_cluster_dashboard/vehicle-signals/vehicle_status_provider.dart'; + +class RPMGauge extends HookConsumerWidget { + final double screenHeight; + final GaugeColors? gaugeColor; + const RPMGauge({Key? key, required this.screenHeight, this.gaugeColor}) + : super(key: key); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final double rpm = ref.watch(vehicleStatusProvider.select((p) => p.rpm)); + + const double minRPM = 0; + const double maxRPM = 8000; + const Duration sweepDuration = Duration(milliseconds: 200); + + final animationController = useAnimationController( + lowerBound: minRPM, + upperBound: maxRPM, + )..animateTo(rpm, + duration: sweepDuration, curve: Curves.linearToEaseOut); + return AnimatedBuilder( + animation: animationController, + builder: (context, child) { + return Padding( + padding: const EdgeInsets.all(8.0), + child: CustomGauge( + size: (248 * screenHeight) / 480, + low: minRPM, + high: maxRPM, + mainValue: animationController.value, + label: "rpm", + zeroTickLabel: minRPM.toInt().toString(), + maxTickLabel: maxRPM.toInt().toString(), + inPrimaryColor: gaugeColor?.inPrimary, + outPrimaryColor: gaugeColor?.outPrimary, + secondaryColor: gaugeColor?.secondary, + ), + ); + }); + } +} -- cgit 1.2.3-korg