diff options
author | Aakash Solanki <tech2aks@gmail.com> | 2022-08-31 15:23:53 +0200 |
---|---|---|
committer | Aakash Solanki <tech2aks@gmail.com> | 2022-09-14 11:50:03 +0200 |
commit | e39f2a69fde316b4e260c151757fb739494fbd56 (patch) | |
tree | 3ea8a65eee101457264d0000b5bcf122d428b0b8 /lib/screen/widgets/right_bar.dart | |
parent | 5957cfa0609ff57adfafa4538fb151d00f3c72e3 (diff) |
Upload Flutter Instrument Cluster app
Instrument Cluster demo app which shows speedometer
tachometer guages, temperature and fuel bars and some
indicators like turn indicators, engine malfunction,
lights, cruise control, lane assist. KUKSA.VAL is the
data source for the widgets.
This app depends on several plugins and all the plugins
have an OSI-approved license.
Bug-AGL: SPEC-4543
Change-Id: I2698c66f9d8d824690ae7e567ca7c93ceeb17e08
Signed-off-by: Aakash Solanki <tech2aks@gmail.com>
Diffstat (limited to 'lib/screen/widgets/right_bar.dart')
-rw-r--r-- | lib/screen/widgets/right_bar.dart | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/lib/screen/widgets/right_bar.dart b/lib/screen/widgets/right_bar.dart new file mode 100644 index 0000000..e5ed44d --- /dev/null +++ b/lib/screen/widgets/right_bar.dart @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: Apache-2.0
+
+import 'package:flutter/material.dart';
+import 'package:flutter_hooks/flutter_hooks.dart';
+import 'package:hooks_riverpod/hooks_riverpod.dart';
+import 'package:flutter_cluster_dashboard/screen/paints/arc_painter.dart';
+import 'package:flutter_cluster_dashboard/vehicle_signal/vehicle_signal_model.dart';
+import 'package:flutter_cluster_dashboard/vehicle_signal/vehicle_signal_provider.dart';
+
+class RightArc extends HookConsumerWidget {
+ final double screenHeight;
+ const RightArc({Key? key, required this.screenHeight}) : super(key: key);
+
+ @override
+ Widget build(BuildContext context, WidgetRef ref) {
+ final VehicleSignal vehicle = ref.watch(vehicleSignalProvider);
+ final animationController = useAnimationController(
+ lowerBound: 0,
+ upperBound: 100,
+ )..animateTo(vehicle.fuelLevel,
+ duration: const Duration(milliseconds: 500));
+
+ return AnimatedBuilder(
+ animation: animationController,
+ builder: (context, child) {
+ return CustomPaint(
+ size: Size(0, (220 * screenHeight) / 480),
+ painter: RightPainter(
+ radi: (170 * screenHeight) / 480,
+ currentValue: animationController.value,
+ bottomPadding: 17,
+ color: Color.lerp(Colors.red, Colors.green,
+ (animationController.value / 100)) ??
+ Colors.blue),
+ );
+ },
+ );
+ }
+}
|