diff options
Diffstat (limited to 'lib/data/models')
-rw-r--r-- | lib/data/models/audio.dart | 35 | ||||
-rw-r--r-- | lib/data/models/hybrid.dart | 2 | ||||
-rw-r--r-- | lib/data/models/vehicle.dart | 139 |
3 files changed, 85 insertions, 91 deletions
diff --git a/lib/data/models/audio.dart b/lib/data/models/audio.dart index 69df18b..65490f9 100644 --- a/lib/data/models/audio.dart +++ b/lib/data/models/audio.dart @@ -5,52 +5,59 @@ import 'package:flutter_ics_homescreen/export.dart'; @immutable class Audio { final double volume; + final double balance; + final double fade; final double treble; final double bass; - final double rearFront; const Audio({ required this.volume, + required this.balance, + required this.fade, required this.treble, required this.bass, - required this.rearFront, }); const Audio.initial() : volume = 5.0, + balance = 5.0, + fade = 5.0, treble = 5.0, - bass = 5.0, - rearFront = 5.0; + bass = 5.0; Audio copyWith({ double? volume, + double? balance, + double? fade, double? treble, double? bass, - double? rearFront, }) { return Audio( volume: volume ?? this.volume, + balance: balance ?? this.balance, + fade: fade ?? this.fade, treble: treble ?? this.treble, bass: bass ?? this.bass, - rearFront: rearFront ?? this.rearFront, ); } Map<String, dynamic> toMap() { return { 'volume': volume, + 'balance': balance, + 'fade': fade, 'treble': treble, 'bass': bass, - 'rearFront': rearFront, }; } factory Audio.fromMap(Map<String, dynamic> map) { return Audio( volume: map['volume']?.toDouble() ?? 0.0, + balance: map['balance']?.toDouble() ?? 0.0, + fade: map['fade']?.toDouble() ?? 0.0, treble: map['treble']?.toDouble() ?? 0.0, bass: map['bass']?.toDouble() ?? 0.0, - rearFront: map['rearFront']?.toDouble() ?? 0.0, ); } @@ -60,7 +67,7 @@ class Audio { @override String toString() { - return 'Audio(volume: $volume, treble: $treble, bass: $bass, rearFront: $rearFront)'; + return 'Audio(volume: $volume, balance: $balance, fade: $fade, treble: $treble, bass: $bass)'; } @override @@ -69,16 +76,18 @@ class Audio { return other is Audio && other.volume == volume && + other.balance == balance && + other.fade == fade && other.treble == treble && - other.bass == bass && - other.rearFront == rearFront; + other.bass == bass; } @override int get hashCode { return volume.hashCode ^ + balance.hashCode ^ + fade.hashCode ^ treble.hashCode ^ - bass.hashCode ^ - rearFront.hashCode; + bass.hashCode; } } diff --git a/lib/data/models/hybrid.dart b/lib/data/models/hybrid.dart index d567f14..5746033 100644 --- a/lib/data/models/hybrid.dart +++ b/lib/data/models/hybrid.dart @@ -2,7 +2,7 @@ enum HybridState { idle, engineOutput, regenerativeBreaking, - baterryOutput, + batteryOutput, } enum ArrowState { blue, red, green, yellow } diff --git a/lib/data/models/vehicle.dart b/lib/data/models/vehicle.dart index 2dea928..ad76620 100644 --- a/lib/data/models/vehicle.dart +++ b/lib/data/models/vehicle.dart @@ -10,7 +10,6 @@ class Vehicle { final double outsideTemperature; final int range; final int fuelLevel; - final int mediaVolume; final bool isChildLockActiveLeft; final bool isChildLockActiveRight; final int frontLeftTire; @@ -27,27 +26,26 @@ class Vehicle { final bool temperatureSynced; const Vehicle( - this.speed, - this.engineSpeed, - this.insideTemperature, - this.outsideTemperature, - this.range, - this.fuelLevel, - this.mediaVolume, - this.isChildLockActiveLeft, - this.isChildLockActiveRight, - this.frontLeftTire, - this.frontRightTire, - this.rearLeftTire, - this.rearRightTire, - this.isAirConditioningActive, - this.isFrontDefrosterActive, - this.isRearDefrosterActive, - this.isRecirculationActive, - this.fanSpeed, - this.driverTemperature, - this.passengerTemperature, - this.temperatureSynced, + this.speed, + this.engineSpeed, + this.insideTemperature, + this.outsideTemperature, + this.range, + this.fuelLevel, + this.isChildLockActiveLeft, + this.isChildLockActiveRight, + this.frontLeftTire, + this.frontRightTire, + this.rearLeftTire, + this.rearRightTire, + this.isAirConditioningActive, + this.isFrontDefrosterActive, + this.isRearDefrosterActive, + this.isRecirculationActive, + this.fanSpeed, + this.driverTemperature, + this.passengerTemperature, + this.temperatureSynced, ); const Vehicle.initial() @@ -57,7 +55,6 @@ class Vehicle { outsideTemperature = 0, range = 0, fuelLevel = 0, - mediaVolume = 50, isChildLockActiveLeft = false, isChildLockActiveRight = true, frontLeftTire = 33, @@ -80,7 +77,6 @@ class Vehicle { outsideTemperature = 32.0, range = 21, fuelLevel = 49, - mediaVolume = 50, isChildLockActiveLeft = false, isChildLockActiveRight = true, frontLeftTire = 33, @@ -96,51 +92,49 @@ class Vehicle { passengerTemperature = 26, temperatureSynced = true; - Vehicle copyWith( - {double? speed, - double? engineSpeed, - double? insideTemperature, - double? outsideTemperature, - int? range, - int? fuelLevel, - int? mediaVolume, - bool? isChildLockActiveLeft, - bool? isChildLockActiveRight, - int? frontLeftTire, - int? frontRightTire, - int? rearLeftTire, - int? rearRightTire, - bool? isAirConditioningActive, - bool? isFrontDefrosterActive, - bool? isRearDefrosterActive, - bool? isRecirculationActive, - int? fanSpeed, - int? driverTemperature, - int? passengerTemperature, - bool? temperatureSynced, + Vehicle copyWith({ + double? speed, + double? engineSpeed, + double? insideTemperature, + double? outsideTemperature, + int? range, + int? fuelLevel, + bool? isChildLockActiveLeft, + bool? isChildLockActiveRight, + int? frontLeftTire, + int? frontRightTire, + int? rearLeftTire, + int? rearRightTire, + bool? isAirConditioningActive, + bool? isFrontDefrosterActive, + bool? isRearDefrosterActive, + bool? isRecirculationActive, + int? fanSpeed, + int? driverTemperature, + int? passengerTemperature, + bool? temperatureSynced, }) { return Vehicle( - speed ?? this.speed, - engineSpeed ?? this.engineSpeed, - insideTemperature ?? this.insideTemperature, - outsideTemperature ?? this.outsideTemperature, - range ?? this.range, - fuelLevel ?? this.fuelLevel, - mediaVolume ?? this.mediaVolume, - isChildLockActiveLeft ?? this.isChildLockActiveLeft, - isChildLockActiveRight ?? this.isChildLockActiveRight, - 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, - driverTemperature ?? this.driverTemperature, - passengerTemperature ?? this.passengerTemperature, - temperatureSynced ?? this.temperatureSynced, + speed ?? this.speed, + engineSpeed ?? this.engineSpeed, + insideTemperature ?? this.insideTemperature, + outsideTemperature ?? this.outsideTemperature, + range ?? this.range, + fuelLevel ?? this.fuelLevel, + isChildLockActiveLeft ?? this.isChildLockActiveLeft, + isChildLockActiveRight ?? this.isChildLockActiveRight, + 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, + driverTemperature ?? this.driverTemperature, + passengerTemperature ?? this.passengerTemperature, + temperatureSynced ?? this.temperatureSynced, ); } @@ -152,7 +146,6 @@ class Vehicle { 'outsideTemperature': outsideTemperature, 'range': range, 'fuelLevel': fuelLevel, - 'mediaVolume': mediaVolume, 'isChildLockActiveLeft': isChildLockActiveLeft, 'isChildLockActiveRight': isChildLockActiveRight, 'frontLeftTire': frontLeftTire, @@ -178,7 +171,6 @@ class Vehicle { 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['frontLeftTire']?.toInt() ?? 0, @@ -203,7 +195,7 @@ class Vehicle { @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,driverTemperature:$driverTemperature, passengerTemperature:$passengerTemperature)'; + return 'Vehicle(speed: $speed, insideTemperature: $insideTemperature, outsideTemperature: $outsideTemperature, range: $range, fuelLevel: $fuelLevel, isChildLockActiveLeft: $isChildLockActiveLeft, isChildLockActiveRight: $isChildLockActiveRight, engineSpeed: $engineSpeed, frontLeftTire: $frontLeftTire, frontRightTire: $frontRightTire, rearLeftTire: $rearLeftTire, rearRightTire: $rearRightTire, isAirConditioningActive: $isAirConditioningActive, isFrontDefrosterActive: $isFrontDefrosterActive, isRearDefrosterActive: $isRearDefrosterActive, isRecirculationActive: $isRecirculationActive,fanSpeed:$fanSpeed,driverTemperature:$driverTemperature, passengerTemperature:$passengerTemperature)'; } @override @@ -216,7 +208,6 @@ class Vehicle { other.outsideTemperature == outsideTemperature && other.range == range && other.fuelLevel == fuelLevel && - other.mediaVolume == mediaVolume && other.isChildLockActiveLeft == isChildLockActiveLeft && other.isChildLockActiveRight == isChildLockActiveRight && other.engineSpeed == engineSpeed && @@ -241,7 +232,6 @@ class Vehicle { outsideTemperature.hashCode ^ range.hashCode ^ fuelLevel.hashCode ^ - mediaVolume.hashCode ^ isChildLockActiveLeft.hashCode ^ isChildLockActiveRight.hashCode ^ engineSpeed.hashCode ^ @@ -258,9 +248,4 @@ class Vehicle { passengerTemperature.hashCode ^ temperatureSynced.hashCode; } -// } -// / class VehicleNotifier extends StateNotifier<Vehicle> { -// // VehicleNotifier() : super(Vehicle()); - -// // } } |