aboutsummaryrefslogtreecommitdiffstats
path: root/lib/data
diff options
context:
space:
mode:
authorLisandro Pérez Meyer <lpmeyer@ics.com>2023-11-14 17:20:58 -0300
committerLisandro Pérez Meyer <lpmeyer@ics.com>2023-11-14 17:31:12 -0300
commit70ec8a79a121471a004e7e4c23157d10157e136f (patch)
treea4f9c0a4fac4e4274ec4324a289b6ef62e1c5653 /lib/data
Initial cleanup push.
Based on agldemo2024 on commit 2a5dc04d801134338150c3f6afc67eaa65599763 Disable device preview. Disable Lottie animation. The original commit was b3c493c340fcb4bb0a937692838fc830bec3e9ea but I am just keeping this change, because the json did not really needed to change. I think. Signed-off-by: Lisandro Pérez Meyer <lpmeyer@ics.com>
Diffstat (limited to 'lib/data')
-rw-r--r--lib/data/data_providers/app.dart25
-rw-r--r--lib/data/data_providers/app_provider.dart63
-rw-r--r--lib/data/data_providers/audio_notifier.dart25
-rw-r--r--lib/data/data_providers/datetime_notifier.dart14
-rw-r--r--lib/data/data_providers/hybrid_notifier.dart91
-rw-r--r--lib/data/data_providers/signal_notifier.dart14
-rw-r--r--lib/data/data_providers/units_notifier.dart13
-rw-r--r--lib/data/data_providers/users_notifier.dart49
-rw-r--r--lib/data/data_providers/vehicle_notifier.dart367
-rw-r--r--lib/data/data_providers/vss_provider.dart105
-rw-r--r--lib/data/models/audio.dart84
-rw-r--r--lib/data/models/connections_signals.dart92
-rw-r--r--lib/data/models/date_time.dart59
-rw-r--r--lib/data/models/hybrid.dart98
-rw-r--r--lib/data/models/units.dart45
-rw-r--r--lib/data/models/user.dart54
-rw-r--r--lib/data/models/users.dart64
-rw-r--r--lib/data/models/vehicle.dart233
-rw-r--r--lib/data/theme/theme.dart43
19 files changed, 1538 insertions, 0 deletions
diff --git a/lib/data/data_providers/app.dart b/lib/data/data_providers/app.dart
new file mode 100644
index 0000000..acfaa01
--- /dev/null
+++ b/lib/data/data_providers/app.dart
@@ -0,0 +1,25 @@
+import '../../export.dart';
+
+class App extends StatelessWidget {
+ const App({super.key});
+
+ @override
+ Widget build(BuildContext context) {
+ return const AppView();
+ }
+}
+
+class AppView extends StatelessWidget {
+ const AppView({super.key});
+
+ @override
+ Widget build(BuildContext context) {
+ return ProviderScope(
+ child: MaterialApp(
+ debugShowCheckedModeBanner: false,
+ theme: theme,
+ home: const HomeScreen(),
+ ),
+ );
+ }
+}
diff --git a/lib/data/data_providers/app_provider.dart b/lib/data/data_providers/app_provider.dart
new file mode 100644
index 0000000..c528a1a
--- /dev/null
+++ b/lib/data/data_providers/app_provider.dart
@@ -0,0 +1,63 @@
+import 'package:flutter_ics_homescreen/data/data_providers/datetime_notifier.dart';
+import 'package:flutter_ics_homescreen/data/data_providers/hybrid_notifier.dart';
+import 'package:flutter_ics_homescreen/data/data_providers/signal_notifier.dart';
+import 'package:flutter_ics_homescreen/data/data_providers/units_notifier.dart';
+import 'package:flutter_ics_homescreen/data/data_providers/audio_notifier.dart';
+import 'package:flutter_ics_homescreen/data/data_providers/users_notifier.dart';
+import 'package:flutter_ics_homescreen/data/models/date_time.dart';
+import 'package:flutter_ics_homescreen/export.dart';
+
+import '../models/users.dart';
+import 'vehicle_notifier.dart';
+
+enum AppState {
+ home,
+ dashboard,
+ hvac,
+ apps,
+ mediaPlayer,
+ settings,
+ splash,
+ dateTime,
+ bluetooth,
+ wifi,
+ wired,
+ audioSettings,
+ profiles,
+ newProfile,
+ units,
+ versionInfo,
+ weather,
+ distanceUnit,
+ tempUnit,
+ clock,
+ date,
+ time
+}
+
+final appProvider = StateProvider<AppState>((ref) => AppState.splash);
+final vehicleProvider = StateNotifierProvider<VehicleNotifier, Vehicle>((ref) {
+ return VehicleNotifier(const Vehicle.initial());
+});
+final signalsProvider = StateNotifierProvider<SignalNotifier, Signals>((ref) {
+ return SignalNotifier(const Signals.initial());
+});
+
+final unitStateProvider = StateNotifierProvider<UnitsNotifier, Units>((ref) {
+ return UnitsNotifier(const Units.initial());
+});
+final audioStateProvider = StateNotifierProvider<AudioNotifier, Audio>((ref) {
+ return AudioNotifier(const Audio.initial());
+});
+
+final usersProvider = StateNotifierProvider<UsersNotifier, Users>((ref) {
+ return UsersNotifier(Users.initial());
+});
+
+final dateTimeStateProvider =
+ StateNotifierProvider<DateTimeNotifier, DateAndTime>((ref) {
+ return DateTimeNotifier(DateAndTime.initial());
+});
+final hybridtateProvider = StateNotifierProvider<HybridNotifier, Hybrid>((ref) {
+ return HybridNotifier(const Hybrid.initial());
+});
diff --git a/lib/data/data_providers/audio_notifier.dart b/lib/data/data_providers/audio_notifier.dart
new file mode 100644
index 0000000..8981036
--- /dev/null
+++ b/lib/data/data_providers/audio_notifier.dart
@@ -0,0 +1,25 @@
+import 'package:flutter_ics_homescreen/export.dart';
+
+class AudioNotifier extends StateNotifier<Audio> {
+ AudioNotifier(super.state);
+
+ void resetToDefaults() {
+ state = state.copyWith(treble: 5.0, bass: 5.0, rearFront: 5.0);
+ }
+
+ void setVolume(double newVal) {
+ state = state.copyWith(volume: newVal);
+ }
+
+ void setTreble(double newVal) {
+ state = state.copyWith(treble: newVal);
+ }
+
+ void setBass(double newVal) {
+ state = state.copyWith(bass: newVal);
+ }
+
+ void setRearFront(double newVal) {
+ state = state.copyWith(rearFront: newVal);
+ }
+}
diff --git a/lib/data/data_providers/datetime_notifier.dart b/lib/data/data_providers/datetime_notifier.dart
new file mode 100644
index 0000000..6947a34
--- /dev/null
+++ b/lib/data/data_providers/datetime_notifier.dart
@@ -0,0 +1,14 @@
+import 'package:flutter_ics_homescreen/data/models/date_time.dart';
+import 'package:flutter_ics_homescreen/export.dart';
+
+class DateTimeNotifier extends StateNotifier<DateAndTime> {
+ DateTimeNotifier(super.state);
+
+ void setDate(String newVal) {
+ state = state.copyWith(date: newVal);
+ }
+
+ void setTime(String newVal) {
+ state = state.copyWith(time: newVal);
+ }
+}
diff --git a/lib/data/data_providers/hybrid_notifier.dart b/lib/data/data_providers/hybrid_notifier.dart
new file mode 100644
index 0000000..a19bf58
--- /dev/null
+++ b/lib/data/data_providers/hybrid_notifier.dart
@@ -0,0 +1,91 @@
+import '../../export.dart';
+
+class HybridNotifier extends StateNotifier<Hybrid> {
+ HybridNotifier(super.state);
+
+ void setHybridState(HybridState hybridState) {
+ switch (hybridState) {
+ case HybridState.idle:
+ state = state.copyWith(
+ topArrowState: ArrowState.blue,
+ leftArrowState: ArrowState.blue,
+ rightArrowState: ArrowState.blue,
+ batteryState: BatteryState.white,
+ );
+ break;
+ case HybridState.engineOutput:
+ state = state.copyWith(
+ topArrowState: ArrowState.red,
+ leftArrowState: ArrowState.red,
+ rightArrowState: ArrowState.blue,
+ batteryState: BatteryState.red,
+ );
+ break;
+ case HybridState.regenerativeBreaking:
+ state = state.copyWith(
+ topArrowState: ArrowState.blue,
+ leftArrowState: ArrowState.blue,
+ rightArrowState: ArrowState.green,
+ batteryState: BatteryState.green);
+
+ break;
+ case HybridState.baterryOutput:
+ state = state.copyWith(
+ topArrowState: ArrowState.blue,
+ leftArrowState: ArrowState.blue,
+ rightArrowState: ArrowState.yellow,
+ batteryState: BatteryState.yellow);
+ break;
+ default:
+ }
+ state = state.copyWith(hybridState: hybridState);
+ }
+
+ void updateHybridState() {
+ // Variable to store the current state
+ HybridState currentState = state.hybridState;
+
+ // Variable to store the previous state
+ HybridState previousState = currentState;
+
+ // Variable to store the average speed value
+ double avgSpeed = 0.0;
+
+ // Variable for storing the average value of RPM
+ double avgRpm = 0.0;
+
+ // Variable to store the brake value state
+ bool brake = false;
+
+ // Collect 10 samples
+ for (int i = 0; i < 10; i++) {
+ // Get the current values for speed, engine rpm and brake status
+
+ // speed = vehicleProvider();
+ // rpm = _rpmFromServer();
+ // brake = _brakeFromServer();
+
+ // Calculate the average speed value
+ // avgSpeed = (avgSpeed * (i + 1) + speed) / (i + 2);
+
+ // Calculate the average engine rpm
+ // avgRpm = (avgRpm * (i + 1) + rpm) / (i + 2);
+ }
+
+ // define new state
+ // if (avgSpeed == 0 && avgRpm == 0) {
+ // currentState = HybridState.idle;
+ // } else if (avgRpm > 0 && avgSpeed > 0) {
+ // currentState = HybridState.engineOutput;
+ // } else if (avgRpm == 0 && brake) {
+ // currentState = HybridState.regenerativeBreaking;
+ // } else if (avgSpeed > 0 && avgRpm <= avgSpeed) {
+ // currentState = HybridState.baterryOutput;
+ // }
+
+ // Zaktualizuj stan
+ if (currentState != previousState) {
+ state = state.copyWith(hybridState: currentState);
+ }
+ }
+}
diff --git a/lib/data/data_providers/signal_notifier.dart b/lib/data/data_providers/signal_notifier.dart
new file mode 100644
index 0000000..3059174
--- /dev/null
+++ b/lib/data/data_providers/signal_notifier.dart
@@ -0,0 +1,14 @@
+import 'package:flutter_ics_homescreen/export.dart';
+
+class SignalNotifier extends StateNotifier<Signals> {
+ SignalNotifier(super.state);
+
+ void startListen() {}
+ void toggleBluetooth() {
+ state = state.copyWith(isBluetoothConnected: !state.isBluetoothConnected);
+ }
+
+ void toggleWifi() {
+ state = state.copyWith(isWifiConnected: !state.isWifiConnected);
+ }
+}
diff --git a/lib/data/data_providers/units_notifier.dart b/lib/data/data_providers/units_notifier.dart
new file mode 100644
index 0000000..f7c25aa
--- /dev/null
+++ b/lib/data/data_providers/units_notifier.dart
@@ -0,0 +1,13 @@
+import '../../export.dart';
+
+class UnitsNotifier extends StateNotifier<Units> {
+ UnitsNotifier(super.state);
+
+ void setDistanceUnit(DistanceUnit unit) {
+ state = state.copyWith(distanceUnit: unit);
+ }
+
+ void setTemperatureUnit(TemperatureUnit unit) {
+ state = state.copyWith(temperatureUnit: unit);
+ }
+}
diff --git a/lib/data/data_providers/users_notifier.dart b/lib/data/data_providers/users_notifier.dart
new file mode 100644
index 0000000..8b48382
--- /dev/null
+++ b/lib/data/data_providers/users_notifier.dart
@@ -0,0 +1,49 @@
+import 'package:flutter_ics_homescreen/data/models/users.dart';
+import 'package:flutter_ics_homescreen/export.dart';
+import 'package:uuid/uuid.dart';
+
+import '../models/user.dart';
+
+class UsersNotifier extends StateNotifier<Users> {
+ UsersNotifier(super.state) {
+ loadUsers();
+ }
+
+ void loadUsers() {
+ state = state.copyWith(users: _users);
+ }
+
+ final List<User> _users = [
+ const User(id: '1', name: 'Heather'),
+ const User(id: '2', name: 'George'),
+ const User(id: '3', name: 'Riley'),
+ ];
+ void selectUser(String userId) {
+ var seletedUser = state.users.firstWhere((user) => user.id == userId);
+ state = state.copyWith(selectedUser: seletedUser);
+ }
+
+ void removeUser(String userId) {
+ state.users.removeWhere((user) => user.id == userId);
+ if (state.users.isNotEmpty) {
+ state = state.copyWith(selectedUser: state.users.first);
+ }
+ if (state.users.isEmpty) {
+ state = state.copyWith(selectedUser: const User(id: '', name: ''));
+ }
+ }
+
+ void addUser(String userName) {
+ final id = const Uuid().v1();
+ final user = User(id: id, name: userName);
+
+ state.users.insert(0, user);
+ state = state.copyWith(selectedUser: state.users.first);
+ }
+
+ void editUser(User user) {
+ // final id = const Uuid().v1();
+ // final user = User(id: id, name: userName);
+ //_users.add(user);
+ }
+}
diff --git a/lib/data/data_providers/vehicle_notifier.dart b/lib/data/data_providers/vehicle_notifier.dart
new file mode 100644
index 0000000..7842311
--- /dev/null
+++ b/lib/data/data_providers/vehicle_notifier.dart
@@ -0,0 +1,367 @@
+import 'dart:async';
+
+import 'package:flutter_ics_homescreen/export.dart';
+import 'package:flutter/services.dart';
+import 'package:protos/protos.dart';
+
+class VehicleNotifier extends StateNotifier<Vehicle> {
+ VehicleNotifier(super.state);
+
+ late ClientChannel channel;
+ late VALClient stub;
+
+ void updateSpeed(double newValue) {
+ state = state.copyWith(speed: newValue);
+ }
+
+ void handleSignalsUpdate(EntryUpdate update) {
+ switch (update.entry.path) {
+ case VSSPath.vehicleSpeed:
+ if (update.entry.value.hasFloat()) {
+ state = state.copyWith(speed: update.entry.value.float);
+ }
+ break;
+ case VSSPath.vehicleInsideTemperature:
+ if (update.entry.value.hasFloat()) {
+ state = state.copyWith(insideTemperature: update.entry.value.float);
+ }
+ break;
+ case VSSPath.vehicleOutsideTemperature:
+ if (update.entry.value.hasFloat()) {
+ state = state.copyWith(outsideTemperature: update.entry.value.float);
+ }
+ break;
+ case VSSPath.vehicleRange:
+ if (update.entry.value.hasUint32()) {
+ state = state.copyWith(range: update.entry.value.uint32);
+ }
+ break;
+ case VSSPath.vehicleFuelLevel:
+ if (update.entry.value.hasFloat()) {
+ state = state.copyWith(fuelLevel: update.entry.value.float);
+ }
+ break;
+ // case VSSPath.vehicleMediaVolume:
+ // if (update.entry.value.hasInt32()) {
+ // ref
+ // .read(vehicleMediaVolume.notifier)
+ // .update((state) => state = update.entry.value.uint32);
+ // }
+ // break;
+ case VSSPath.vehicleIsChildLockActiveLeft:
+ if (update.entry.value.hasBool_12()) {
+ state =
+ state.copyWith(isChildLockActiveLeft: update.entry.value.bool_12);
+ }
+ break;
+ case VSSPath.vehicleIsChildLockActiveRight:
+ if (update.entry.value.hasBool_12()) {
+ state = state.copyWith(
+ isChildLockActiveRight: update.entry.value.bool_12);
+ }
+ break;
+ case VSSPath.vehicleEngineSpeed:
+ if (update.entry.value.hasUint32()) {
+ state = state.copyWith(engineSpeed: update.entry.value.uint32);
+ }
+ break;
+ case VSSPath.vehicleFrontLeftTire:
+ if (update.entry.value.hasUint32()) {
+ state = state.copyWith(frontLeftTire: update.entry.value.uint32);
+ }
+ break;
+ case VSSPath.vehicleFrontRightTire:
+ if (update.entry.value.hasUint32()) {
+ state = state.copyWith(frontRightTire: update.entry.value.uint32);
+ }
+ break;
+ case VSSPath.vehicleRearLeftTire:
+ if (update.entry.value.hasUint32()) {
+ state = state.copyWith(rearLeftTire: update.entry.value.uint32);
+ }
+ break;
+ case VSSPath.vehicleRearRightTire:
+ if (update.entry.value.hasUint32()) {
+ state = state.copyWith(rearRightTire: update.entry.value.uint32);
+ }
+ break;
+
+ ///
+ case VSSPath.vehicleIsAirConditioningActive:
+ if (update.entry.value.hasBool_12()) {
+ state = state.copyWith(
+ isAirConditioningActive: update.entry.value.bool_12);
+ }
+ break;
+ case VSSPath.vehicleIsFrontDefrosterActive:
+ if (update.entry.value.hasBool_12()) {
+ state = state.copyWith(
+ isFrontDefrosterActive: update.entry.value.bool_12);
+ }
+ break;
+ case VSSPath.vehicleIsRearDefrosterActive:
+ if (update.entry.value.hasBool_12()) {
+ state =
+ state.copyWith(isRearDefrosterActive: update.entry.value.bool_12);
+ }
+ break;
+ case VSSPath.vehicleIsRecirculationActive:
+ if (update.entry.value.hasBool_12()) {
+ state =
+ state.copyWith(isRecirculationActive: update.entry.value.bool_12);
+ }
+ break;
+ case VSSPath.vehicleFanSpeed:
+ if (update.entry.value.hasUint32()) {
+ state = state.copyWith(fanSpeed: update.entry.value.uint32);
+ }
+ break;
+
+ // default:
+ // debugPrint("ERROR: Unexpected path ${update.entry.path}");
+ // break;
+ }
+ }
+
+ void startListen() async {
+ String hostName = 'localhost';
+ int port = 8080;
+ try {
+ var data = await rootBundle.loadString('config/config.yaml');
+ final dynamic yamlMap = loadYaml(data);
+
+ if (yamlMap.containsKey('hostname')) {
+ hostName = yamlMap['hostname'];
+ }
+
+ if (yamlMap.containsKey('port')) {
+ port = yamlMap['port'];
+ }
+ } catch (e) {
+ //debugPrint('ERROR: Could not read from file: $configFile');
+ debugPrint(e.toString());
+ }
+ channel = ClientChannel(
+ hostName,
+ port: port,
+ options: const ChannelOptions(
+ credentials: ChannelCredentials.insecure(),
+ ),
+ );
+
+ debugPrint('Start Listen on port: $port');
+ stub = VALClient(channel);
+ List<String> fewSignals = VSSPath().getSignalsList();
+ var request = SubscribeRequest();
+ for (int i = 0; i < fewSignals.length; i++) {
+ var entry = SubscribeEntry();
+ entry.path = fewSignals[i];
+ entry.fields.add(Field.FIELD_PATH);
+ entry.fields.add(Field.FIELD_VALUE);
+ request.entries.add(entry);
+ // _stub.subscribe(request).listen((value) async {
+ // //debugPrint(value.toString());
+ // });
+ }
+ try {
+ // ignore: unused_local_variable
+ Map<String, String> metadata = {};
+ //var responseStream = _stub.subscribe(request);
+ stub.subscribe(request).listen((value) async {
+ for (var update in value.updates) {
+ if (!(update.hasEntry() && update.entry.hasPath())) continue;
+ handleSignalsUpdate(update);
+ }
+ }, onError: (stacktrace, errorDescriptor) {
+ debugPrint(stacktrace.toString());
+ state = const Vehicle.initialForDebug();
+
+ });
+ } catch (e) {
+ debugPrint(e.toString());
+ }
+ }
+
+ void setChildLock({required String side}) {
+ var helper = ValClientHelper(channel: channel, stub: stub);
+ try {
+ switch (side) {
+ case 'left':
+ helper.setBool(
+ VSSPath.vehicleIsChildLockActiveLeft,
+ !state.isChildLockActiveLeft,
+ false,
+ );
+ state = state.copyWith(
+ isChildLockActiveLeft: !state.isChildLockActiveLeft);
+ break;
+ case 'right':
+ helper.setBool(
+ VSSPath.vehicleIsChildLockActiveRight,
+ !state.isChildLockActiveRight,
+ false,
+ );
+ state = state.copyWith(
+ isChildLockActiveRight: !state.isChildLockActiveRight);
+ break;
+ default:
+ debugPrint("ERROR: Unexpected side value $side}");
+ break;
+ }
+ } catch (e) {
+ debugPrint(e.toString());
+ }
+ }
+
+ void updateFanSpeed(int newValue) {
+ state = state.copyWith(fanSpeed: newValue);
+ }
+
+ void setHVACMode({required String mode}) {
+ var helper = ValClientHelper(channel: channel, stub: stub);
+ try {
+ switch (mode) {
+ case 'airCondition':
+ helper.setBool(
+ VSSPath.vehicleIsAirConditioningActive,
+ !state.isAirConditioningActive,
+ false,
+ );
+ state = state.copyWith(
+ isAirConditioningActive: !state.isAirConditioningActive);
+ break;
+ case 'frontDefrost':
+ helper.setBool(
+ VSSPath.vehicleIsFrontDefrosterActive,
+ !state.isFrontDefrosterActive,
+ false,
+ );
+ state = state.copyWith(
+ isFrontDefrosterActive: !state.isFrontDefrosterActive);
+ break;
+ case 'rearDefrost':
+ helper.setBool(
+ VSSPath.vehicleIsRearDefrosterActive,
+ !state.isRearDefrosterActive,
+ false,
+ );
+ state = state.copyWith(
+ isRearDefrosterActive: !state.isRearDefrosterActive);
+ break;
+ case 'recirculation':
+ helper.setBool(
+ VSSPath.vehicleIsRecirculationActive,
+ !state.isRecirculationActive,
+ false,
+ );
+ state = state.copyWith(
+ isRecirculationActive: !state.isRecirculationActive);
+ break;
+ default:
+ debugPrint("ERROR: Unexpected mode value $mode}");
+ break;
+ }
+ } catch (e) {
+ debugPrint(e.toString());
+ }
+ }
+
+ void setInitialState() {
+ var speed = state.speed;
+ var rpm = state.engineSpeed;
+ var fuelLevel = state.fuelLevel;
+ var insideTemp = state.insideTemperature;
+ var outsideTemp = state.outsideTemperature;
+ var range = state.range;
+ var psi = state.frontLeftTire;
+ var actualSpeed = 0.0;
+ var actualRpm = 0;
+ var actualFuelLevel = 0.0;
+ var actualInsideTemp = 0.0;
+ var actualOutsideTemp = 0.0;
+ var actualRange = 0;
+ var actualPsi = 0;
+
+ state = const Vehicle.initial();
+ Timer speedTimer =
+ Timer.periodic(const Duration(milliseconds: 600), (timer) {
+ actualSpeed = actualSpeed + 10;
+
+ if (actualSpeed > speed) {
+ actualSpeed = speed;
+
+ timer.cancel();
+ }
+ state = state.copyWith(speed: actualSpeed);
+ });
+ Timer rpmTimer = Timer.periodic(const Duration(milliseconds: 400), (timer) {
+ actualRpm = actualRpm + 150;
+
+ if (actualRpm > rpm) {
+ actualRpm = rpm;
+ timer.cancel();
+ }
+ state = state.copyWith(engineSpeed: actualRpm);
+ });
+ Timer fuelLevelTimer =
+ Timer.periodic(const Duration(milliseconds: 400), (timer) {
+ actualFuelLevel = actualFuelLevel + 1;
+
+ if (actualFuelLevel > fuelLevel) {
+ actualFuelLevel = fuelLevel;
+
+ timer.cancel();
+ }
+ state = state.copyWith(fuelLevel: actualFuelLevel);
+ });
+ Timer outsideTemperatureTimer =
+ Timer.periodic(const Duration(milliseconds: 300), (timer) {
+ actualOutsideTemp = actualOutsideTemp + 0.5;
+
+ if (actualOutsideTemp > outsideTemp) {
+ actualOutsideTemp = outsideTemp;
+
+ timer.cancel();
+ }
+ state = state.copyWith(outsideTemperature: actualOutsideTemp);
+ });
+ Timer insideTemperatureTimer =
+ Timer.periodic(const Duration(milliseconds: 300), (timer) {
+ actualInsideTemp = actualInsideTemp + 0.5;
+
+ if (actualInsideTemp > insideTemp) {
+ actualInsideTemp = insideTemp;
+
+ timer.cancel();
+ }
+ state = state.copyWith(insideTemperature: actualInsideTemp);
+ });
+ Timer rangeTimer =
+ Timer.periodic(const Duration(milliseconds: 300), (timer) {
+ actualRange = actualRange + 5;
+
+ if (actualRange > range) {
+ actualRange = range;
+
+ timer.cancel();
+ }
+ state = state.copyWith(range: actualRange);
+ });
+ Timer psiTimer =
+ Timer.periodic(const Duration(milliseconds: 1200), (timer) {
+ actualPsi = actualPsi + 5;
+
+ if (actualPsi > psi) {
+ actualPsi = psi;
+
+ timer.cancel();
+ }
+ state = state.copyWith(
+ frontLeftTire: actualPsi,
+ rearLeftTire: actualPsi,
+ frontRightTire: actualPsi,
+ rearRightTire: actualPsi,
+ );
+ });
+ }
+}
diff --git a/lib/data/data_providers/vss_provider.dart b/lib/data/data_providers/vss_provider.dart
new file mode 100644
index 0000000..ca02de6
--- /dev/null
+++ b/lib/data/data_providers/vss_provider.dart
@@ -0,0 +1,105 @@
+import 'package:flutter_ics_homescreen/export.dart';
+import 'package:protos/protos.dart';
+
+class VSS {
+ static handleSignalUpdates(
+ EntryUpdate update,
+ ) {
+ //final ref = ProviderContainer().read(vehicleStateProvider);
+ switch (update.entry.path) {
+ case VSSPath.vehicleSpeed:
+ if (update.entry.value.hasFloat()) {
+ //print(ref);
+ }
+ break;
+ // case VSSPath.vehicleInsideTemperature:
+ // if (update.entry.value.hasFloat()) {
+ // ref
+ // .read(vehicleInsideTemperature.notifier)
+ // .update((state) => state = update.entry.value.float);
+ // }
+ // break;
+ // case VSSPath.vehicleOutsideTemperature:
+ // if (update.entry.value.hasFloat()) {
+ // ref
+ // .read(vehicleOutSideTemperature.notifier)
+ // .update((state) => state = update.entry.value.float);
+ // }
+ // break;
+ // case VSSPath.vehicleRange:
+ // if (update.entry.value.hasInt32()) {
+ // ref
+ // .read(vehicleRange.notifier)
+ // .update((state) => state = update.entry.value.uint32);
+ // }
+ // break;
+ // case VSSPath.vehicleFuelLevel:
+ // if (update.entry.value.hasInt32()) {
+ // ref
+ // .read(vehicleFuelLevel.notifier)
+ // .update((state) => state = update.entry.value.uint32);
+ // }
+ // break;
+ // case VSSPath.vehicleMediaVolume:
+ // if (update.entry.value.hasInt32()) {
+ // ref
+ // .read(vehicleMediaVolume.notifier)
+ // .update((state) => state = update.entry.value.uint32);
+ // }
+ // break;
+ // case VSSPath.vehicleIsChildLockActiveLeft:
+ // if (update.entry.value.hasBool_12()) {
+ // ref
+ // .read(vehicleIsChildLockActiveLeft.notifier)
+ // .update((state) => state = update.entry.value.bool_12);
+ // }
+ // break;
+ // case VSSPath.vehicleIsChildLockActiveRight:
+ // if (update.entry.value.hasBool_12()) {
+ // ref
+ // .read(vehicleIsChildLockActiveRight.notifier)
+ // .update((state) => state = update.entry.value.bool_12);
+ // }
+ // break;
+ // case VSSPath.vehicleEngineSpeed:
+ // if (update.entry.value.hasFloat()) {
+ // ref
+ // .read(vehicleEngineSpeed.notifier)
+ // .update((state) => state = update.entry.value.float);
+ // }
+ // break;
+ // case VSSPath.vehicleFrontLeftTire:
+ // if (update.entry.value.hasFloat()) {
+ // ref
+ // .read(vehicleFrontLeftTire.notifier)
+ // .update((state) => state = update.entry.value.float);
+ // }
+ // break;
+ // case VSSPath.vehicleFrontRightTire:
+ // if (update.entry.value.hasFloat()) {
+ // ref
+ // .read(vehicleFrontRightTire.notifier)
+ // .update((state) => state = update.entry.value.float);
+ // }
+ // break;
+ // case VSSPath.vehicleRearLeftTire:
+ // if (update.entry.value.hasFloat()) {
+ // ref
+ // .read(vehicleRearLeftTire.notifier)
+ // .update((state) => state = update.entry.value.float);
+ // }
+ // break;
+ // case VSSPath.vehicleRearRightTire:
+ // if (update.entry.value.hasFloat()) {
+ // ref
+ // .read(vehicleRearRightTire.notifier)
+ // .update((state) => state = update.entry.value.float);
+ // }
+ // break;
+
+ default:
+ debugPrint("ERROR: Unexpected path ${update.entry.path}");
+ break;
+ }
+ }
+}
diff --git a/lib/data/models/audio.dart b/lib/data/models/audio.dart
new file mode 100644
index 0000000..69df18b
--- /dev/null
+++ b/lib/data/models/audio.dart
@@ -0,0 +1,84 @@
+import 'dart:convert';
+
+import 'package:flutter_ics_homescreen/export.dart';
+
+@immutable
+class Audio {
+ final double volume;
+ final double treble;
+ final double bass;
+ final double rearFront;
+ const Audio({
+ required this.volume,
+ required this.treble,
+ required this.bass,
+ required this.rearFront,
+ });
+
+ const Audio.initial()
+ : volume = 5.0,
+ treble = 5.0,
+ bass = 5.0,
+ rearFront = 5.0;
+
+
+ Audio copyWith({
+ double? volume,
+ double? treble,
+ double? bass,
+ double? rearFront,
+ }) {
+ return Audio(
+ volume: volume ?? this.volume,
+ treble: treble ?? this.treble,
+ bass: bass ?? this.bass,
+ rearFront: rearFront ?? this.rearFront,
+ );
+ }
+
+ Map<String, dynamic> toMap() {
+ return {
+ 'volume': volume,
+ 'treble': treble,
+ 'bass': bass,
+ 'rearFront': rearFront,
+ };
+ }
+
+ factory Audio.fromMap(Map<String, dynamic> map) {
+ return Audio(
+ volume: map['volume']?.toDouble() ?? 0.0,
+ treble: map['treble']?.toDouble() ?? 0.0,
+ bass: map['bass']?.toDouble() ?? 0.0,
+ rearFront: map['rearFront']?.toDouble() ?? 0.0,
+ );
+ }
+
+ String toJson() => json.encode(toMap());
+
+ factory Audio.fromJson(String source) => Audio.fromMap(json.decode(source));
+
+ @override
+ String toString() {
+ return 'Audio(volume: $volume, treble: $treble, bass: $bass, rearFront: $rearFront)';
+ }
+
+ @override
+ bool operator ==(Object other) {
+ if (identical(this, other)) return true;
+
+ return other is Audio &&
+ other.volume == volume &&
+ other.treble == treble &&
+ other.bass == bass &&
+ other.rearFront == rearFront;
+ }
+
+ @override
+ int get hashCode {
+ return volume.hashCode ^
+ treble.hashCode ^
+ bass.hashCode ^
+ rearFront.hashCode;
+ }
+}
diff --git a/lib/data/models/connections_signals.dart b/lib/data/models/connections_signals.dart
new file mode 100644
index 0000000..cd6d695
--- /dev/null
+++ b/lib/data/models/connections_signals.dart
@@ -0,0 +1,92 @@
+import 'dart:convert';
+
+import 'package:flutter_ics_homescreen/export.dart';
+
+@immutable
+class Signals {
+ final bool isBluetoothConnected;
+ final bool isDataConnected;
+ final bool isWifiConnected;
+ final int dataSignalStrenght;
+ final int wifiSignalStrenght;
+ const Signals({
+ required this.isBluetoothConnected,
+ required this.isDataConnected,
+ required this.isWifiConnected,
+ required this.dataSignalStrenght,
+ required this.wifiSignalStrenght,
+ });
+ const Signals.initial()
+ : isBluetoothConnected = false,
+ isDataConnected = false,
+ isWifiConnected = false,
+ dataSignalStrenght = 0,
+ wifiSignalStrenght = 0;
+
+ Signals copyWith({
+ bool? isBluetoothConnected,
+ bool? isDataConnected,
+ bool? isWifiConnected,
+ int? dataSignalStrenght,
+ int? wifiSignalStrenght,
+ }) {
+ return Signals(
+ isBluetoothConnected: isBluetoothConnected ?? this.isBluetoothConnected,
+ isDataConnected: isDataConnected ?? this.isDataConnected,
+ isWifiConnected: isWifiConnected ?? this.isWifiConnected,
+ dataSignalStrenght: dataSignalStrenght ?? this.dataSignalStrenght,
+ wifiSignalStrenght: wifiSignalStrenght ?? this.wifiSignalStrenght,
+ );
+ }
+
+ Map<String, dynamic> toMap() {
+ return {
+ 'isBluetoothConnected': isBluetoothConnected,
+ 'isDataConnected': isDataConnected,
+ 'isWifiConnected': isWifiConnected,
+ 'dataSignalStrenght': dataSignalStrenght,
+ 'wifiSignalStrenght': wifiSignalStrenght,
+ };
+ }
+
+ factory Signals.fromMap(Map<String, dynamic> map) {
+ return Signals(
+ isBluetoothConnected: map['isBluetoothConnected'] ?? false,
+ isDataConnected: map['isDataConnected'] ?? false,
+ isWifiConnected: map['isWifiConnected'] ?? false,
+ dataSignalStrenght: map['dataSignalStrenght']?.toInt() ?? 0,
+ wifiSignalStrenght: map['wifiSignalStrenght']?.toInt() ?? 0,
+ );
+ }
+
+ String toJson() => json.encode(toMap());
+
+ factory Signals.fromJson(String source) =>
+ Signals.fromMap(json.decode(source));
+
+ @override
+ String toString() {
+ return 'Signals(isBluetoothConnected: $isBluetoothConnected, isDataConnected: $isDataConnected, isWifiConnected: $isWifiConnected, dataSignalStrenght: $dataSignalStrenght, wifiSignalStrenght: $wifiSignalStrenght)';
+ }
+
+ @override
+ bool operator ==(Object other) {
+ if (identical(this, other)) return true;
+
+ return other is Signals &&
+ other.isBluetoothConnected == isBluetoothConnected &&
+ other.isDataConnected == isDataConnected &&
+ other.isWifiConnected == isWifiConnected &&
+ other.dataSignalStrenght == dataSignalStrenght &&
+ other.wifiSignalStrenght == wifiSignalStrenght;
+ }
+
+ @override
+ int get hashCode {
+ return isBluetoothConnected.hashCode ^
+ isDataConnected.hashCode ^
+ isWifiConnected.hashCode ^
+ dataSignalStrenght.hashCode ^
+ wifiSignalStrenght.hashCode;
+ }
+}
diff --git a/lib/data/models/date_time.dart b/lib/data/models/date_time.dart
new file mode 100644
index 0000000..62d7743
--- /dev/null
+++ b/lib/data/models/date_time.dart
@@ -0,0 +1,59 @@
+import 'dart:convert';
+
+import 'package:flutter_ics_homescreen/export.dart';
+import 'package:intl/intl.dart';
+
+@immutable
+class DateAndTime {
+ final String date;
+ final String time;
+ const DateAndTime({
+ required this.date,
+ required this.time,
+ });
+
+ DateAndTime.initial()
+ : date = DateFormat().add_yMMMMd().format(DateTime.now()),
+ time = DateFormat('hh:mm a').format(DateTime.now());
+ DateAndTime copyWith({
+ String? date,
+ String? time,
+ }) {
+ return DateAndTime(
+ date: date ?? this.date,
+ time: time ?? this.time,
+ );
+ }
+
+ Map<String, dynamic> toMap() {
+ return {
+ 'date': date,
+ 'time': time,
+ };
+ }
+
+ factory DateAndTime.fromMap(Map<String, dynamic> map) {
+ return DateAndTime(
+ date: map['date'],
+ time: map['time'],
+ );
+ }
+
+ String toJson() => json.encode(toMap());
+
+ factory DateAndTime.fromJson(String source) =>
+ DateAndTime.fromMap(json.decode(source));
+
+ @override
+ String toString() => 'DateAndTime(date: $date, time: $time)';
+
+ @override
+ bool operator ==(Object other) {
+ if (identical(this, other)) return true;
+
+ return other is DateAndTime && other.date == date && other.time == time;
+ }
+
+ @override
+ int get hashCode => date.hashCode ^ time.hashCode;
+}
diff --git a/lib/data/models/hybrid.dart b/lib/data/models/hybrid.dart
new file mode 100644
index 0000000..d567f14
--- /dev/null
+++ b/lib/data/models/hybrid.dart
@@ -0,0 +1,98 @@
+enum HybridState {
+ idle,
+ engineOutput,
+ regenerativeBreaking,
+ baterryOutput,
+}
+
+enum ArrowState { blue, red, green, yellow }
+
+enum BatteryState { white, red, green, yellow, orange }
+
+class Hybrid {
+ final HybridState hybridState;
+ final ArrowState topArrowState;
+ final ArrowState leftArrowState;
+ final ArrowState rightArrowState;
+ final BatteryState batteryState;
+ Hybrid({
+ required this.hybridState,
+ required this.topArrowState,
+ required this.leftArrowState,
+ required this.rightArrowState,
+ required this.batteryState,
+ });
+
+ const Hybrid.initial()
+ : hybridState = HybridState.idle,
+ topArrowState = ArrowState.blue,
+ leftArrowState = ArrowState.blue,
+ rightArrowState = ArrowState.blue,
+ batteryState = BatteryState.white;
+
+ Hybrid copyWith({
+ HybridState? hybridState,
+ ArrowState? topArrowState,
+ ArrowState? leftArrowState,
+ ArrowState? rightArrowState,
+ BatteryState? batteryState,
+ }) {
+ return Hybrid(
+ hybridState: hybridState ?? this.hybridState,
+ topArrowState: topArrowState ?? this.topArrowState,
+ leftArrowState: leftArrowState ?? this.leftArrowState,
+ rightArrowState: rightArrowState ?? this.rightArrowState,
+ batteryState: batteryState ?? this.batteryState,
+ );
+ }
+
+ // Map<String, dynamic> toMap() {
+ // return {
+ // 'hybridState': hybridState.toMap(),
+ // 'topArrowState': topArrowState.toMap(),
+ // 'leftArrowState': leftArrowState.toMap(),
+ // 'rightArrowState': rightArrowState.toMap(),
+ // 'batteryState': batteryState.toMap(),
+ // };
+ // }
+
+ // factory Hybrid.fromMap(Map<String, dynamic> map) {
+ // return Hybrid(
+ // hybridState: HybridState.fromMap(map['hybridState']),
+ // topArrowState: ArrowState.fromMap(map['topArrowState']),
+ // leftArrowState: ArrowState.fromMap(map['leftArrowState']),
+ // rightArrowState: ArrowState.fromMap(map['rightArrowState']),
+ // batteryState: BatteryState.fromMap(map['batteryState']),
+ // );
+ // }
+
+ // String toJson() => json.encode(toMap());
+
+ // factory Hybrid.fromJson(String source) => Hybrid.fromMap(json.decode(source));
+
+ @override
+ String toString() {
+ return 'Hybrid(hybridState: $hybridState, topArrowState: $topArrowState, leftArrowState: $leftArrowState, rightArrowState: $rightArrowState, batteryState: $batteryState)';
+ }
+
+ @override
+ bool operator ==(Object other) {
+ if (identical(this, other)) return true;
+
+ return other is Hybrid &&
+ other.hybridState == hybridState &&
+ other.topArrowState == topArrowState &&
+ other.leftArrowState == leftArrowState &&
+ other.rightArrowState == rightArrowState &&
+ other.batteryState == batteryState;
+ }
+
+ @override
+ int get hashCode {
+ return hybridState.hashCode ^
+ topArrowState.hashCode ^
+ leftArrowState.hashCode ^
+ rightArrowState.hashCode ^
+ batteryState.hashCode;
+ }
+}
diff --git a/lib/data/models/units.dart b/lib/data/models/units.dart
new file mode 100644
index 0000000..9e71213
--- /dev/null
+++ b/lib/data/models/units.dart
@@ -0,0 +1,45 @@
+import '../../export.dart';
+
+enum DistanceUnit { kilometers, miles }
+
+enum TemperatureUnit { celsius, fahrenheit }
+
+@immutable
+class Units {
+ final DistanceUnit distanceUnit;
+ final TemperatureUnit temperatureUnit;
+
+ const Units(
+ this.distanceUnit,
+ this.temperatureUnit,
+ );
+ const Units.initial()
+ : distanceUnit = DistanceUnit.kilometers,
+ temperatureUnit = TemperatureUnit.celsius;
+
+ Units copyWith({
+ DistanceUnit? distanceUnit,
+ TemperatureUnit? temperatureUnit,
+ }) {
+ return Units(
+ distanceUnit ?? this.distanceUnit,
+ temperatureUnit ?? this.temperatureUnit,
+ );
+ }
+
+ @override
+ String toString() =>
+ 'Units(distanceUnit: $distanceUnit, temperatureUnit: $temperatureUnit)';
+
+ @override
+ bool operator ==(Object other) {
+ if (identical(this, other)) return true;
+
+ return other is Units &&
+ other.distanceUnit == distanceUnit &&
+ other.temperatureUnit == temperatureUnit;
+ }
+
+ @override
+ int get hashCode => distanceUnit.hashCode ^ temperatureUnit.hashCode;
+}
diff --git a/lib/data/models/user.dart b/lib/data/models/user.dart
new file mode 100644
index 0000000..b163c5e
--- /dev/null
+++ b/lib/data/models/user.dart
@@ -0,0 +1,54 @@
+import 'dart:convert';
+
+import 'package:flutter_ics_homescreen/export.dart';
+
+@immutable
+class User {
+ final String id;
+ final String name;
+ const User({
+ required this.id,
+ required this.name,
+ });
+
+ User copyWith({
+ String? id,
+ String? name,
+ }) {
+ return User(
+ id: id ?? this.id,
+ name: name ?? this.name,
+ );
+ }
+
+ Map<String, dynamic> toMap() {
+ return {
+ 'id': id,
+ 'name': name,
+ };
+ }
+
+ factory User.fromMap(Map<String, dynamic> map) {
+ return User(
+ id: map['id'] ?? '',
+ name: map['name'] ?? '',
+ );
+ }
+
+ String toJson() => json.encode(toMap());
+
+ factory User.fromJson(String source) => User.fromMap(json.decode(source));
+
+ @override
+ String toString() => 'User(id: $id, name: $name)';
+
+ @override
+ bool operator ==(Object other) {
+ if (identical(this, other)) return true;
+
+ return other is User && other.id == id && other.name == name;
+ }
+
+ @override
+ int get hashCode => id.hashCode ^ name.hashCode;
+}
diff --git a/lib/data/models/users.dart b/lib/data/models/users.dart
new file mode 100644
index 0000000..9b4d027
--- /dev/null
+++ b/lib/data/models/users.dart
@@ -0,0 +1,64 @@
+import 'dart:convert';
+
+import 'package:flutter_ics_homescreen/data/models/user.dart';
+import 'package:flutter_ics_homescreen/export.dart';
+// ignore: depend_on_referenced_packages
+import 'package:collection/collection.dart';
+
+@immutable
+class Users {
+ final List<User> users;
+ final User selectedUser;
+ const Users({
+ required this.users,
+ required this.selectedUser,
+ });
+ Users.initial()
+ //: users = <User>[],
+ : users = [],
+ selectedUser = const User(id: '', name: '');
+
+ Users copyWith({
+ List<User>? users,
+ User? selectedUser,
+ }) {
+ return Users(
+ users: users ?? this.users,
+ selectedUser: selectedUser ?? this.selectedUser,
+ );
+ }
+
+ Map<String, dynamic> toMap() {
+ return {
+ 'users': users.map((x) => x.toMap()).toList(),
+ 'selectedUser': selectedUser.toMap(),
+ };
+ }
+
+ factory Users.fromMap(Map<String, dynamic> map) {
+ return Users(
+ users: List<User>.from(map['users']?.map((x) => User.fromMap(x))),
+ selectedUser: User.fromMap(map['selectedUser']),
+ );
+ }
+
+ String toJson() => json.encode(toMap());
+
+ factory Users.fromJson(String source) => Users.fromMap(json.decode(source));
+
+ @override
+ String toString() => 'Users(users: $users, selectedUser: $selectedUser)';
+
+ @override
+ bool operator ==(Object other) {
+ if (identical(this, other)) return true;
+ final listEquals = const DeepCollectionEquality().equals;
+
+ return other is Users &&
+ listEquals(other.users, users) &&
+ other.selectedUser == selectedUser;
+ }
+
+ @override
+ int get hashCode => users.hashCode ^ selectedUser.hashCode;
+}
diff --git a/lib/data/models/vehicle.dart b/lib/data/models/vehicle.dart
new file mode 100644
index 0000000..f27b750
--- /dev/null
+++ b/lib/data/models/vehicle.dart
@@ -0,0 +1,233 @@
+import 'dart:convert';
+
+import '../../export.dart';
+
+@immutable
+class Vehicle {
+ final double speed;
+ final double insideTemperature;
+ final double outsideTemperature;
+ final int range;
+ final double fuelLevel;
+ final int mediaVolume;
+ final bool isChildLockActiveLeft;
+ final bool isChildLockActiveRight;
+ final int engineSpeed;
+ final int frontLeftTire;
+ final int frontRightTire;
+ final int rearLeftTire;
+ final int rearRightTire;
+ final bool isAirConditioningActive;
+ final bool isFrontDefrosterActive;
+ final bool isRearDefrosterActive;
+ final bool isRecirculationActive;
+ final int fanSpeed;
+
+ const Vehicle(
+ this.speed,
+ this.insideTemperature,
+ this.outsideTemperature,
+ this.range,
+ this.fuelLevel,
+ this.mediaVolume,
+ this.isChildLockActiveLeft,
+ this.isChildLockActiveRight,
+ this.engineSpeed,
+ this.frontLeftTire,
+ this.frontRightTire,
+ this.rearLeftTire,
+ this.rearRightTire,
+ this.isAirConditioningActive,
+ this.isFrontDefrosterActive,
+ this.isRearDefrosterActive,
+ this.isRecirculationActive,
+ this.fanSpeed);
+
+ const Vehicle.initial()
+ : speed = 0,
+ insideTemperature = 0,
+ outsideTemperature = 0,
+ range = 0,
+ fuelLevel = 0,
+ mediaVolume = 50,
+ isChildLockActiveLeft = false,
+ isChildLockActiveRight = true,
+ engineSpeed = 0,
+ frontLeftTire = 33,
+ frontRightTire = 31,
+ rearLeftTire = 31,
+ rearRightTire = 32,
+ isAirConditioningActive = false,
+ isFrontDefrosterActive = false,
+ isRearDefrosterActive = false,
+ isRecirculationActive = false,
+ fanSpeed = 0;
+
+ const Vehicle.initialForDebug()
+ : speed = 60,
+ insideTemperature = 25,
+ outsideTemperature = 32.0,
+ range = 21,
+ fuelLevel = 49.5,
+ mediaVolume = 50,
+ isChildLockActiveLeft = false,
+ isChildLockActiveRight = true,
+ engineSpeed = 6500,
+ frontLeftTire = 33,
+ frontRightTire = 31,
+ rearLeftTire = 31,
+ rearRightTire = 32,
+ isAirConditioningActive = false,
+ isFrontDefrosterActive = false,
+ isRearDefrosterActive = false,
+ isRecirculationActive = false,
+ fanSpeed = 0;
+
+ Vehicle copyWith(
+ {double? speed,
+ double? insideTemperature,
+ double? outsideTemperature,
+ int? range,
+ double? fuelLevel,
+ int? mediaVolume,
+ bool? isChildLockActiveLeft,
+ bool? isChildLockActiveRight,
+ int? engineSpeed,
+ int? frontLeftTire,
+ int? frontRightTire,
+ int? rearLeftTire,
+ int? rearRightTire,
+ bool? isAirConditioningActive,
+ bool? isFrontDefrosterActive,
+ bool? isRearDefrosterActive,
+ bool? isRecirculationActive,
+ int? fanSpeed}) {
+ return Vehicle(
+ speed ?? this.speed,
+ insideTemperature ?? this.insideTemperature,
+ outsideTemperature ?? this.outsideTemperature,
+ range ?? this.range,
+ fuelLevel ?? this.fuelLevel,
+ mediaVolume ?? this.mediaVolume,
+ isChildLockActiveLeft ?? this.isChildLockActiveLeft,
+ isChildLockActiveRight ?? this.isChildLockActiveRight,
+ engineSpeed ?? this.engineSpeed,
+ frontLeftTire ?? this.frontLeftTire,
+ frontRightTire ?? this.frontRightTire,
+ rearLeftTire ?? this.rearLeftTire,
+ rearRightTire ?? this.rearRightTire,
+ isAirConditioningActive ?? this.isAirConditioningActive,
+ isFrontDefrosterActive ?? this.isFrontDefrosterActive,
+ isRearDefrosterActive ?? this.isRearDefrosterActive,
+ isRecirculationActive ?? this.isRecirculationActive,
+ fanSpeed ?? this.fanSpeed);
+ }
+
+ Map<String, dynamic> toMap() {
+ return {
+ 'speed': speed,
+ 'insideTemperature': insideTemperature,
+ 'outsideTemperature': outsideTemperature,
+ 'range': range,
+ 'fuelLevel': fuelLevel,
+ 'mediaVolume': mediaVolume,
+ 'isChildLockActiveLeft': isChildLockActiveLeft,
+ 'isChildLockActiveRight': isChildLockActiveRight,
+ 'engineSpeed': engineSpeed,
+ 'frontLeftTire': frontLeftTire,
+ 'frontRightTire': frontRightTire,
+ 'rearLeftTire': rearLeftTire,
+ 'rearRightTire': rearRightTire,
+ 'isAirConditioningActive': isAirConditioningActive,
+ 'isFrontDefrosterActive': isFrontDefrosterActive,
+ 'isRearDefrosterActive': isRearDefrosterActive,
+ 'isRecirculationActive': isRecirculationActive,
+ 'fanSpeed': fanSpeed
+ };
+ }
+
+ factory Vehicle.fromMap(Map<String, dynamic> map) {
+ return Vehicle(
+ map['speed']?.toDouble() ?? 0.0,
+ map['insideTemperature']?.toDouble() ?? 0.0,
+ map['outsideTemperature']?.toDouble() ?? 0.0,
+ map['range']?.toInt() ?? 0,
+ map['fuelLevel']?.toDouble() ?? 0.0,
+ map['mediaVolume']?.toInt() ?? 0,
+ map['isChildLockActiveLeft'] ?? false,
+ map['isChildLockActiveRight'] ?? false,
+ map['engineSpeed']?.toInt() ?? 0,
+ map['frontLeftTire']?.toInt() ?? 0,
+ map['frontRightTire']?.toInt() ?? 0,
+ map['rearLeftTire']?.toInt() ?? 0,
+ map['rearRightTire']?.toInt() ?? 0,
+ map['isAirConditioningActive'] ?? false,
+ map['isFrontDefrosterActive'] ?? false,
+ map['isRearDefrosterActive'] ?? false,
+ map['isRecirculationActive'] ?? false,
+ map['fanSpeed'] ?? 0,
+ );
+ }
+
+ String toJson() => json.encode(toMap());
+
+ factory Vehicle.fromJson(String source) =>
+ Vehicle.fromMap(json.decode(source));
+
+ @override
+ String toString() {
+ return 'Vehicle(speed: $speed, insideTemperature: $insideTemperature, outsideTemperature: $outsideTemperature, range: $range, fuelLevel: $fuelLevel, mediaVolume: $mediaVolume, isChildLockActiveLeft: $isChildLockActiveLeft, isChildLockActiveRight: $isChildLockActiveRight, engineSpeed: $engineSpeed, frontLeftTire: $frontLeftTire, frontRightTire: $frontRightTire, rearLeftTire: $rearLeftTire, rearRightTire: $rearRightTire, isAirConditioningActive: $isAirConditioningActive, isFrontDefrosterActive: $isFrontDefrosterActive, isRearDefrosterActive: $isRearDefrosterActive, isRecirculationActive: $isRecirculationActive,fanSpeed:$fanSpeed)';
+ }
+
+ @override
+ bool operator ==(Object other) {
+ if (identical(this, other)) return true;
+
+ return other is Vehicle &&
+ other.speed == speed &&
+ other.insideTemperature == insideTemperature &&
+ other.outsideTemperature == outsideTemperature &&
+ other.range == range &&
+ other.fuelLevel == fuelLevel &&
+ other.mediaVolume == mediaVolume &&
+ other.isChildLockActiveLeft == isChildLockActiveLeft &&
+ other.isChildLockActiveRight == isChildLockActiveRight &&
+ other.engineSpeed == engineSpeed &&
+ other.frontLeftTire == frontLeftTire &&
+ other.frontRightTire == frontRightTire &&
+ other.rearLeftTire == rearLeftTire &&
+ other.rearRightTire == rearRightTire &&
+ other.isAirConditioningActive == isAirConditioningActive &&
+ other.isFrontDefrosterActive == isFrontDefrosterActive &&
+ other.isRearDefrosterActive == isRearDefrosterActive &&
+ other.isRecirculationActive == isRecirculationActive &&
+ other.fanSpeed == fanSpeed;
+ }
+
+ @override
+ int get hashCode {
+ return speed.hashCode ^
+ insideTemperature.hashCode ^
+ outsideTemperature.hashCode ^
+ range.hashCode ^
+ fuelLevel.hashCode ^
+ mediaVolume.hashCode ^
+ isChildLockActiveLeft.hashCode ^
+ isChildLockActiveRight.hashCode ^
+ engineSpeed.hashCode ^
+ frontLeftTire.hashCode ^
+ frontRightTire.hashCode ^
+ rearLeftTire.hashCode ^
+ rearRightTire.hashCode ^
+ isAirConditioningActive.hashCode ^
+ isFrontDefrosterActive.hashCode ^
+ isRearDefrosterActive.hashCode ^
+ isRecirculationActive.hashCode ^
+ fanSpeed.hashCode;
+ }
+// }
+// / class VehicleNotifier extends StateNotifier<Vehicle> {
+// // VehicleNotifier() : super(Vehicle());
+
+// // }
+}
diff --git a/lib/data/theme/theme.dart b/lib/data/theme/theme.dart
new file mode 100644
index 0000000..a04d03d
--- /dev/null
+++ b/lib/data/theme/theme.dart
@@ -0,0 +1,43 @@
+import 'package:flutter_ics_homescreen/export.dart';
+
+// ignore_for_file: overridden_fields
+
+ThemeData theme = ThemeData(
+ scaffoldBackgroundColor: const Color(0xFF0D113F),
+ useMaterial3: false,
+ fontFamily: GoogleFonts.firaSans().fontFamily,
+ // Define the default brightness and colors.
+ colorScheme: ColorScheme.fromSeed(
+ seedColor: Colors.blue,
+ // ···
+ brightness: Brightness.dark,
+ ),
+
+ // Define the default `TextTheme`. Use this to specify the default
+ // text styling for headlines, titles, bodies of text, and more.
+ textTheme: TextTheme(
+
+ displayLarge: const TextStyle(
+ fontSize: 72,
+ fontWeight: FontWeight.bold,
+
+ ),
+ // ···
+ titleLarge: GoogleFonts.oswald(
+ fontSize: 30,
+ fontStyle: FontStyle.italic,
+ color: Colors.red
+ ),
+
+ titleMedium: GoogleFonts.firaSans(
+ color: AGLDemoColors.periwinkleColor, fontSize: 40),
+ bodyMedium: GoogleFonts.firaSans(color: AGLDemoColors.periwinkleColor),
+
+
+ ),
+ appBarTheme: const AppBarTheme(
+ backgroundColor: Colors.blue,
+ foregroundColor: Colors.white, //here you can give the text color
+ titleTextStyle: TextStyle()
+ ),
+);