add: debian file, perform various fixes

This commit is contained in:
Charles
2024-01-15 22:44:05 -08:00
parent ccafa34f33
commit 195cd67c90
17 changed files with 432 additions and 204 deletions
+27 -18
View File
@@ -1,3 +1,5 @@
import 'dart:collection';
import 'package:flutter/material.dart';
//import 'package:grpc/grpc_web.dart';
import 'package:grpc/grpc.dart';
@@ -36,9 +38,9 @@ class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
title: 'Home Sensors',
theme: ThemeData.dark(
// colorScheme: ColorScheme.fromSeed(seedColor: Colors.black87),
useMaterial3: true,
),
home: MyHomePage(
@@ -75,8 +77,8 @@ class MyHomePage extends StatefulWidget {
class _MyHomePageState extends State<MyHomePage> {
String topMessage = "Creating session...";
List<Call> camerasToRender = [];
List<Widget> samples = [];
List<Widget> camerasToRender = [];
Map<String, Widget> cameraSamples = {};
@override
void initState() {
@@ -100,8 +102,11 @@ class _MyHomePageState extends State<MyHomePage> {
.listSamples(ListSamplesRequest(), options: callOptions);
for (var sample in resp.samples) {
samples
.add(Text("${sample.type}: ${sample.reading} on ${sample.cameraId}"));
if (sample.type == Sample_Type.TEMPERATURE_C) {
var reading = (sample.reading * 9.0 / 5.0) + 32;
cameraSamples[sample.cameraId.id] =
Text("${reading.toStringAsFixed(2)} f");
}
}
setState(() {});
}
@@ -113,12 +118,22 @@ class _MyHomePageState extends State<MyHomePage> {
var cameras = await widget.client
.listCameras(ListCamerasRequest(), options: callOptions);
cameras.cameras.sort((a, b) => a.identifier.id.compareTo(b.identifier.id));
camerasToRender = [];
for (var camera in cameras.cameras) {
camerasToRender.add(Call(
widget.client,
widget.sessionService,
cameraID: camera.identifier,
home: widget.home,
List<Widget> children = [
Call(
widget.client,
widget.sessionService,
cameraID: camera.identifier,
home: widget.home,
),
];
if (cameraSamples.containsKey(camera.identifier.id)) {
children.add(cameraSamples[camera.identifier.id]!);
}
camerasToRender.add(Column(
children: children,
));
}
setState(() {});
@@ -134,12 +149,7 @@ class _MyHomePageState extends State<MyHomePage> {
// than having to individually change instances of widgets.
return Scaffold(
appBar: AppBar(
// TRY THIS: Try changing the color here to a specific color (to
// Colors.amber, perhaps?) and trigger a hot reload to see the AppBar
// change color while the other colors stay the same.
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text(widget.title),
),
body: SingleChildScrollView(
@@ -150,7 +160,6 @@ class _MyHomePageState extends State<MyHomePage> {
children: <Widget>[
Text(topMessage),
] +
samples +
camerasToRender,
),
));