summaryrefslogtreecommitdiffstats
path: root/lib/page_apps.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/page_apps.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/page_apps.dart')
-rw-r--r--lib/page_apps.dart43
1 files changed, 19 insertions, 24 deletions
diff --git a/lib/page_apps.dart b/lib/page_apps.dart
index 39fb754..9ea6c92 100644
--- a/lib/page_apps.dart
+++ b/lib/page_apps.dart
@@ -1,9 +1,7 @@
import 'dart:io';
import 'dart:convert';
import 'package:flutter/material.dart';
-import 'package:provider/provider.dart';
import 'package:jovial_svg/jovial_svg.dart';
-import 'package:flutter_homescreen/homescreen.dart';
import 'package:flutter_homescreen/layout_size_helper.dart';
import 'package:flutter_homescreen/generated/applauncher.pb.dart';
@@ -11,7 +9,7 @@ import 'package:flutter_homescreen/generated/applauncher.pb.dart';
class AppsPage extends StatefulWidget {
final Future<List<AppInfo>> Function() getApps;
final Function(String id) startApp;
-
+
const AppsPage({Key? key, required this.getApps, required this.startApp})
: super(key: key);
@@ -26,7 +24,7 @@ class _AppsPageState extends State<AppsPage> {
initState() {
widget.getApps().then((val) => setState(() {
apps = val;
- }));
+ }));
super.initState();
}
@@ -94,8 +92,8 @@ class _AppsPageEntryState extends State<_AppsPageEntry> {
void initState() {
if (widget.iconPath.endsWith(".svg")) {
readSvgIcon().then((val) => setState(() {
- svgIconLoaded = val;
- }));
+ svgIconLoaded = val;
+ }));
}
super.initState();
}
@@ -104,7 +102,8 @@ class _AppsPageEntryState extends State<_AppsPageEntry> {
if (widget.iconPath.endsWith(".svg")) {
var iconFile = File(widget.iconPath);
if (await iconFile.exists()) {
- svgIcon = await ScalableImage.fromSvgStream(iconFile.openRead().transform(utf8.decoder));
+ svgIcon = await ScalableImage.fromSvgStream(
+ iconFile.openRead().transform(utf8.decoder));
return true;
}
}
@@ -114,25 +113,21 @@ class _AppsPageEntryState extends State<_AppsPageEntry> {
Widget buildIcon() {
if (svgIconLoaded) {
return GestureDetector(
- onTap: () {
- widget.appSelected(widget.id);
- },
- child: SizedBox.expand(
- child: ScalableImageWidget(si: svgIcon))
- );
+ onTap: () {
+ widget.appSelected(widget.id);
+ },
+ child: SizedBox.expand(child: ScalableImageWidget(si: svgIcon)));
} else {
return OutlinedButton(
- style: ElevatedButton.styleFrom(
- shape: CircleBorder(),
- padding: EdgeInsets.all(8),
- side: BorderSide(width: 4, color: iconColor),
- ),
- onPressed: () {
- widget.appSelected(widget.id);
- },
- child: Icon(Icons.question_mark,
- color: iconColor,
- size: 160.0));
+ style: ElevatedButton.styleFrom(
+ shape: CircleBorder(),
+ padding: EdgeInsets.all(8),
+ side: BorderSide(width: 4, color: iconColor),
+ ),
+ onPressed: () {
+ widget.appSelected(widget.id);
+ },
+ child: Icon(Icons.question_mark, color: iconColor, size: 160.0));
}
}