aboutsummaryrefslogtreecommitdiffstats
path: root/lib/homescreen_model.dart
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2022-12-28 15:05:26 -0500
committerScott Murray <scott.murray@konsulko.com>2022-12-29 06:35:38 +0000
commit4fbd3fdb9e01c197d972b78961f0d033534a5cc7 (patch)
treedef7bfc0d0f11746006439b33019b61dfc16e1b8 /lib/homescreen_model.dart
parente21709c9601209e26d09dea0a45e37f0636bb605 (diff)
Add volume control to bottom panel
Changes: - Import a reworked version of the KUKSA.val client code from the Flutter dashboard app, with the aggregated signal Riverpod provider replaced with per-signal providers for the signal the homescreen needs and a couple of temperature ones it might use. Using separate providers is more in-line with recommended Riverpod best practices. - Various tweaks to enable using Riverpod. - Split the bottom panel out into its own widget, and add a stack in it to layer the default logo panel with the volume control slider, which has been added as a new widget definition to provide the hook to drive timer based lowering behavior like the Qt homescreen does. - The KUKSA.val connection widget has been added to the bottom panel rather than overriding the top-level widget as in the dashboard and HVAC apps. This seems preferable with respect to still providing some functionality in the event KUKSA.val is unavailable. - Remove the old demo dashboard and HVAC pages that are now unused, along with the image assets they needed, to allow cleaning up pubspec.yaml and ease maintenance. Bug-AGL: SPEC-4659 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: I5d9180a3461948a58321564e71134c4961ce0ef7
Diffstat (limited to 'lib/homescreen_model.dart')
-rw-r--r--lib/homescreen_model.dart68
1 files changed, 0 insertions, 68 deletions
diff --git a/lib/homescreen_model.dart b/lib/homescreen_model.dart
deleted file mode 100644
index 7c1a26f..0000000
--- a/lib/homescreen_model.dart
+++ /dev/null
@@ -1,68 +0,0 @@
-import 'dart:collection';
-
-import 'package:flutter/foundation.dart';
-import 'package:flutter/material.dart';
-
-enum SwitchId {
- hvacLeftSeat,
- hvacRigthSeat,
- hvacAc,
- hvacAuto,
- hvacCirculation,
- hvacFan,
- hvacAirDown,
- hvacAirUp,
- hvacFront,
- hvacRear,
-}
-
-enum TemperatureId { leftSeat, rightSeat }
-
-class HomescreenModel extends ChangeNotifier {
- // HVAC page
-
- // fan speed
- double _fanSpeed = 20;
-
- double get fanSpeed => _fanSpeed;
-
- set fanSpeed(double newhvacFanSpeed) {
- _fanSpeed = newhvacFanSpeed;
- notifyListeners();
- }
-
- // switch buttons
- HashMap _switches = new HashMap<SwitchId, bool>();
-
- bool getSwitchState(SwitchId id) => _switches[id] ?? false;
-
- void setSwitchState(SwitchId id, bool newValue) {
- _switches[id] = newValue;
- notifyListeners();
- }
-
- void flipSwitch(SwitchId id) {
- _switches[id] = !_switches[id];
- notifyListeners();
- }
-
- // temperatures
- HashMap _temperatures = new HashMap<TemperatureId, int>();
-
- int getTemperature(TemperatureId id) => _temperatures[id] ?? 22;
-
- void setTemperature(TemperatureId id, int newTemp) {
- _temperatures[id] = newTemp;
- notifyListeners();
- }
-
- HomescreenModel() {
- // initialize the values
- for (var id in SwitchId.values) {
- _switches[id] = false;
- }
- for (var id in TemperatureId.values) {
- _temperatures[id] = 22;
- }
- }
-}