From 6a00ac1f8613048b5c1f7ecdbd1adcbbcfdca5ed Mon Sep 17 00:00:00 2001 From: Lisandro Pérez Meyer Date: Thu, 16 Nov 2023 15:42:22 -0300 Subject: Disable value animation at start up % update FuelLevel path. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove some warnings. Original from: Dominik Wawrzonek Bug-AGL: SPEC-4971 Change-Id: I3693fa74f7995b4dcb016812403ed800702cb81c Signed-off-by: Lisandro Pérez Meyer --- lib/core/constants/constants.dart | 2 +- lib/core/constants/vss_path.dart | 3 ++- lib/data/data_providers/hybrid_notifier.dart | 4 +++- lib/data/data_providers/vehicle_notifier.dart | 11 ++++++----- lib/data/models/vehicle.dart | 6 +++--- lib/main.dart | 1 - lib/presentation/screens/apps/apps_content.dart | 1 - .../screens/dashboard/widgets/circle_indicator.dart | 2 +- lib/presentation/screens/splash/widget/splash_content.dart | 2 +- pubspec.lock | 2 +- 10 files changed, 18 insertions(+), 16 deletions(-) diff --git a/lib/core/constants/constants.dart b/lib/core/constants/constants.dart index fe8d9f1..902af56 100644 --- a/lib/core/constants/constants.dart +++ b/lib/core/constants/constants.dart @@ -4,7 +4,7 @@ const splashWarning = 'Please use the IVI system responsibly while driving. Keep your attention on the road, and use voice commands or hands-free controls when interacting with the system. Distracted driving can lead to accidents and serious injury. Follow all traffic laws and drive safely.'; const aglVeriosn = 'AGL 16.0.2 (pike)'; const kernelVeriosn = 'Kernel: 5.10.41.-yocto-standard'; -const maxFuelLevel = 55.0; +const maxFuelLevel = 100.0; const maxSpeed = 240.0; const maxRpm = 8000; final GlobalKey homeScaffoldKey = GlobalKey(); diff --git a/lib/core/constants/vss_path.dart b/lib/core/constants/vss_path.dart index 8875d1e..92c036f 100644 --- a/lib/core/constants/vss_path.dart +++ b/lib/core/constants/vss_path.dart @@ -5,7 +5,8 @@ class VSSPath { static const String vehicleOutsideTemperature = 'Vehicle.Exterior.AirTemperature'; static const String vehicleRange = 'Vehicle.Powertrain.FuelSystem.Range'; - static const String vehicleFuelLevel = 'Vehicle.OBD.FuelLevel'; + static const String vehicleFuelLevel = + 'Vehicle.Powertrain.FuelSystem.RelativeLevel'; static const String vehicleMediaVolume = 'Vehicle.Cabin.Infotainment.Media.Volume'; static const String vehicleIsChildLockActiveLeft = diff --git a/lib/data/data_providers/hybrid_notifier.dart b/lib/data/data_providers/hybrid_notifier.dart index a19bf58..fd16a68 100644 --- a/lib/data/data_providers/hybrid_notifier.dart +++ b/lib/data/data_providers/hybrid_notifier.dart @@ -1,3 +1,5 @@ +// ignore_for_file: unused_local_variable + import '../../export.dart'; class HybridNotifier extends StateNotifier { @@ -83,7 +85,7 @@ class HybridNotifier extends StateNotifier { // currentState = HybridState.baterryOutput; // } - // Zaktualizuj stan + // Update hybrid state if (currentState != previousState) { state = state.copyWith(hybridState: currentState); } diff --git a/lib/data/data_providers/vehicle_notifier.dart b/lib/data/data_providers/vehicle_notifier.dart index 012e5dc..fb69595 100644 --- a/lib/data/data_providers/vehicle_notifier.dart +++ b/lib/data/data_providers/vehicle_notifier.dart @@ -1,3 +1,5 @@ +// ignore_for_file: unused_local_variable + import 'dart:async'; import 'package:flutter_ics_homescreen/export.dart'; @@ -55,8 +57,8 @@ class VehicleNotifier extends StateNotifier { } break; case VSSPath.vehicleFuelLevel: - if (update.entry.value.hasFloat()) { - state = state.copyWith(fuelLevel: update.entry.value.float); + if (update.entry.value.hasUint32()) { + state = state.copyWith(fuelLevel: update.entry.value.uint32); } break; // case VSSPath.vehicleMediaVolume: @@ -290,7 +292,6 @@ class VehicleNotifier extends StateNotifier { // }); } try { - // ignore: unused_local_variable Map metadata = {}; //var responseStream = _stub.subscribe(request); stub.subscribe(request).listen((value) async { @@ -434,11 +435,11 @@ class VehicleNotifier extends StateNotifier { actualFuelLevel = actualFuelLevel + 1; if (actualFuelLevel > fuelLevel) { - actualFuelLevel = fuelLevel; + actualFuelLevel = fuelLevel.toDouble(); timer.cancel(); } - state = state.copyWith(fuelLevel: actualFuelLevel); + state = state.copyWith(fuelLevel: actualFuelLevel.toInt()); }); Timer outsideTemperatureTimer = Timer.periodic(const Duration(milliseconds: 300), (timer) { diff --git a/lib/data/models/vehicle.dart b/lib/data/models/vehicle.dart index f27b750..adc6fc2 100644 --- a/lib/data/models/vehicle.dart +++ b/lib/data/models/vehicle.dart @@ -8,7 +8,7 @@ class Vehicle { final double insideTemperature; final double outsideTemperature; final int range; - final double fuelLevel; + final int fuelLevel; final int mediaVolume; final bool isChildLockActiveLeft; final bool isChildLockActiveRight; @@ -68,7 +68,7 @@ class Vehicle { insideTemperature = 25, outsideTemperature = 32.0, range = 21, - fuelLevel = 49.5, + fuelLevel = 49, mediaVolume = 50, isChildLockActiveLeft = false, isChildLockActiveRight = true, @@ -88,7 +88,7 @@ class Vehicle { double? insideTemperature, double? outsideTemperature, int? range, - double? fuelLevel, + int? fuelLevel, int? mediaVolume, bool? isChildLockActiveLeft, bool? isChildLockActiveRight, diff --git a/lib/main.dart b/lib/main.dart index 78795f4..3b896fc 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -4,7 +4,6 @@ import 'export.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); - // MediaKit.ensureInitialized(); //replace with lottie runApp(DevicePreview( enabled: false, tools: const [ diff --git a/lib/presentation/screens/apps/apps_content.dart b/lib/presentation/screens/apps/apps_content.dart index 52da10c..fe6e3b0 100644 --- a/lib/presentation/screens/apps/apps_content.dart +++ b/lib/presentation/screens/apps/apps_content.dart @@ -1,4 +1,3 @@ -import 'package:flutter_ics_homescreen/data/models/hybrid.dart'; import 'package:flutter_ics_homescreen/export.dart'; import 'package:flutter_ics_homescreen/presentation/screens/apps/widgets/app_button.dart'; diff --git a/lib/presentation/screens/dashboard/widgets/circle_indicator.dart b/lib/presentation/screens/dashboard/widgets/circle_indicator.dart index 7a4e724..8fe9533 100644 --- a/lib/presentation/screens/dashboard/widgets/circle_indicator.dart +++ b/lib/presentation/screens/dashboard/widgets/circle_indicator.dart @@ -285,7 +285,7 @@ class FuelProgressIndicatorState extends ConsumerState width: 220, child: CustomPaint( foregroundPainter: CirclePainter( - value: fuelLevel, + value: fuelLevel.toDouble(), maxValue: maxFuelLevel, isFuel: true, isRPM: false), diff --git a/lib/presentation/screens/splash/widget/splash_content.dart b/lib/presentation/screens/splash/widget/splash_content.dart index 325baeb..991be84 100644 --- a/lib/presentation/screens/splash/widget/splash_content.dart +++ b/lib/presentation/screens/splash/widget/splash_content.dart @@ -126,7 +126,7 @@ class SplashContentState extends ConsumerState width: 452, text: 'Continue', onTap: () { - ref.read(vehicleProvider.notifier).setInitialState(); + // ref.read(vehicleProvider.notifier).setInitialState(); ref .read(appProvider.notifier) .update((state) => state = AppState.dashboard); diff --git a/pubspec.lock b/pubspec.lock index 4645dd5..f78814f 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -488,7 +488,7 @@ packages: protos: dependency: "direct main" description: - path: "./protos" + path: protos relative: true source: path version: "1.0.0" -- cgit 1.2.3-korg