Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Commit

Permalink
few tweaks in UI
Browse files Browse the repository at this point in the history
  • Loading branch information
cconstab committed Feb 16, 2022
1 parent 7600640 commit 19a89d4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion dart/iot_sender/lib/iot_mqtt_listener.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'package:at_commons/at_commons.dart';
final client = MqttServerClient('localhost', '');
final AtSignLogger logger = AtSignLogger('iotListen');

bool fakingO2SatValues = true;
bool fakingO2SatValues = false;
Random random = Random();
int fakeO2IntMinValue = 950;
int fakeO2IntMaxValue = 995;
Expand Down
24 changes: 14 additions & 10 deletions flutter/iot_reciever/lib/screens/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:at_utils/at_logger.dart';

import 'package:at_client_mobile/at_client_mobile.dart';
import 'package:at_commons/at_commons.dart';
import 'package:auto_size_text/auto_size_text.dart';

import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
Expand All @@ -26,7 +27,7 @@ class HomeScreen extends StatefulWidget {
}

class _HomeScreenState extends State<HomeScreen> {
IoT readings = IoT(sensorName: '@ZARIOT', heartRate: '0', bloodOxygen: '90');
IoT readings = IoT(sensorName: 'ZARIOT / The @ Company', heartRate: '0', bloodOxygen: '90');

@override
void initState() {
Expand All @@ -36,8 +37,11 @@ class _HomeScreenState extends State<HomeScreen> {
atClientManager.syncService.sync(onDone: () {
_logger.info('sync complete');
});
notificationService.subscribe(regex: AtEnv.appNamespace).listen((notification) {
_logger.info('notification subscription handler got notification with key ${notification.key}');
notificationService
.subscribe(regex: AtEnv.appNamespace)
.listen((notification) {
_logger.info(
'notification subscription handler got notification with key ${notification.key}');
getAtsignData(context, notification.key);
});
setState(() {});
Expand All @@ -46,13 +50,12 @@ class _HomeScreenState extends State<HomeScreen> {
@override
Widget build(BuildContext context) {
// * Getting the AtClientManager instance to use below
AtClientManager atClientManager = AtClientManager.getInstance();
//AtClientManager atClientManager = AtClientManager.getInstance();
double _width = MediaQuery.of(context).size.width;
double _height = MediaQuery.of(context).size.height ;
double _height = MediaQuery.of(context).size.height;
// var mediaQuery = MediaQuery.of(context);
// var _width = mediaQuery.size.width * mediaQuery.devicePixelRatio;
// var _height = mediaQuery.size.height * mediaQuery.devicePixelRatio;
_logger.info('width: $_width');

int _gridRows = 1;
if (_width > _height) {
Expand All @@ -62,7 +65,7 @@ class _HomeScreenState extends State<HomeScreen> {
}
return Scaffold(
appBar: NewGradientAppBar(
title: Text(widget.ioT.sensorName),
title: AutoSizeText(readings.sensorName),
gradient: const LinearGradient(colors: [
Color.fromARGB(255, 173, 83, 78),
Color.fromARGB(255, 108, 169, 197)
Expand Down Expand Up @@ -191,10 +194,11 @@ class _HomeScreenState extends State<HomeScreen> {
readings.bloodOxygen = value;
}
var createdAt = reading.metadata?.createdAt;
var dateFormat = DateFormat("H:m.s");
var dateFormat = DateFormat("HH:mm.ss");
String dateFormated = dateFormat.format(createdAt!);
widget.ioT.sensorName = 'Updated: $dateFormated';
readings.sensorName = '$dateFormated UTC | $sharedByAtsign';
setState(() {});
_logger.info('Yay $currentAtsign was just sent a $keyAtsign reading of $value ! From $sharedByAtsign');
_logger.info(
'Yay $currentAtsign was just sent a $keyAtsign reading of $value ! From $sharedByAtsign');
}
}
2 changes: 1 addition & 1 deletion flutter/iot_reciever/lib/widgets/Gaugewidget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class _GaugeWidgetState extends State<GaugeWidget> {
_size = _width;
} _font = _size / 9;

var step = (this.widget.topRange - this.widget.bottomRange) / 1000;
var step = (this.widget.topRange - this.widget.bottomRange) / 250;
return TimerBuilder.periodic(const Duration(milliseconds: 5),
builder: (context) {
read = getValue(widget.value);
Expand Down

0 comments on commit 19a89d4

Please sign in to comment.