Merged latest 3.16

dev_v3.13.6_BLE_Faiz
Faiz Hashmi 1 year ago
parent c10fb7f1a9
commit 336536df4a

@ -48,14 +48,14 @@ configurations.all {
//configurations.all {
// resolutionStrategy {
// force 'androidx.core:core-ktx:1.6.0'
// force "androidx.core:core:1.13.1"
// }
//}
android {
compileSdkVersion 34
// ndkVersion "24.0.8215888"
buildToolsVersion "31.0.0"
// buildToolsVersion "31.0.0"
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
@ -190,7 +190,7 @@ dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2"
implementation 'com.android.support:appcompat-v7:27.1.1'
testImplementation 'junit:junit:4.12'
implementation project(':blesdk_2301')
// implementation project(':blesdk_2301')
// compile "com.jstyle:1770sdk:1.0.2"
implementation 'io.reactivex.rxjava3:rxjava:3.1.3'
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'

@ -9,13 +9,13 @@
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" tools:node="remove"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" tools:node="remove"/>
<uses-permission android:name="android.permission.BLUETOOTH" tools:node="remove"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" tools:node="remove"/>
<!-- <uses-permission android:name="android.permission.BLUETOOTH" tools:node="remove"/>-->
<!-- <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" tools:node="remove"/>-->
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" tools:node="remove"/>
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" tools:node="remove"/>
<!-- <uses-permission android:name="android.permission.BLUETOOTH_SCAN" tools:node="remove"/>-->
<uses-permission android:name="android.permission.BROADCAST_STICKY" tools:node="remove"/>
<uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" tools:node="remove"/>
<!-- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" tools:node="remove"/>-->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" tools:node="remove"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CONNECTED_DEVICE" tools:node="remove"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_PHONE_CALL" tools:node="remove"/>

@ -196,7 +196,7 @@ class BleManager private constructor(var context: Context) {
init {
if (serviceIntent == null) {
serviceIntent = Intent(context, BleService::class.java)
context.bindService(serviceIntent, serviceConnection, Service.BIND_AUTO_CREATE)
context.bindService(serviceIntent!!, serviceConnection, Service.BIND_AUTO_CREATE)
}
val bluetoothManager = context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager
bluetoothAdapter = bluetoothManager.adapter

@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.8.0'
ext.kotlin_version = '1.8.20'
// if (System.properties['os.arch'] == "aarch64") {
// // For M1 Users we need to use the NDK 24 which added support for aarch64
@ -9,7 +9,7 @@ buildscript {
// ndkVersion = "21.4.7075529"
// }
ext.kotlin_version = '1.8.20'
// ext.kotlin_version = '1.8.20'
repositories {
google()
jcenter()
@ -22,7 +22,7 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:7.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.8'
// classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
classpath 'com.huawei.agconnect:agcp:1.5.2.300'

@ -43,6 +43,7 @@ import 'package:local_auth/local_auth.dart';
import 'package:provider/provider.dart';
import 'package:local_auth_ios/types/auth_messages_ios.dart';
class ConfirmLogin extends StatefulWidget {
final Function? changePageViewIndex;
final fromRegistration;

@ -10,14 +10,14 @@ class AndesFitBloodPressureConnectScreen extends StatefulWidget {
final BluetoothDevice deviceModel;
final bool isEcgAvailable;
const AndesFitBloodPressureConnectScreen({this.deviceModel, this.isEcgAvailable = false});
const AndesFitBloodPressureConnectScreen({required this.deviceModel, this.isEcgAvailable = false});
@override
State<AndesFitBloodPressureConnectScreen> createState() => _AndesFitBloodPressureConnectScreenState();
}
class _AndesFitBloodPressureConnectScreenState extends State<AndesFitBloodPressureConnectScreen> {
MyTrackersViewModel myTrackersVm;
late MyTrackersViewModel myTrackersVm;
@override
void initState() {
@ -48,7 +48,7 @@ class _AndesFitBloodPressureConnectScreenState extends State<AndesFitBloodPressu
mHeight(24.0),
Column(
children: [
Text(myTrackersViewModel.andesfitBpRtMeasuringModel.pressure.toString(), style: TextStyle(fontSize: 100, fontWeight: FontWeight.bold)),
Text(myTrackersViewModel.andesfitBpRtMeasuringModel!.pressure.toString(), style: TextStyle(fontSize: 100, fontWeight: FontWeight.bold)),
Text("Pressure", style: TextStyle(fontSize: 20)),
],
),
@ -66,21 +66,21 @@ class _AndesFitBloodPressureConnectScreenState extends State<AndesFitBloodPressu
Column(
children: [
Text("Sys", style: TextStyle(fontSize: 20)),
Text(myTrackersViewModel.andesfitBpRtResultModel.sys.toString(), style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text(myTrackersViewModel.andesfitBpRtResultModel!.sys.toString(), style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text("mmHg", style: TextStyle(fontSize: 10)),
],
),
Column(
children: [
Text("Dia", style: TextStyle(fontSize: 20)),
Text(myTrackersViewModel.andesfitBpRtResultModel.dia.toString(), style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text(myTrackersViewModel.andesfitBpRtResultModel!.dia.toString(), style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text("mmHg", style: TextStyle(fontSize: 10)),
],
),
Column(
children: [
Text("♥︎", style: TextStyle(fontSize: 20)),
Text(myTrackersViewModel.andesfitBpRtResultModel.pr.toString(), style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text(myTrackersViewModel.andesfitBpRtResultModel!.pr.toString(), style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text("/min", style: TextStyle(fontSize: 10)),
],
),
@ -143,13 +143,13 @@ class _AndesFitBloodPressureConnectScreenState extends State<AndesFitBloodPressu
body: Padding(
padding: const EdgeInsets.all(24.0),
child: Consumer(
builder: (BuildContext context, MyTrackersViewModel myTrackersViewModel, Widget child) {
builder: (BuildContext context, MyTrackersViewModel myTrackersViewModel, Widget? child) {
return Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
buildBloodPressureUI(myTrackersViewModel),
if (myTrackersViewModel.isAndesfitDeviceConnected != null && myTrackersViewModel.isAndesfitDeviceConnected) ...[
if (myTrackersViewModel.isAndesfitDeviceConnected != null && myTrackersViewModel.isAndesfitDeviceConnected!) ...[
Row(
children: [
Expanded(

@ -1,4 +1,3 @@
import 'package:diplomaticquarterapp/extensions/string_extensions.dart';
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:diplomaticquarterapp/pages/medical/my_trackers/my_trackers_view_model/my_trackers_view_model.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
@ -10,14 +9,14 @@ import 'package:provider/provider.dart';
class AndesFitBloodSugarConnectScreen extends StatefulWidget {
final BluetoothDevice deviceModel;
const AndesFitBloodSugarConnectScreen({this.deviceModel});
const AndesFitBloodSugarConnectScreen({required this.deviceModel});
@override
State<AndesFitBloodSugarConnectScreen> createState() => _AndesFitBloodSugarConnectScreenState();
}
class _AndesFitBloodSugarConnectScreenState extends State<AndesFitBloodSugarConnectScreen> {
MyTrackersViewModel myTrackersVm;
late MyTrackersViewModel myTrackersVm;
@override
void initState() {
@ -28,7 +27,7 @@ class _AndesFitBloodSugarConnectScreenState extends State<AndesFitBloodSugarConn
@override
void dispose() {
myTrackersVm.bloodSugarValuesStream.cancel();
myTrackersVm.bloodSugarValuesStream!.cancel();
myTrackersVm.currentBloodGlucose = null;
myTrackersVm.selectedAndesFitScanResult = null;
myTrackersVm.isAndesfitDeviceConnected = null;
@ -40,7 +39,7 @@ class _AndesFitBloodSugarConnectScreenState extends State<AndesFitBloodSugarConn
return Expanded(
child: ListView(
children: [
if (myTrackersViewModel.currentBloodGlucose == null && myTrackersViewModel.isAndesfitDeviceConnected) ...[
if (myTrackersViewModel.currentBloodGlucose == null && myTrackersViewModel.isAndesfitDeviceConnected!) ...[
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
@ -99,13 +98,13 @@ class _AndesFitBloodSugarConnectScreenState extends State<AndesFitBloodSugarConn
body: Padding(
padding: const EdgeInsets.all(24.0),
child: Consumer(
builder: (BuildContext context, MyTrackersViewModel myTrackersViewModel, Widget child) {
builder: (BuildContext context, MyTrackersViewModel myTrackersViewModel, Widget? child) {
return Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
buildBloodSugarUI(myTrackersViewModel),
if (myTrackersViewModel.isAndesfitDeviceConnected != null && myTrackersViewModel.isAndesfitDeviceConnected) ...[
if (myTrackersViewModel.isAndesfitDeviceConnected != null && myTrackersViewModel.isAndesfitDeviceConnected!) ...[
Row(
children: [
Expanded(

@ -1,4 +1,3 @@
import 'package:diplomaticquarterapp/extensions/string_extensions.dart';
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:diplomaticquarterapp/pages/medical/my_trackers/my_trackers_view_model/my_trackers_view_model.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
@ -10,14 +9,14 @@ import 'package:provider/provider.dart';
class AndesFitSpirometerConnectScreen extends StatefulWidget {
final BluetoothDevice deviceModel;
const AndesFitSpirometerConnectScreen({this.deviceModel});
const AndesFitSpirometerConnectScreen({required this.deviceModel});
@override
State<AndesFitSpirometerConnectScreen> createState() => _AndesFitSpirometerConnectScreenState();
}
class _AndesFitSpirometerConnectScreenState extends State<AndesFitSpirometerConnectScreen> {
MyTrackersViewModel myTrackersVm;
late MyTrackersViewModel myTrackersVm;
@override
void initState() {
@ -31,7 +30,7 @@ class _AndesFitSpirometerConnectScreenState extends State<AndesFitSpirometerConn
myTrackersVm.valuePEF = null;
myTrackersVm.valueFEV = null;
myTrackersVm.isAndesfitDeviceConnected = null;
myTrackersVm.timerForSpirometer.cancel();
myTrackersVm.timerForSpirometer!.cancel();
myTrackersVm.disConnectAndesfitDevice(widget.deviceModel);
super.dispose();
}
@ -40,7 +39,7 @@ class _AndesFitSpirometerConnectScreenState extends State<AndesFitSpirometerConn
return Expanded(
child: ListView(
children: [
if ((myTrackersViewModel.valuePEF == null && myTrackersViewModel.valueFEV == null) && myTrackersViewModel.isAndesfitDeviceConnected) ...[
if ((myTrackersViewModel.valuePEF == null && myTrackersViewModel.valueFEV == null) && myTrackersViewModel.isAndesfitDeviceConnected!) ...[
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
@ -106,13 +105,13 @@ class _AndesFitSpirometerConnectScreenState extends State<AndesFitSpirometerConn
body: Padding(
padding: const EdgeInsets.all(24.0),
child: Consumer(
builder: (BuildContext context, MyTrackersViewModel myTrackersViewModel, Widget child) {
builder: (BuildContext context, MyTrackersViewModel myTrackersViewModel, Widget? child) {
return Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
buildSpirometerUI(myTrackersViewModel),
if (myTrackersViewModel.isAndesfitDeviceConnected != null && myTrackersViewModel.isAndesfitDeviceConnected) ...[
if (myTrackersViewModel.isAndesfitDeviceConnected != null && myTrackersViewModel.isAndesfitDeviceConnected!) ...[
Row(
children: [
Expanded(

@ -1,4 +1,3 @@
import 'package:diplomaticquarterapp/extensions/string_extensions.dart';
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:diplomaticquarterapp/pages/medical/my_trackers/my_trackers_view_model/my_trackers_view_model.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
@ -10,14 +9,14 @@ import 'package:provider/provider.dart';
class AndesFitTemperatureConnectScreen extends StatefulWidget {
final BluetoothDevice deviceModel;
const AndesFitTemperatureConnectScreen({this.deviceModel});
const AndesFitTemperatureConnectScreen({required this.deviceModel});
@override
State<AndesFitTemperatureConnectScreen> createState() => _AndesFitTemperatureConnectScreenState();
}
class _AndesFitTemperatureConnectScreenState extends State<AndesFitTemperatureConnectScreen> {
MyTrackersViewModel myTrackersVm;
late MyTrackersViewModel myTrackersVm;
@override
void initState() {
@ -39,7 +38,7 @@ class _AndesFitTemperatureConnectScreenState extends State<AndesFitTemperatureCo
return Expanded(
child: ListView(
children: [
if (myTrackersViewModel.currentTempInCelsius == null && (myTrackersViewModel.isAndesfitDeviceConnected != null && myTrackersViewModel.isAndesfitDeviceConnected)) ...[
if (myTrackersViewModel.currentTempInCelsius == null && (myTrackersViewModel.isAndesfitDeviceConnected != null && myTrackersViewModel.isAndesfitDeviceConnected!)) ...[
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
@ -64,14 +63,14 @@ class _AndesFitTemperatureConnectScreenState extends State<AndesFitTemperatureCo
Column(
children: [
// Text("Temperature", style: TextStyle(fontSize: 20)),
Text((myTrackersViewModel.currentTempInCelsius.split(" / ")[0]).toString(), style: TextStyle(fontSize: 40, fontWeight: FontWeight.bold)),
Text((myTrackersViewModel.currentTempInCelsius!.split(" / ")[0]).toString(), style: TextStyle(fontSize: 40, fontWeight: FontWeight.bold)),
Text("Celsius", style: TextStyle(fontSize: 15)),
],
),
Column(
children: [
// Text("Temperature", style: TextStyle(fontSize: 20)),
Text((myTrackersViewModel.currentTempInCelsius.split(" / ")[1]).toString(), style: TextStyle(fontSize: 40, fontWeight: FontWeight.bold)),
Text((myTrackersViewModel.currentTempInCelsius!.split(" / ")[1]).toString(), style: TextStyle(fontSize: 40, fontWeight: FontWeight.bold)),
Text("Fahrenheit", style: TextStyle(fontSize: 15)),
],
),
@ -106,13 +105,13 @@ class _AndesFitTemperatureConnectScreenState extends State<AndesFitTemperatureCo
body: Padding(
padding: const EdgeInsets.all(24.0),
child: Consumer(
builder: (BuildContext context, MyTrackersViewModel myTrackersViewModel, Widget child) {
builder: (BuildContext context, MyTrackersViewModel myTrackersViewModel, Widget? child) {
return Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
buildTemperatureScaleUI(myTrackersViewModel),
if (myTrackersViewModel.isAndesfitDeviceConnected != null && myTrackersViewModel.isAndesfitDeviceConnected) ...[
if (myTrackersViewModel.isAndesfitDeviceConnected != null && myTrackersViewModel.isAndesfitDeviceConnected!) ...[
Row(
children: [
Expanded(

@ -1,4 +1,3 @@
import 'package:diplomaticquarterapp/extensions/string_extensions.dart';
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:diplomaticquarterapp/pages/medical/my_trackers/my_trackers_view_model/my_trackers_view_model.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
@ -10,14 +9,14 @@ import 'package:provider/provider.dart';
class AndesFitWeightScaleConnectScreen extends StatefulWidget {
final BluetoothDevice deviceModel;
const AndesFitWeightScaleConnectScreen({this.deviceModel});
const AndesFitWeightScaleConnectScreen({required this.deviceModel});
@override
State<AndesFitWeightScaleConnectScreen> createState() => _AndesFitWeightScaleConnectScreenState();
}
class _AndesFitWeightScaleConnectScreenState extends State<AndesFitWeightScaleConnectScreen> {
MyTrackersViewModel myTrackersVm;
late MyTrackersViewModel myTrackersVm;
@override
void initState() {
@ -39,7 +38,7 @@ class _AndesFitWeightScaleConnectScreenState extends State<AndesFitWeightScaleCo
return Expanded(
child: ListView(
children: [
if (myTrackersViewModel.andesfitWeightScaleData == null && myTrackersViewModel.isAndesfitDeviceConnected != null && myTrackersViewModel.isAndesfitDeviceConnected) ...[
if (myTrackersViewModel.andesfitWeightScaleData == null && myTrackersViewModel.isAndesfitDeviceConnected != null && myTrackersViewModel.isAndesfitDeviceConnected!) ...[
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
@ -64,21 +63,21 @@ class _AndesFitWeightScaleConnectScreenState extends State<AndesFitWeightScaleCo
Column(
children: [
Text("Weight", style: TextStyle(fontSize: 20)),
Text(myTrackersViewModel.andesfitWeightScaleData.weight.toString(), style: TextStyle(fontSize: 40, fontWeight: FontWeight.bold)),
Text(myTrackersViewModel.andesfitWeightScaleData!.weight.toString(), style: TextStyle(fontSize: 40, fontWeight: FontWeight.bold)),
Text("KG", style: TextStyle(fontSize: 15)),
],
),
Column(
children: [
Text("BMI", style: TextStyle(fontSize: 20)),
Text(myTrackersViewModel.andesfitWeightScaleData.bmi.toString(), style: TextStyle(fontSize: 40, fontWeight: FontWeight.bold)),
Text(myTrackersViewModel.andesfitWeightScaleData!.bmi.toString(), style: TextStyle(fontSize: 40, fontWeight: FontWeight.bold)),
Text("", style: TextStyle(fontSize: 15)),
],
),
Column(
children: [
Text("Muscle", style: TextStyle(fontSize: 20)),
Text(myTrackersViewModel.andesfitWeightScaleData.muscle.toString(), style: TextStyle(fontSize: 40, fontWeight: FontWeight.bold)),
Text(myTrackersViewModel.andesfitWeightScaleData!.muscle.toString(), style: TextStyle(fontSize: 40, fontWeight: FontWeight.bold)),
Text("%", style: TextStyle(fontSize: 15)),
],
),
@ -91,21 +90,21 @@ class _AndesFitWeightScaleConnectScreenState extends State<AndesFitWeightScaleCo
Column(
children: [
Text("Fat", style: TextStyle(fontSize: 20)),
Text(myTrackersViewModel.andesfitWeightScaleData.fat.toString(), style: TextStyle(fontSize: 40, fontWeight: FontWeight.bold)),
Text(myTrackersViewModel.andesfitWeightScaleData!.fat.toString(), style: TextStyle(fontSize: 40, fontWeight: FontWeight.bold)),
Text("%", style: TextStyle(fontSize: 15)),
],
),
Column(
children: [
Text("BMR", style: TextStyle(fontSize: 20)),
Text(myTrackersViewModel.andesfitWeightScaleData.bmr.toString(), style: TextStyle(fontSize: 40, fontWeight: FontWeight.bold)),
Text(myTrackersViewModel.andesfitWeightScaleData!.bmr.toString(), style: TextStyle(fontSize: 40, fontWeight: FontWeight.bold)),
Text("calories/day", style: TextStyle(fontSize: 15)),
],
),
Column(
children: [
Text("Water", style: TextStyle(fontSize: 20)),
Text(myTrackersViewModel.andesfitWeightScaleData.water.toString(), style: TextStyle(fontSize: 40, fontWeight: FontWeight.bold)),
Text(myTrackersViewModel.andesfitWeightScaleData!.water.toString(), style: TextStyle(fontSize: 40, fontWeight: FontWeight.bold)),
Text("%", style: TextStyle(fontSize: 15)),
],
),
@ -142,13 +141,13 @@ class _AndesFitWeightScaleConnectScreenState extends State<AndesFitWeightScaleCo
body: Padding(
padding: const EdgeInsets.all(24.0),
child: Consumer(
builder: (BuildContext context, MyTrackersViewModel myTrackersViewModel, Widget child) {
builder: (BuildContext context, MyTrackersViewModel myTrackersViewModel, Widget? child) {
return Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
buildWeightScaleUI(myTrackersViewModel),
if (myTrackersViewModel.isAndesfitDeviceConnected != null && myTrackersViewModel.isAndesfitDeviceConnected) ...[
if (myTrackersViewModel.isAndesfitDeviceConnected != null && myTrackersViewModel.isAndesfitDeviceConnected!) ...[
Row(
children: [
Expanded(

@ -25,7 +25,7 @@ class BleDevicesScreen extends StatefulWidget {
}
class _BleDevicesScreenState extends State<BleDevicesScreen> {
MyTrackersViewModel myTrackersVm;
late MyTrackersViewModel myTrackersVm;
@override
void dispose() {
@ -59,9 +59,9 @@ class _BleDevicesScreenState extends State<BleDevicesScreen> {
myTrackersVm.isDeviceSelected = true;
log("isDeviceSelected from Screen: ${myTrackersVm.isDeviceSelected}");
FlutterBluePlus.stopScan();
switch (device.deviceType) {
switch (device.deviceType!) {
case TrackerTypeEnum.OxymeterTracker:
if (myTrackersVm.isDeviceFromAndesFit(device.name)) {
if (myTrackersVm.isDeviceFromAndesFit(device.name!)) {
return;
}
myTrackersVm.oxyRtModel = null;
@ -73,23 +73,23 @@ class _BleDevicesScreenState extends State<BleDevicesScreen> {
myTrackersVm.andesfitBpRtResultModel = null;
myTrackersVm.selectedAndesFitScanResult = null;
myTrackersVm.isAndesfitDeviceConnected = null;
myTrackersVm.bleDevicesStream.cancel();
if (myTrackersVm.isDeviceFromAndesFit(device.name)) {
Navigator.pushReplacement(context, FadePage(page: AndesFitBloodPressureConnectScreen(deviceModel: device.andesfitBluetoothDevice, isEcgAvailable: false)));
myTrackersVm.bleDevicesStream!.cancel();
if (myTrackersVm.isDeviceFromAndesFit(device.name!)) {
Navigator.pushReplacement(context, FadePage(page: AndesFitBloodPressureConnectScreen(deviceModel: device.andesfitBluetoothDevice!, isEcgAvailable: false)));
return;
}
Navigator.pushReplacement(context, FadePage(page: BloodPressureConnectScreen(deviceModel: device, isEcgAvailable: getIfECGAvailableInBPDevice(device.name))));
Navigator.pushReplacement(context, FadePage(page: BloodPressureConnectScreen(deviceModel: device, isEcgAvailable: getIfECGAvailableInBPDevice(device.name!))));
break;
case TrackerTypeEnum.BloodSugarTracker:
if (myTrackersVm.isDeviceFromAndesFit(device.name)) {
if (myTrackersVm.isDeviceFromAndesFit(device.name!)) {
myTrackersVm.currentBloodGlucose = null;
Navigator.pushReplacement(context, FadePage(page: AndesFitBloodSugarConnectScreen(deviceModel: device.andesfitBluetoothDevice)));
Navigator.pushReplacement(context, FadePage(page: AndesFitBloodSugarConnectScreen(deviceModel: device.andesfitBluetoothDevice!)));
return;
}
break;
case TrackerTypeEnum.ECGTracker:
if (myTrackersVm.isDeviceFromAndesFit(device.name)) {
if (myTrackersVm.isDeviceFromAndesFit(device.name!)) {
return;
}
myTrackersVm.ecgRtModel = null;
@ -97,38 +97,38 @@ class _BleDevicesScreenState extends State<BleDevicesScreen> {
break;
case TrackerTypeEnum.WeightScale:
if (myTrackersVm.isDeviceFromAndesFit(device.name)) {
if (myTrackersVm.isDeviceFromAndesFit(device.name!)) {
myTrackersVm.andesfitWeightScaleData = null;
Navigator.pushReplacement(context, FadePage(page: AndesFitWeightScaleConnectScreen(deviceModel: device.andesfitBluetoothDevice)));
Navigator.pushReplacement(context, FadePage(page: AndesFitWeightScaleConnectScreen(deviceModel: device.andesfitBluetoothDevice!)));
return;
}
break;
case TrackerTypeEnum.Temperature:
if (myTrackersVm.isDeviceFromAndesFit(device.name)) {
if (myTrackersVm.isDeviceFromAndesFit(device.name!)) {
myTrackersVm.currentTempInCelsius = null;
Navigator.pushReplacement(context, FadePage(page: AndesFitTemperatureConnectScreen(deviceModel: device.andesfitBluetoothDevice)));
Navigator.pushReplacement(context, FadePage(page: AndesFitTemperatureConnectScreen(deviceModel: device.andesfitBluetoothDevice!)));
return;
}
break;
case TrackerTypeEnum.Spirometer:
if (myTrackersVm.isDeviceFromAndesFit(device.name)) {
if (myTrackersVm.isDeviceFromAndesFit(device.name!)) {
myTrackersVm.currentTempInCelsius = null;
Navigator.pushReplacement(context, FadePage(page: AndesFitSpirometerConnectScreen(deviceModel: device.andesfitBluetoothDevice)));
Navigator.pushReplacement(context, FadePage(page: AndesFitSpirometerConnectScreen(deviceModel: device.andesfitBluetoothDevice!)));
return;
}
break;
case TrackerTypeEnum.SmartRing:
if (myTrackersVm.isDeviceFromAndesFit(device.name)) {
if (myTrackersVm.isDeviceFromAndesFit(device.name!)) {
return;
}
Navigator.pushReplacement(context, FadePage(page: SmartRingAllInOneConnectScreen(deviceModel: device)));
break;
case TrackerTypeEnum.AllInOneTracker:
if (myTrackersVm.isDeviceFromAndesFit(device.name)) {
if (myTrackersVm.isDeviceFromAndesFit(device.name!)) {
return;
}
Navigator.pushReplacement(context, FadePage(page: CheckMeAllInOneConnectScreen(deviceModel: device)));
@ -150,7 +150,7 @@ class _BleDevicesScreenState extends State<BleDevicesScreen> {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Consumer(
builder: (BuildContext context, MyTrackersViewModel myTrackerVm, Widget child) {
builder: (BuildContext context, MyTrackersViewModel myTrackerVm, Widget? child) {
if (myTrackerVm.devicesList.isEmpty) {
return Padding(
padding: const EdgeInsets.all(24.0),

@ -11,14 +11,14 @@ import 'package:provider/provider.dart';
class CheckMeAllInOneConnectScreen extends StatefulWidget {
final BleDeviceModel deviceModel;
const CheckMeAllInOneConnectScreen({this.deviceModel});
const CheckMeAllInOneConnectScreen({required this.deviceModel});
@override
State<CheckMeAllInOneConnectScreen> createState() => _CheckMeAllInOneConnectScreenState();
}
class _CheckMeAllInOneConnectScreenState extends State<CheckMeAllInOneConnectScreen> {
MyTrackersViewModel myTrackersVm;
late MyTrackersViewModel myTrackersVm;
@override
void initState() {
@ -62,7 +62,6 @@ class _CheckMeAllInOneConnectScreenState extends State<CheckMeAllInOneConnectScr
case TrackerTypeEnum.AllInOneTracker:
return "All in One";
}
return "All in One";
}
Future<void> onTrackerTypePressed(TrackerTypeEnum trackerTypeEnum, MyTrackersViewModel myTrackersViewModel) async {
@ -147,7 +146,7 @@ class _CheckMeAllInOneConnectScreenState extends State<CheckMeAllInOneConnectScr
body: Padding(
padding: const EdgeInsets.all(24.0),
child: Consumer(
builder: (BuildContext context, MyTrackersViewModel myTrackersViewModel, Widget child) {
builder: (BuildContext context, MyTrackersViewModel myTrackersViewModel, Widget? child) {
return Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,

@ -1,4 +1,3 @@
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/pages/medical/my_trackers/ble_device_type_screens/checkme_ecg_info_screen.dart';
import 'package:diplomaticquarterapp/pages/medical/my_trackers/ble_models/checkmepro_all_in_one_models/checkme_bp_model.dart';
import 'package:diplomaticquarterapp/pages/medical/my_trackers/ble_models/checkmepro_all_in_one_models/checkme_ecg_model.dart';
@ -44,7 +43,6 @@ class CheckMeAllInOneInfoScreen extends StatelessWidget {
case TrackerTypeEnum.SmartRing:
return "Smart Ring";
}
return "All in One";
}
Widget getAllInOneOperationWidgets(MyTrackersViewModel myTrackersVm, TrackerTypeEnum trackerTypeEnum, BuildContext context) {
@ -69,9 +67,7 @@ class CheckMeAllInOneInfoScreen extends StatelessWidget {
case TrackerTypeEnum.AllInOneTracker:
case TrackerTypeEnum.SmartRing:
return getNoDataWidget(context);
break;
}
return getNoDataWidget(context);
}
Widget buildTemperatureWidget(MyTrackersViewModel myTrackersVm, BuildContext context) {
@ -80,15 +76,15 @@ class CheckMeAllInOneInfoScreen extends StatelessWidget {
children: [
if (myTrackersVm.filesLoader) ...[
Center(child: CircularProgressIndicator())
] else if (myTrackersVm.checkMeTemperatures != null && myTrackersVm.checkMeTemperatures.isNotEmpty) ...[
] else if (myTrackersVm.checkMeTemperatures != null && myTrackersVm.checkMeTemperatures!.isNotEmpty) ...[
Material(
child: ListView.separated(
itemCount: myTrackersVm.checkMeTemperatures.length,
itemCount: myTrackersVm.checkMeTemperatures!.length,
separatorBuilder: (context, index) => SizedBox(height: 14),
shrinkWrap: true,
reverse: false,
itemBuilder: (context, index) {
CheckMeTemperatureModel checkMeTemp = myTrackersVm.checkMeTemperatures[index];
CheckMeTemperatureModel checkMeTemp = myTrackersVm.checkMeTemperatures![index];
return InkWell(
onTap: () => Navigator.pop(context),
child: Container(
@ -120,18 +116,18 @@ class CheckMeAllInOneInfoScreen extends StatelessWidget {
children: [
if (myTrackersVm.filesLoader) ...[
Center(child: CircularProgressIndicator())
] else if (myTrackersVm.checkMeEcg != null && myTrackersVm.checkMeEcg.isNotEmpty) ...[
] else if (myTrackersVm.checkMeEcg != null && myTrackersVm.checkMeEcg!.isNotEmpty) ...[
Material(
child: ListView.separated(
itemCount: myTrackersVm.checkMeEcg.length,
itemCount: myTrackersVm.checkMeEcg!.length,
separatorBuilder: (context, index) => SizedBox(height: 14),
shrinkWrap: true,
reverse: false,
itemBuilder: (context, index) {
CheckMeECGModel checkMeECGModel = myTrackersVm.checkMeEcg[index];
CheckMeECGModel checkMeECGModel = myTrackersVm.checkMeEcg![index];
return InkWell(
onTap: () {
myTrackersVm.getEcgWaveDataFromCheckMePro(checkMeECGModel.timeString);
myTrackersVm.getEcgWaveDataFromCheckMePro(checkMeECGModel.timeString!);
Navigator.push(context, MaterialPageRoute(builder: (context) => CheckMeECGInfoScreen(TrackerTypeEnum.ECGTracker)));
},
child: Container(
@ -163,15 +159,15 @@ class CheckMeAllInOneInfoScreen extends StatelessWidget {
children: [
if (myTrackersVm.filesLoader) ...[
Center(child: CircularProgressIndicator())
] else if (myTrackersVm.checkMeOxi != null && myTrackersVm.checkMeOxi.isNotEmpty) ...[
] else if (myTrackersVm.checkMeOxi != null && myTrackersVm.checkMeOxi!.isNotEmpty) ...[
Material(
child: ListView.separated(
itemCount: myTrackersVm.checkMeOxi.length,
itemCount: myTrackersVm.checkMeOxi!.length,
separatorBuilder: (context, index) => SizedBox(height: 14),
shrinkWrap: true,
reverse: false,
itemBuilder: (context, index) {
CheckMeOxiModel checkMeOxiModel = myTrackersVm.checkMeOxi[index];
CheckMeOxiModel checkMeOxiModel = myTrackersVm.checkMeOxi![index];
return InkWell(
onTap: () => Navigator.pop(context),
child: Container(
@ -205,15 +201,15 @@ class CheckMeAllInOneInfoScreen extends StatelessWidget {
children: [
if (myTrackersVm.filesLoader) ...[
Center(child: CircularProgressIndicator())
] else if (myTrackersVm.checkMeBP != null && myTrackersVm.checkMeBP.isNotEmpty) ...[
] else if (myTrackersVm.checkMeBP != null && myTrackersVm.checkMeBP!.isNotEmpty) ...[
Material(
child: ListView.separated(
itemCount: myTrackersVm.checkMeBP.length,
itemCount: myTrackersVm.checkMeBP!.length,
separatorBuilder: (context, index) => SizedBox(height: 14),
shrinkWrap: true,
reverse: false,
itemBuilder: (context, index) {
CheckMeBPModel checkMeBPModel = myTrackersVm.checkMeBP[index];
CheckMeBPModel checkMeBPModel = myTrackersVm.checkMeBP![index];
return InkWell(
onTap: () => Navigator.pop(context),
child: Container(
@ -247,15 +243,15 @@ class CheckMeAllInOneInfoScreen extends StatelessWidget {
children: [
if (myTrackersVm.filesLoader) ...[
Center(child: CircularProgressIndicator())
] else if (myTrackersVm.checkMeGlucose != null && myTrackersVm.checkMeGlucose.isNotEmpty) ...[
] else if (myTrackersVm.checkMeGlucose != null && myTrackersVm.checkMeGlucose!.isNotEmpty) ...[
Material(
child: ListView.separated(
itemCount: myTrackersVm.checkMeGlucose.length,
itemCount: myTrackersVm.checkMeGlucose!.length,
separatorBuilder: (context, index) => SizedBox(height: 14),
shrinkWrap: true,
reverse: false,
itemBuilder: (context, index) {
CheckMeGlucoseModel checkMeGlucoseModel = myTrackersVm.checkMeGlucose[index];
CheckMeGlucoseModel checkMeGlucoseModel = myTrackersVm.checkMeGlucose![index];
return InkWell(
onTap: () => null,
child: Container(
@ -293,7 +289,7 @@ class CheckMeAllInOneInfoScreen extends StatelessWidget {
child: Padding(
padding: const EdgeInsets.all(24.0),
child: Consumer(
builder: (BuildContext context, MyTrackersViewModel myTrackersVm, Widget child) {
builder: (BuildContext context, MyTrackersViewModel myTrackersVm, Widget? child) {
return getAllInOneOperationWidgets(myTrackersVm, allInOneTrackerTypeEnum, context);
},
),

@ -5,11 +5,11 @@ import 'package:flutter/material.dart';
class CheckMeECGChartView extends StatelessWidget {
final CheckMeECGWaveModel checkMeECGWave;
CheckMeECGChartView({@required this.checkMeECGWave});
CheckMeECGChartView({required this.checkMeECGWave});
@override
Widget build(BuildContext context) {
List<int> list = checkMeECGWave.bytes;
List<int> list = checkMeECGWave.bytes ?? [];
List<List<int>> mainList = chunkIntList(list, 1250);
return ListView.separated(
shrinkWrap: true,
@ -28,13 +28,13 @@ class CheckMeECGChartView extends StatelessWidget {
horizontalInterval: 30,
getDrawingVerticalLine: (value) {
return FlLine(
color: Colors.red[300],
color: Colors.red[300]!,
strokeWidth: 0.4,
);
},
getDrawingHorizontalLine: (value) {
return FlLine(
color: Colors.red[300],
color: Colors.red[300]!,
strokeWidth: 0.4,
);
},
@ -55,7 +55,7 @@ class CheckMeECGChartView extends StatelessWidget {
barWidth: 0.5,
dotData: FlDotData(show: false),
spots: getDataList(mainList[index]),
colors: [Colors.grey[800]],
color: Colors.grey[800],
isStrokeCapRound: true,
belowBarData: BarAreaData(show: false),
),

@ -30,6 +30,9 @@ class CheckMeECGInfoScreen extends StatelessWidget {
case TrackerTypeEnum.ECGTracker:
return "ECG";
case TrackerTypeEnum.SmartRing:
return "Smart Ring";
case TrackerTypeEnum.WeightScale:
return "Weight Scale";
@ -42,7 +45,6 @@ class CheckMeECGInfoScreen extends StatelessWidget {
case TrackerTypeEnum.AllInOneTracker:
return "All in One";
}
return "All in One";
}
Widget buildECGDetailsWidget(MyTrackersViewModel myTrackersVm, BuildContext context) {
@ -55,18 +57,18 @@ class CheckMeECGInfoScreen extends StatelessWidget {
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text("HR: ${myTrackersVm.checkMeECGWave.hr} bpm"),
Text("ST: ${myTrackersVm.checkMeECGWave.st} mV"),
Text("QRS: ${myTrackersVm.checkMeECGWave.qrs} ms"),
Text("HR: ${myTrackersVm.checkMeECGWave!.hr} bpm"),
Text("ST: ${myTrackersVm.checkMeECGWave!.st} mV"),
Text("QRS: ${myTrackersVm.checkMeECGWave!.qrs} ms"),
],
),
mHeight(4.0),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text("PVCS: ${myTrackersVm.checkMeECGWave.pvcs} "),
Text("QTC: ${myTrackersVm.checkMeECGWave.qtc} ms"),
Text("QT: ${myTrackersVm.checkMeECGWave.qt} ms"),
Text("PVCS: ${myTrackersVm.checkMeECGWave!.pvcs} "),
Text("QTC: ${myTrackersVm.checkMeECGWave!.qtc} ms"),
Text("QT: ${myTrackersVm.checkMeECGWave!.qt} ms"),
],
),
],
@ -86,7 +88,7 @@ class CheckMeECGInfoScreen extends StatelessWidget {
child: Padding(
padding: const EdgeInsets.all(24.0),
child: Consumer(
builder: (BuildContext context, MyTrackersViewModel myTrackersVm, Widget child) {
builder: (BuildContext context, MyTrackersViewModel myTrackersVm, Widget? child) {
if (myTrackersVm.checkMeECGWave == null) {
return Padding(
padding: const EdgeInsets.all(24.0),
@ -102,7 +104,7 @@ class CheckMeECGInfoScreen extends StatelessWidget {
children: [
buildECGDetailsWidget(myTrackersVm, context),
mHeight(20),
CheckMeECGChartView(checkMeECGWave: myTrackersVm.checkMeECGWave),
CheckMeECGChartView(checkMeECGWave: myTrackersVm.checkMeECGWave!),
],
);
},

@ -1,6 +1,4 @@
import 'package:diplomaticquarterapp/extensions/string_extensions.dart';
import 'package:diplomaticquarterapp/pages/medical/my_trackers/ble_models/ble_devices_model.dart';
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:diplomaticquarterapp/pages/medical/my_trackers/my_trackers_view_model/my_trackers_view_model.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
@ -11,14 +9,14 @@ import 'package:provider/provider.dart';
class AndesAllInOneConnectScreenIos extends StatefulWidget {
final BleDeviceModel deviceModel;
const AndesAllInOneConnectScreenIos({this.deviceModel});
const AndesAllInOneConnectScreenIos({required this.deviceModel});
@override
State<AndesAllInOneConnectScreenIos> createState() => _AndesAllInOneConnectScreenState();
}
class _AndesAllInOneConnectScreenState extends State<AndesAllInOneConnectScreenIos> {
MyTrackersViewModel myTrackersVm;
late MyTrackersViewModel myTrackersVm;
@override
void initState() {
@ -37,7 +35,7 @@ class _AndesAllInOneConnectScreenState extends State<AndesAllInOneConnectScreenI
return Expanded(
child: ListView(
children: [
if (myTrackersViewModel.andesfitWeightScaleData == null && (myTrackersViewModel.isAndesfitDeviceConnected != null && myTrackersViewModel.isAndesfitDeviceConnected)) ...[
if (myTrackersViewModel.andesfitWeightScaleData == null && (myTrackersViewModel.isAndesfitDeviceConnected != null && myTrackersViewModel.isAndesfitDeviceConnected!)) ...[
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
@ -79,7 +77,7 @@ class _AndesAllInOneConnectScreenState extends State<AndesAllInOneConnectScreenI
body: Padding(
padding: const EdgeInsets.all(24.0),
child: Consumer(
builder: (BuildContext context, MyTrackersViewModel myTrackersViewModel, Widget child) {
builder: (BuildContext context, MyTrackersViewModel myTrackersViewModel, Widget? child) {
return Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,

@ -14,14 +14,14 @@ class BloodPressureConnectScreen extends StatefulWidget {
final BleDeviceModel deviceModel;
final bool isEcgAvailable;
const BloodPressureConnectScreen({this.deviceModel, this.isEcgAvailable = false});
const BloodPressureConnectScreen({required this.deviceModel, this.isEcgAvailable = false});
@override
State<BloodPressureConnectScreen> createState() => _BloodPressureConnectScreenState();
}
class _BloodPressureConnectScreenState extends State<BloodPressureConnectScreen> {
MyTrackersViewModel myTrackersVm;
late MyTrackersViewModel myTrackersVm;
@override
void initState() {
@ -53,7 +53,7 @@ class _BloodPressureConnectScreenState extends State<BloodPressureConnectScreen>
mHeight(24.0),
Column(
children: [
Text(myTrackersViewModel.bpRtMeasuringModel.pressure.toString(), style: TextStyle(fontSize: 100, fontWeight: FontWeight.bold)),
Text(myTrackersViewModel.bpRtMeasuringModel!.pressure.toString(), style: TextStyle(fontSize: 100, fontWeight: FontWeight.bold)),
Text("Pressure", style: TextStyle(fontSize: 20)),
],
),
@ -71,28 +71,28 @@ class _BloodPressureConnectScreenState extends State<BloodPressureConnectScreen>
Column(
children: [
Text("Sys", style: TextStyle(fontSize: 20)),
Text(myTrackersViewModel.bpRtResultModel.sys.toString(), style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text(myTrackersViewModel.bpRtResultModel!.sys.toString(), style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text("mmHg", style: TextStyle(fontSize: 10)),
],
),
Column(
children: [
Text("Dia", style: TextStyle(fontSize: 20)),
Text(myTrackersViewModel.bpRtResultModel.dia.toString(), style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text(myTrackersViewModel.bpRtResultModel!.dia.toString(), style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text("mmHg", style: TextStyle(fontSize: 10)),
],
),
Column(
children: [
Text("♥︎", style: TextStyle(fontSize: 20)),
Text(myTrackersViewModel.bpRtResultModel.pr.toString(), style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text(myTrackersViewModel.bpRtResultModel!.pr.toString(), style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text("/min", style: TextStyle(fontSize: 10)),
],
),
],
),
mHeight(30.0),
buildStatusForBP(myTrackersViewModel.bpRtResultModel.result),
buildStatusForBP(myTrackersViewModel.bpRtResultModel!.result!),
mHeight(24.0),
],
),
@ -124,14 +124,14 @@ class _BloodPressureConnectScreenState extends State<BloodPressureConnectScreen>
Column(
children: [
Text("Duration", style: TextStyle(fontSize: 20)),
Text(myTrackersViewModel.ecgRtMeasuringModelFromBP.curDuration.toString(), style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text(myTrackersViewModel.ecgRtMeasuringModelFromBP!.curDuration.toString(), style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text("seconds", style: TextStyle(fontSize: 10)),
],
),
Column(
children: [
Text("♥︎", style: TextStyle(fontSize: 20)),
Text(myTrackersViewModel.ecgRtMeasuringModelFromBP.hr.toString(), style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text(myTrackersViewModel.ecgRtMeasuringModelFromBP!.hr.toString(), style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text("/min", style: TextStyle(fontSize: 10)),
],
),
@ -149,14 +149,14 @@ class _BloodPressureConnectScreenState extends State<BloodPressureConnectScreen>
Column(
children: [
Text("Regular", style: TextStyle(fontSize: 20)),
Text(myTrackersViewModel.ecgRtResultModelFromBP.diagnosis.isRegular ? "YES" : "NO", style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text(myTrackersViewModel.ecgRtResultModelFromBP!.diagnosis!.isRegular! ? "YES" : "NO", style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text("", style: TextStyle(fontSize: 10)),
],
),
Column(
children: [
Text("♥︎", style: TextStyle(fontSize: 20)),
Text(myTrackersViewModel.ecgRtResultModelFromBP.hr.toString(), style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text(myTrackersViewModel.ecgRtResultModelFromBP!.hr.toString(), style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text("/min", style: TextStyle(fontSize: 10)),
],
),
@ -197,7 +197,7 @@ class _BloodPressureConnectScreenState extends State<BloodPressureConnectScreen>
// ],
// ),
mHeight(30.0),
buildStatusForECG(myTrackersViewModel.ecgRtResultModelFromBP.result),
buildStatusForECG(myTrackersViewModel.ecgRtResultModelFromBP!.result!),
],
),
] else ...[
@ -275,7 +275,7 @@ class _BloodPressureConnectScreenState extends State<BloodPressureConnectScreen>
padding: const EdgeInsets.all(20),
margin: const EdgeInsets.symmetric(vertical: 35, horizontal: 30),
child: SingleChildScrollView(
child: Consumer(builder: (BuildContext context, MyTrackersViewModel myTrackersVm, Widget child) {
child: Consumer(builder: (BuildContext context, MyTrackersViewModel myTrackersVm, Widget? child) {
return Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
@ -346,7 +346,7 @@ class _BloodPressureConnectScreenState extends State<BloodPressureConnectScreen>
body: Padding(
padding: const EdgeInsets.all(24.0),
child: Consumer(
builder: (BuildContext context, MyTrackersViewModel myTrackersViewModel, Widget child) {
builder: (BuildContext context, MyTrackersViewModel myTrackersViewModel, Widget? child) {
return Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,

@ -17,14 +17,14 @@ import 'package:provider/provider.dart';
class ECGConnectScreen extends StatefulWidget {
final BleDeviceModel deviceModel;
const ECGConnectScreen({this.deviceModel});
const ECGConnectScreen({required this.deviceModel});
@override
State<ECGConnectScreen> createState() => _ECGConnectScreenState();
}
class _ECGConnectScreenState extends State<ECGConnectScreen> {
MyTrackersViewModel myTrackersVm;
late MyTrackersViewModel myTrackersVm;
@override
void initState() {
@ -39,7 +39,7 @@ class _ECGConnectScreenState extends State<ECGConnectScreen> {
super.dispose();
}
Widget buildStatus(int currentStatus) {
Widget buildStatus(int? currentStatus) {
String resultStatus = "";
if (currentStatus == 0) {
@ -72,8 +72,6 @@ class _ECGConnectScreenState extends State<ECGConnectScreen> {
);
}
showHistoryDialog(BuildContext context) {
return showDialog(
context: context,
@ -82,7 +80,7 @@ class _ECGConnectScreenState extends State<ECGConnectScreen> {
padding: const EdgeInsets.all(20),
margin: const EdgeInsets.symmetric(vertical: 35, horizontal: 30),
child: SingleChildScrollView(
child: Consumer(builder: (BuildContext context, MyTrackersViewModel myTrackersVm, Widget child) {
child: Consumer(builder: (BuildContext context, MyTrackersViewModel myTrackersVm, Widget? child) {
return Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
@ -169,21 +167,21 @@ class _ECGConnectScreenState extends State<ECGConnectScreen> {
Column(
children: [
Text("Record Time", style: TextStyle(fontSize: 20)),
Text(myTrackersViewModel.ecgRtModel.param.recordTime.toString(), style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text(myTrackersViewModel.ecgRtModel!.param!.recordTime.toString(), style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text("seconds", style: TextStyle(fontSize: 10)),
],
),
Column(
children: [
Text("♥︎", style: TextStyle(fontSize: 20)),
Text(myTrackersViewModel.ecgRtModel.param.hr.toString(), style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text(myTrackersViewModel.ecgRtModel!.param!.hr.toString(), style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text("/min", style: TextStyle(fontSize: 10)),
],
),
],
),
mHeight(30.0),
buildStatus(myTrackersViewModel.ecgRtModel.param.curStatus),
buildStatus(myTrackersViewModel.ecgRtModel!.param!.curStatus!.toInt()),
],
)
],

@ -9,14 +9,14 @@ import 'package:provider/provider.dart';
class OxymeterConnectScreen extends StatefulWidget {
final BleDeviceModel deviceModel;
const OxymeterConnectScreen({this.deviceModel});
const OxymeterConnectScreen({required this.deviceModel});
@override
State<OxymeterConnectScreen> createState() => _OxymeterConnectScreenState();
}
class _OxymeterConnectScreenState extends State<OxymeterConnectScreen> {
MyTrackersViewModel myTrackersVm;
late MyTrackersViewModel myTrackersVm;
@override
void initState() {
@ -42,7 +42,7 @@ class _OxymeterConnectScreenState extends State<OxymeterConnectScreen> {
body: Padding(
padding: const EdgeInsets.all(24.0),
child: Consumer(
builder: (BuildContext context, MyTrackersViewModel myTrackersViewModel, Widget child) {
builder: (BuildContext context, MyTrackersViewModel myTrackersViewModel, Widget? child) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
@ -58,27 +58,27 @@ class _OxymeterConnectScreenState extends State<OxymeterConnectScreen> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
if (myTrackersViewModel.oxyRtModel.isProbeOff) ...[
if (myTrackersViewModel.oxyRtModel!.isProbeOff ?? false) ...[
Text("Check Probe", style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
] else ...[
Column(
children: [
Text("SPO₂", style: TextStyle(fontSize: 20)),
Text(myTrackersViewModel.oxyRtModel.spo2.toString(), style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text(myTrackersViewModel.oxyRtModel!.spo2.toString(), style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text("%", style: TextStyle(fontSize: 10)),
],
),
Column(
children: [
Text("Pulse", style: TextStyle(fontSize: 20)),
Text(myTrackersViewModel.oxyRtModel.pr.toString(), style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text(myTrackersViewModel.oxyRtModel!.pr.toString(), style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text("bpm", style: TextStyle(fontSize: 10)),
],
),
Column(
children: [
Text("PI", style: TextStyle(fontSize: 20)),
Text(myTrackersViewModel.oxyRtModel.pi.toString(), style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text(myTrackersViewModel.oxyRtModel!.pi.toString(), style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text("%", style: TextStyle(fontSize: 10)),
],
),

@ -9,7 +9,7 @@ import 'package:provider/provider.dart';
class SelectTrackerType extends StatelessWidget {
const SelectTrackerType();
List<Widget> myTrackersTypeList({BuildContext context}) {
List<Widget> myTrackersTypeList({required BuildContext context}) {
List<Widget> medical = [];
medical.add(InkWell(
onTap: () {

@ -11,14 +11,14 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
class SmartRingAllInOneConnectScreen extends StatefulWidget {
final BleDeviceModel deviceModel;
const SmartRingAllInOneConnectScreen({this.deviceModel});
const SmartRingAllInOneConnectScreen({required this.deviceModel});
@override
State<SmartRingAllInOneConnectScreen> createState() => _SmartRingAllInOneConnectScreenState();
}
class _SmartRingAllInOneConnectScreenState extends State<SmartRingAllInOneConnectScreen> {
MyTrackersViewModel myTrackersVm;
late MyTrackersViewModel myTrackersVm;
@override
void initState() {
@ -59,7 +59,6 @@ class _SmartRingAllInOneConnectScreenState extends State<SmartRingAllInOneConnec
case SmartRingOperationsEnum.BatteryLevel:
return "Battery Level";
}
return "All in One";
}
Future<void> onTrackerTypePressed(SmartRingOperationsEnum smartRingOperationsEnum, MyTrackersViewModel myTrackersViewModel) async {
@ -159,7 +158,7 @@ class _SmartRingAllInOneConnectScreenState extends State<SmartRingAllInOneConnec
body: Padding(
padding: const EdgeInsets.all(24.0),
child: Consumer(
builder: (BuildContext context, MyTrackersViewModel myTrackersViewModel, Widget child) {
builder: (BuildContext context, MyTrackersViewModel myTrackersViewModel, Widget? child) {
return Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,

@ -15,7 +15,7 @@ class SmartRingInfoScreen extends StatefulWidget {
}
class _SmartRingInfoScreenState extends State<SmartRingInfoScreen> {
MyTrackersViewModel myTrackersViewModel;
late MyTrackersViewModel myTrackersViewModel;
@override
void initState() {
@ -55,10 +55,8 @@ class _SmartRingInfoScreenState extends State<SmartRingInfoScreen> {
case SmartRingOperationsEnum.SportsMode:
return "Sports Mode";
}
return "Battery Level";
}
Widget getAllInOneOperationWidgets(MyTrackersViewModel myTrackersVm, SmartRingOperationsEnum smartRingOperationsEnum, BuildContext context) {
switch (smartRingOperationsEnum) {
case SmartRingOperationsEnum.Temperature:
@ -77,23 +75,21 @@ class _SmartRingInfoScreenState extends State<SmartRingInfoScreen> {
return buildBatteryLevelWidget(myTrackersVm, context);
case SmartRingOperationsEnum.SportsMode:
return buildRtSportsDataSmartRingWidget(myTrackersVm, context);
break;
}
return getNoDataWidget(context);
}
Widget buildTemperatureWidget(MyTrackersViewModel myTrackersVm, BuildContext context) {
if (myTrackersVm.filesLoader) {
return Center(child: CircularProgressIndicator());
} else if (myTrackersVm.smartRingTemperatureHistory != null && myTrackersVm.smartRingTemperatureHistory.isNotEmpty) {
} else if (myTrackersVm.smartRingTemperatureHistory != null && myTrackersVm.smartRingTemperatureHistory!.isNotEmpty) {
return Expanded(
child: ListView.separated(
itemCount: myTrackersVm.smartRingTemperatureHistory.length,
itemCount: myTrackersVm.smartRingTemperatureHistory!.length,
separatorBuilder: (context, index) => SizedBox(height: 14),
shrinkWrap: true,
reverse: false,
itemBuilder: (context, index) {
SmartRingGenericModel smartRingTemp = myTrackersVm.smartRingTemperatureHistory[index];
SmartRingGenericModel smartRingTemp = myTrackersVm.smartRingTemperatureHistory![index];
return InkWell(
onTap: () => Navigator.pop(context),
child: Container(
@ -120,15 +116,15 @@ class _SmartRingInfoScreenState extends State<SmartRingInfoScreen> {
Widget buildHeartRateDynamicWidget(MyTrackersViewModel myTrackersVm, BuildContext context) {
if (myTrackersVm.filesLoader) {
return Center(child: CircularProgressIndicator());
} else if (myTrackersVm.smartRingHeartRateDynamicHistory != null && myTrackersVm.smartRingHeartRateDynamicHistory.isNotEmpty) {
} else if (myTrackersVm.smartRingHeartRateDynamicHistory != null && myTrackersVm.smartRingHeartRateDynamicHistory!.isNotEmpty) {
return Expanded(
child: ListView.separated(
itemCount: myTrackersVm.smartRingHeartRateDynamicHistory.length,
itemCount: myTrackersVm.smartRingHeartRateDynamicHistory!.length,
separatorBuilder: (context, index) => SizedBox(height: 14),
shrinkWrap: true,
reverse: false,
itemBuilder: (context, index) {
SmartRingGenericModel smartRingHr = myTrackersVm.smartRingHeartRateDynamicHistory[index];
SmartRingGenericModel smartRingHr = myTrackersVm.smartRingHeartRateDynamicHistory![index];
return InkWell(
onTap: () => Navigator.pop(context),
child: Container(
@ -155,15 +151,15 @@ class _SmartRingInfoScreenState extends State<SmartRingInfoScreen> {
Widget buildHeartRateStaticWidget(MyTrackersViewModel myTrackersVm, BuildContext context) {
if (myTrackersVm.filesLoader) {
return Center(child: CircularProgressIndicator());
} else if (myTrackersVm.smartRingHeartRateStaticHistory != null && myTrackersVm.smartRingHeartRateStaticHistory.isNotEmpty) {
} else if (myTrackersVm.smartRingHeartRateStaticHistory != null && myTrackersVm.smartRingHeartRateStaticHistory!.isNotEmpty) {
return Expanded(
child: ListView.separated(
itemCount: myTrackersVm.smartRingHeartRateStaticHistory.length,
itemCount: myTrackersVm.smartRingHeartRateStaticHistory!.length,
separatorBuilder: (context, index) => SizedBox(height: 14),
shrinkWrap: true,
reverse: false,
itemBuilder: (context, index) {
SmartRingGenericModel smartRingHr = myTrackersVm.smartRingHeartRateStaticHistory[index];
SmartRingGenericModel smartRingHr = myTrackersVm.smartRingHeartRateStaticHistory![index];
return InkWell(
onTap: () => Navigator.pop(context),
child: Container(
@ -202,21 +198,21 @@ class _SmartRingInfoScreenState extends State<SmartRingInfoScreen> {
Column(
children: [
Text("Step", style: TextStyle(fontSize: 20)),
Text(myTrackersViewModel.rtSportDataSmartRingModel.step.toString(), style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text(myTrackersViewModel.rtSportDataSmartRingModel!.step.toString(), style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text("", style: TextStyle(fontSize: 10)),
],
),
Column(
children: [
Text("Calories", style: TextStyle(fontSize: 20)),
Text(myTrackersViewModel.rtSportDataSmartRingModel.calories.toString(), style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text(myTrackersViewModel.rtSportDataSmartRingModel!.calories.toString(), style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text("kCal", style: TextStyle(fontSize: 10)),
],
),
Column(
children: [
Text("♥︎", style: TextStyle(fontSize: 20)),
Text(myTrackersViewModel.rtSportDataSmartRingModel.heartRate.toString(), style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text(myTrackersViewModel.rtSportDataSmartRingModel!.heartRate.toString(), style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text("/min", style: TextStyle(fontSize: 10)),
],
),
@ -229,7 +225,7 @@ class _SmartRingInfoScreenState extends State<SmartRingInfoScreen> {
Column(
children: [
Text("Time", style: TextStyle(fontSize: 20)),
Text(myTrackersViewModel.rtSportDataSmartRingModel.exerciseTime.toString(), style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text(myTrackersViewModel.rtSportDataSmartRingModel!.exerciseTime.toString(), style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
Text("seconds", style: TextStyle(fontSize: 10)),
],
),
@ -248,15 +244,15 @@ class _SmartRingInfoScreenState extends State<SmartRingInfoScreen> {
Widget buildHrvWidget(MyTrackersViewModel myTrackersVm, BuildContext context) {
if (myTrackersVm.filesLoader) {
return Center(child: CircularProgressIndicator());
} else if (myTrackersVm.smartRingHrvHistory != null && myTrackersVm.smartRingHrvHistory.isNotEmpty) {
} else if (myTrackersVm.smartRingHrvHistory != null && myTrackersVm.smartRingHrvHistory!.isNotEmpty) {
return Expanded(
child: ListView.separated(
itemCount: myTrackersVm.smartRingHrvHistory.length,
itemCount: myTrackersVm.smartRingHrvHistory!.length,
separatorBuilder: (context, index) => SizedBox(height: 14),
shrinkWrap: true,
reverse: false,
itemBuilder: (context, index) {
SmartRingHrvModel smartRingHrvModel = myTrackersVm.smartRingHrvHistory[index];
SmartRingHrvModel smartRingHrvModel = myTrackersVm.smartRingHrvHistory![index];
return InkWell(
onTap: () => Navigator.pop(context),
child: Container(
@ -293,15 +289,15 @@ class _SmartRingInfoScreenState extends State<SmartRingInfoScreen> {
Widget buildTotalStepCountHistoryWidget(MyTrackersViewModel myTrackersVm, BuildContext context) {
if (myTrackersVm.filesLoader) {
return Center(child: CircularProgressIndicator());
} else if (myTrackersVm.smartRingStepCountHistory != null && myTrackersVm.smartRingStepCountHistory.isNotEmpty) {
} else if (myTrackersVm.smartRingStepCountHistory != null && myTrackersVm.smartRingStepCountHistory!.isNotEmpty) {
return Expanded(
child: ListView.separated(
itemCount: myTrackersVm.smartRingStepCountHistory.length,
itemCount: myTrackersVm.smartRingStepCountHistory!.length,
separatorBuilder: (context, index) => SizedBox(height: 14),
shrinkWrap: true,
reverse: false,
itemBuilder: (context, index) {
SmartRingStepCountModel smartRingStepCountModel = myTrackersVm.smartRingStepCountHistory[index];
SmartRingStepCountModel smartRingStepCountModel = myTrackersVm.smartRingStepCountHistory![index];
return InkWell(
onTap: () => Navigator.pop(context),
child: Container(
@ -340,15 +336,15 @@ class _SmartRingInfoScreenState extends State<SmartRingInfoScreen> {
Widget buildBloodOxygenWidget(MyTrackersViewModel myTrackersVm, BuildContext context) {
if (myTrackersVm.filesLoader) {
return Center(child: CircularProgressIndicator());
} else if (myTrackersVm.smartRingBloodOxygenHistory != null && myTrackersVm.smartRingBloodOxygenHistory.isNotEmpty) {
} else if (myTrackersVm.smartRingBloodOxygenHistory != null && myTrackersVm.smartRingBloodOxygenHistory!.isNotEmpty) {
return Expanded(
child: ListView.separated(
itemCount: myTrackersVm.smartRingBloodOxygenHistory.length,
itemCount: myTrackersVm.smartRingBloodOxygenHistory!.length,
separatorBuilder: (context, index) => SizedBox(height: 14),
shrinkWrap: true,
reverse: false,
itemBuilder: (context, index) {
SmartRingGenericModel smartRingGenericModel = myTrackersVm.smartRingBloodOxygenHistory[index];
SmartRingGenericModel smartRingGenericModel = myTrackersVm.smartRingBloodOxygenHistory![index];
return InkWell(
onTap: () => Navigator.pop(context),
child: Container(
@ -375,7 +371,7 @@ class _SmartRingInfoScreenState extends State<SmartRingInfoScreen> {
Widget buildBatteryLevelWidget(MyTrackersViewModel myTrackersVm, BuildContext context) {
if (myTrackersVm.filesLoader) {
return Center(child: CircularProgressIndicator());
} else if (myTrackersVm.smartRingBatteryLevel != null && myTrackersVm.smartRingBatteryLevel.isNotEmpty) {
} else if (myTrackersVm.smartRingBatteryLevel != null && myTrackersVm.smartRingBatteryLevel!.isNotEmpty) {
return Center(
child: Text("Battery Level: ${myTrackersVm.smartRingBatteryLevel}"),
);
@ -397,7 +393,7 @@ class _SmartRingInfoScreenState extends State<SmartRingInfoScreen> {
child: Column(
children: [
Consumer(
builder: (BuildContext context, MyTrackersViewModel myTrackersVm, Widget child) {
builder: (BuildContext context, MyTrackersViewModel myTrackersVm, Widget? child) {
return getAllInOneOperationWidgets(myTrackersVm, widget.smartRingOperationsEnum, context);
},
),

@ -7,5 +7,5 @@ class WeightScaleData {
String muscle;
String bmr;
WeightScaleData({this.weight, this.bmi, this.fat, this.bone, this.water, this.muscle, this.bmr});
WeightScaleData({required this.weight, required this.bmi, required this.fat, required this.bone, required this.water, required this.muscle, required this.bmr});
}

@ -2,14 +2,20 @@ import 'package:diplomaticquarterapp/pages/medical/my_trackers/my_trackers_view_
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
class BleDeviceModel {
String macAddr;
int model;
String name;
int rssi;
TrackerTypeEnum deviceType;
BluetoothDevice andesfitBluetoothDevice;
String? macAddr;
int? model;
String? name;
int? rssi;
TrackerTypeEnum? deviceType;
BluetoothDevice? andesfitBluetoothDevice;
BleDeviceModel({this.macAddr, this.model, this.name, this.rssi, this.andesfitBluetoothDevice});
BleDeviceModel({
this.macAddr,
this.model,
this.name,
this.rssi,
this.andesfitBluetoothDevice,
});
BleDeviceModel.fromJson(Map<String, dynamic> json, TrackerTypeEnum trackerType) {
macAddr = json['macAddr'];
@ -17,11 +23,11 @@ class BleDeviceModel {
name = json['name'];
rssi = json['rssi'];
deviceType = trackerType;
andesfitBluetoothDevice = null;
andesfitBluetoothDevice = null; // You can remove this line if it's intended to be null by default
}
@override
String toString() {
return 'BleDeviceModel{macAddr: $macAddr, model: $model, name: $name, rssi: $rssi, deviceType: $deviceType, andesfitBluetoothDevice: ${andesfitBluetoothDevice.toString()}';
return 'BleDeviceModel{macAddr: $macAddr, model: $model, name: $name, rssi: $rssi, deviceType: $deviceType, andesfitBluetoothDevice: ${andesfitBluetoothDevice?.toString()}';
}
}

@ -1,28 +1,29 @@
class CheckMeInfoModel {
String region;
String model;
String hardwareVer;
String softwareVer;
String languageVer;
String curLanguage;
String fileVer;
String sPCPVer;
String application;
String sN;
String branchCode;
String? region;
String? model;
String? hardwareVer;
String? softwareVer;
String? languageVer;
String? curLanguage;
String? fileVer;
String? sPCPVer;
String? application;
String? sN;
String? branchCode;
CheckMeInfoModel(
{this.region,
this.model,
this.hardwareVer,
this.softwareVer,
this.languageVer,
this.curLanguage,
this.fileVer,
this.sPCPVer,
this.application,
this.sN,
this.branchCode});
CheckMeInfoModel({
required this.region,
required this.model,
required this.hardwareVer,
required this.softwareVer,
required this.languageVer,
required this.curLanguage,
required this.fileVer,
required this.sPCPVer,
required this.application,
required this.sN,
required this.branchCode,
});
@override
String toString() {

@ -1,11 +1,17 @@
class CheckMeBPModel {
String date;
int dia;
int pr;
int sys;
String timeString;
String? date;
int? dia;
int? pr;
int? sys;
String? timeString;
CheckMeBPModel({this.date, this.dia, this.pr, this.sys, this.timeString});
CheckMeBPModel({
required this.date,
required this.dia,
required this.pr,
required this.sys,
required this.timeString,
});
CheckMeBPModel.fromJson(Map<String, dynamic> json) {
date = json['date'];

@ -1,11 +1,17 @@
class CheckMeECGModel {
String date;
int face;
String timeString;
int voice;
int way;
String? date;
int? face;
String? timeString;
int? voice;
int? way;
CheckMeECGModel({this.date, this.face, this.timeString, this.voice, this.way});
CheckMeECGModel({
required this.date,
required this.face,
required this.timeString,
required this.voice,
required this.way,
});
CheckMeECGModel.fromJson(Map<String, dynamic> json) {
date = json['date'];

@ -1,27 +1,42 @@
class CheckMeECGWaveModel {
List<int> bytes;
int hr;
List<int> hrList;
int hrSize;
int pvcs;
int qrs;
int qt;
int qtc;
int result;
int st;
int total;
int waveIntSize;
List<int> waveList;
int waveSize;
int waveViewSize;
List<int>? bytes;
int? hr;
List<int>? hrList;
int? hrSize;
int? pvcs;
int? qrs;
int? qt;
int? qtc;
int? result;
int? st;
int? total;
int? waveIntSize;
List<int>? waveList;
int? waveSize;
int? waveViewSize;
CheckMeECGWaveModel(
{this.bytes, this.hr, this.hrList, this.hrSize, this.pvcs, this.qrs, this.qt, this.qtc, this.result, this.st, this.total, this.waveIntSize, this.waveList, this.waveSize, this.waveViewSize});
CheckMeECGWaveModel({
this.bytes,
this.hr,
this.hrList,
this.hrSize,
this.pvcs,
this.qrs,
this.qt,
this.qtc,
this.result,
this.st,
this.total,
this.waveIntSize,
this.waveList,
this.waveSize,
this.waveViewSize,
});
CheckMeECGWaveModel.fromJson(Map<String, dynamic> json) {
bytes = json['bytes'].cast<int>();
bytes = json['bytes']?.cast<int>();
hr = json['hr'];
hrList = json['hrList'].cast<int>();
hrList = json['hrList']?.cast<int>();
hrSize = json['hrSize'];
pvcs = json['pvcs'];
qrs = json['qrs'];
@ -31,28 +46,28 @@ class CheckMeECGWaveModel {
st = json['st'];
total = json['total'];
waveIntSize = json['waveIntSize'];
waveList = json['waveList'].cast<int>();
waveList = json['waveList']?.cast<int>();
waveSize = json['waveSize'];
waveViewSize = json['waveViewSize'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['bytes'] = this.bytes;
data['hr'] = this.hr;
data['hrList'] = this.hrList;
data['hrSize'] = this.hrSize;
data['pvcs'] = this.pvcs;
data['qrs'] = this.qrs;
data['qt'] = this.qt;
data['qtc'] = this.qtc;
data['result'] = this.result;
data['st'] = this.st;
data['total'] = this.total;
data['waveIntSize'] = this.waveIntSize;
data['waveList'] = this.waveList;
data['waveSize'] = this.waveSize;
data['waveViewSize'] = this.waveViewSize;
final Map<String, dynamic> data = <String, dynamic>{};
data['bytes'] = bytes;
data['hr'] = hr;
data['hrList'] = hrList;
data['hrSize'] = hrSize;
data['pvcs'] = pvcs;
data['qrs'] = qrs;
data['qt'] = qt;
data['qtc'] = qtc;
data['result'] = result;
data['st'] = st;
data['total'] = total;
data['waveIntSize'] = waveIntSize;
data['waveList'] = waveList;
data['waveSize'] = waveSize;
data['waveViewSize'] = waveViewSize;
return data;
}
}

@ -4,21 +4,25 @@ class CheckMeGlucoseModel {
String note;
String timeString;
CheckMeGlucoseModel({this.date, this.glu, this.note, this.timeString});
CheckMeGlucoseModel({
required this.date,
required this.glu,
required this.note,
required this.timeString,
});
CheckMeGlucoseModel.fromJson(Map<String, dynamic> json) {
date = json['date'];
glu = json['glu'];
note = json['note'];
timeString = json['timeString'];
}
CheckMeGlucoseModel.fromJson(Map<String, dynamic> json)
: date = json['date'],
glu = json['glu'].toDouble(),
note = json['note'],
timeString = json['timeString'];
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['date'] = this.date;
data['glu'] = this.glu;
data['note'] = this.note;
data['timeString'] = this.timeString;
final Map<String, dynamic> data = <String, dynamic>{};
data['date'] = date;
data['glu'] = glu;
data['note'] = note;
data['timeString'] = timeString;
return data;
}
}

@ -1,36 +1,40 @@
class CheckMeOxiModel {
String date;
int face;
int oxy;
num pi;
int pr;
String timeString;
int way;
String? date;
int? face;
int? oxy;
num? pi;
int? pr;
String? timeString;
int? way;
CheckMeOxiModel({this.date, this.face, this.oxy, this.pi, this.pr, this.timeString, this.way});
CheckMeOxiModel({
this.date,
this.face,
this.oxy,
this.pi,
this.pr,
this.timeString,
this.way,
});
CheckMeOxiModel.fromJson(Map<String, dynamic> json) {
date = json['date'];
face = json['face'];
oxy = json['oxy'];
pi = json['pi'];
pr = json['pr'];
timeString = json['timeString'];
way = json['way'];
}
CheckMeOxiModel.fromJson(Map<String, dynamic> json)
: date = json['date'],
face = json['face'],
oxy = json['oxy'],
pi = json['pi'],
pr = json['pr'],
timeString = json['timeString'],
way = json['way'];
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['date'] = this.date;
data['face'] = this.face;
data['oxy'] = this.oxy;
data['pi'] = this.pi;
data['pr'] = this.pr;
data['timeString'] = this.timeString;
data['way'] = this.way;
final Map<String, dynamic> data = <String, dynamic>{};
data['date'] = date;
data['face'] = face;
data['oxy'] = oxy;
data['pi'] = pi;
data['pr'] = pr;
data['timeString'] = timeString;
data['way'] = way;
return data;
}
}

@ -5,25 +5,28 @@ class CheckMeTemperatureModel {
double tmp;
int way;
CheckMeTemperatureModel({this.date, this.face, this.timeString, this.tmp, this.way});
CheckMeTemperatureModel({
required this.date,
required this.face,
required this.timeString,
required this.tmp,
required this.way,
});
CheckMeTemperatureModel.fromJson(Map<String, dynamic> json) {
date = json['date'];
face = json['face'];
timeString = json['timeString'];
tmp = json['tmp'];
way = json['way'];
}
CheckMeTemperatureModel.fromJson(Map<String, dynamic> json)
: date = json['date'],
face = json['face'],
timeString = json['timeString'],
tmp = json['tmp'].toDouble(),
way = json['way'];
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['date'] = this.date;
data['face'] = this.face;
data['timeString'] = this.timeString;
data['tmp'] = this.tmp;
data['way'] = this.way;
final Map<String, dynamic> data = <String, dynamic>{};
data['date'] = date;
data['face'] = face;
data['timeString'] = timeString;
data['tmp'] = tmp;
data['way'] = way;
return data;
}
}

@ -1,36 +1,44 @@
class CheckMeUserInfoModel {
String birthday;
int color;
int height;
int ico;
String id;
String name;
int sex;
int weight;
String? birthday;
int? color;
int? height;
int? ico;
String? id;
String? name;
int? sex;
int? weight;
CheckMeUserInfoModel({this.birthday, this.color, this.height, this.ico, this.id, this.name, this.sex, this.weight});
CheckMeUserInfoModel({
this.birthday,
this.color,
this.height,
this.ico,
this.id,
this.name,
this.sex,
this.weight,
});
CheckMeUserInfoModel.fromJson(Map<String, dynamic> json) {
birthday = json['birthday'];
color = json['color'];
height = json['height'];
ico = json['ico'];
id = json['id'];
name = json['name'];
sex = json['sex'];
weight = json['weight'];
}
CheckMeUserInfoModel.fromJson(Map<String, dynamic> json)
: birthday = json['birthday'],
color = json['color'],
height = json['height'],
ico = json['ico'],
id = json['id'],
name = json['name'],
sex = json['sex'],
weight = json['weight'];
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['birthday'] = this.birthday;
data['color'] = this.color;
data['height'] = this.height;
data['ico'] = this.ico;
data['id'] = this.id;
data['name'] = this.name;
data['sex'] = this.sex;
data['weight'] = this.weight;
final Map<String, dynamic> data = <String, dynamic>{};
data['birthday'] = birthday;
data['color'] = color;
data['height'] = height;
data['ico'] = ico;
data['id'] = id;
data['name'] = name;
data['sex'] = sex;
data['weight'] = weight;
return data;
}
}

@ -1,7 +1,6 @@
//TEMPERATURE
import 'package:diplomaticquarterapp/pages/medical/my_trackers/my_trackers_view_model/my_trackers_view_model.dart';
String getValueKeyBySmartRingOperation(SmartRingOperationsEnum smartRingOperationsEnum) {
switch (smartRingOperationsEnum) {
case SmartRingOperationsEnum.Temperature:
@ -11,31 +10,34 @@ String getValueKeyBySmartRingOperation(SmartRingOperationsEnum smartRingOperatio
case SmartRingOperationsEnum.RealTimeHeartRate:
return "arrayDynamicHR";
case SmartRingOperationsEnum.HRV:
break;
return "HRV"; // Return a default value for this case
case SmartRingOperationsEnum.BloodOxygen:
return "Blood_oxygen";
case SmartRingOperationsEnum.BatteryLevel:
return "batteryLevel";
default:
return "batteryLevel"; // Default case
}
return "batteryLevel";
}
class SmartRingGenericModel {
DateTime date;
String value;
SmartRingGenericModel({this.date, this.value});
SmartRingGenericModel({
required this.date,
required this.value,
});
SmartRingGenericModel.fromJson(Map<String, dynamic> json, SmartRingOperationsEnum smartRingOperationsEnum) {
date = json['date'] != null ? DateTime.parse(((json["date"] as String).replaceAll(".", "-"))) : DateTime.now();
value = json['${getValueKeyBySmartRingOperation(smartRingOperationsEnum)}'];
}
SmartRingGenericModel.fromJson(Map<String, dynamic> json, SmartRingOperationsEnum smartRingOperationsEnum)
: date = DateTime.parse(json['date'] ?? ''),
value = json[getValueKeyBySmartRingOperation(smartRingOperationsEnum)] ?? '';
Map<String, dynamic> toJson(SmartRingOperationsEnum smartRingOperationsEnum) {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['date'] = this.date;
data['${getValueKeyBySmartRingOperation(smartRingOperationsEnum)}'] = this.value;
return data;
return {
'date': date.toString(),
getValueKeyBySmartRingOperation(smartRingOperationsEnum): value,
};
}
}
@ -48,28 +50,35 @@ class SmartRingStepCountModel {
String calories;
String exerciseMinutes;
SmartRingStepCountModel({this.date, this.goal, this.distance, this.step, this.exerciseTime, this.calories, this.exerciseMinutes});
SmartRingStepCountModel.fromJson(Map<String, dynamic> json) {
date = json['date'];
goal = json['goal'];
distance = json['distance'];
step = json['step'];
exerciseTime = json['ExerciseTime'];
calories = json['calories'];
exerciseMinutes = json['exerciseMinutes'];
}
SmartRingStepCountModel({
required this.date,
required this.goal,
required this.distance,
required this.step,
required this.exerciseTime,
required this.calories,
required this.exerciseMinutes,
});
SmartRingStepCountModel.fromJson(Map<String, dynamic> json)
: date = json['date'] ?? '',
goal = json['goal'] ?? '',
distance = json['distance'] ?? '',
step = json['step'] ?? '',
exerciseTime = json['ExerciseTime'] ?? '',
calories = json['calories'] ?? '',
exerciseMinutes = json['exerciseMinutes'] ?? '';
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['date'] = this.date;
data['goal'] = this.goal;
data['distance'] = this.distance;
data['step'] = this.step;
data['ExerciseTime'] = this.exerciseTime;
data['calories'] = this.calories;
data['exerciseMinutes'] = this.exerciseMinutes;
return data;
return {
'date': date,
'goal': goal,
'distance': distance,
'step': step,
'ExerciseTime': exerciseTime,
'calories': calories,
'exerciseMinutes': exerciseMinutes,
};
}
}
@ -82,52 +91,63 @@ class SmartRingHrvModel {
String hrv;
String vascularAging;
SmartRingHrvModel({this.date, this.highBP, this.stress, this.lowBP, this.heartRate, this.hrv, this.vascularAging});
SmartRingHrvModel.fromJson(Map<String, dynamic> json) {
date = json['date'];
highBP = json['highBP'];
stress = json['stress'];
lowBP = json['lowBP'];
heartRate = json['heartRate'];
hrv = json['hrv'];
vascularAging = json['vascularAging'];
}
SmartRingHrvModel({
required this.date,
required this.highBP,
required this.stress,
required this.lowBP,
required this.heartRate,
required this.hrv,
required this.vascularAging,
});
SmartRingHrvModel.fromJson(Map<String, dynamic> json)
: date = json['date'] ?? '',
highBP = json['highBP'] ?? '',
stress = json['stress'] ?? '',
lowBP = json['lowBP'] ?? '',
heartRate = json['heartRate'] ?? '',
hrv = json['hrv'] ?? '',
vascularAging = json['vascularAging'] ?? '';
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['date'] = this.date;
data['highBP'] = this.highBP;
data['stress'] = this.stress;
data['lowBP'] = this.lowBP;
data['heartRate'] = this.heartRate;
data['hrv'] = this.hrv;
data['vascularAging'] = this.vascularAging;
return data;
return {
'date': date,
'highBP': highBP,
'stress': stress,
'lowBP': lowBP,
'heartRate': heartRate,
'hrv': hrv,
'vascularAging': vascularAging,
};
}
}
class RtSportDataSmartRingModel {
String heartRate;
String step;
String exerciseTime;
String calories;
RtSportDataSmartRingModel({this.heartRate, this.step, this.exerciseTime, this.calories});
RtSportDataSmartRingModel.fromJson(Map<String, dynamic> json) {
heartRate = json['heartRate'];
step = json['step'];
exerciseTime = json['ExerciseTime'];
calories = json['calories'];
}
String? heartRate;
String? step;
String? exerciseTime;
String? calories;
RtSportDataSmartRingModel({
this.heartRate,
this.step,
this.exerciseTime,
this.calories,
});
RtSportDataSmartRingModel.fromJson(Map<String, dynamic> json)
: heartRate = json['heartRate'],
step = json['step'],
exerciseTime = json['ExerciseTime'],
calories = json['calories'];
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['heartRate'] = this.heartRate;
data['step'] = this.step;
data['ExerciseTime'] = this.exerciseTime;
data['calories'] = this.calories;
return data;
return {
'heartRate': heartRate,
'step': step,
'ExerciseTime': exerciseTime,
'calories': calories,
};
}
}

@ -1,38 +1,37 @@
class BpRtMeasuringModel {
bool deflate;
int pr;
int pressure;
bool pulse;
bool? deflate;
int? pr;
int? pressure;
bool? pulse;
BpRtMeasuringModel({this.deflate, this.pr, this.pressure, this.pulse});
BpRtMeasuringModel.fromJson(Map<String, dynamic> json) {
deflate = json['deflate'];
pr = json['pr'];
pressure = json['pressure'];
pulse = json['pulse'];
}
BpRtMeasuringModel.fromJson(Map<String, dynamic> json)
: deflate = json['deflate'],
pr = json['pr'],
pressure = json['pressure'],
pulse = json['pulse'];
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['deflate'] = this.deflate;
data['pr'] = this.pr;
data['pressure'] = this.pressure;
data['pulse'] = this.pulse;
final Map<String, dynamic> data = <String, dynamic>{};
data['deflate'] = deflate;
data['pr'] = pr;
data['pressure'] = pressure;
data['pulse'] = pulse;
return data;
}
}
class BpRtResultModel {
bool deflate;
int dia;
int mean;
int pr;
int pressure;
int result;
int sys;
bool isBpHigh;
bool isPulseHigh;
bool? deflate;
int? dia;
int? mean;
int? pr;
int? pressure;
int? result;
int? sys;
bool? isBpHigh;
bool? isPulseHigh;
BpRtResultModel({
this.deflate,
@ -46,98 +45,96 @@ class BpRtResultModel {
this.isPulseHigh,
});
BpRtResultModel.fromJson(Map<String, dynamic> json) {
deflate = json['deflate'];
dia = json['dia'];
mean = json['mean'];
pr = json['pr'];
pressure = json['pressure'];
result = json['result'];
sys = json['sys'];
isBpHigh = false;
isPulseHigh = false;
}
BpRtResultModel.fromJson(Map<String, dynamic> json)
: deflate = json['deflate'],
dia = json['dia'],
mean = json['mean'],
pr = json['pr'],
pressure = json['pressure'],
result = json['result'],
sys = json['sys'],
isBpHigh = false,
isPulseHigh = false;
}
class ECGRtMeasuringModelFromBP {
int curDuration;
int hr;
bool leadOff;
bool poolSignal;
int? curDuration;
int? hr;
bool? leadOff;
bool? poolSignal;
ECGRtMeasuringModelFromBP({this.curDuration, this.hr, this.leadOff, this.poolSignal});
ECGRtMeasuringModelFromBP.fromJson(Map<String, dynamic> json) {
curDuration = json['curDuration'];
hr = json['hr'];
leadOff = json['leadOff'];
poolSignal = json['poolSignal'];
}
ECGRtMeasuringModelFromBP.fromJson(Map<String, dynamic> json)
: curDuration = json['curDuration'],
hr = json['hr'],
leadOff = json['leadOff'],
poolSignal = json['poolSignal'];
}
class ECGRtResultModelFromBP {
Diagnosis diagnosis;
int hr;
int pvcs;
int qrs;
int qtc;
int result;
Diagnosis? diagnosis;
int? hr;
int? pvcs;
int? qrs;
int? qtc;
int? result;
ECGRtResultModelFromBP({this.diagnosis, this.hr, this.pvcs, this.qrs, this.qtc, this.result});
ECGRtResultModelFromBP.fromJson(Map<String, dynamic> json) {
diagnosis = json['diagnosis'] != null ? new Diagnosis.fromJson(json['diagnosis']) : null;
hr = json['hr'];
pvcs = json['pvcs'];
qrs = json['qrs'];
qtc = json['qtc'];
result = json['result'];
}
ECGRtResultModelFromBP.fromJson(Map<String, dynamic> json)
: diagnosis = json['diagnosis'] != null ? Diagnosis.fromJson(json['diagnosis']) : null,
hr = json['hr'],
pvcs = json['pvcs'],
qrs = json['qrs'],
qtc = json['qtc'],
result = json['result'];
}
class Diagnosis {
List<int> bytes;
bool isFastHr;
bool isFibrillation;
bool isHeartPause;
bool isIrregular;
bool isLeadOff;
bool isPoorSignal;
bool isProlongedQtc;
bool isPvcs;
bool isRegular;
bool isShortQtc;
bool isSlowHr;
bool isWideQrs;
Diagnosis(
{this.bytes,
this.isFastHr,
this.isFibrillation,
this.isHeartPause,
this.isIrregular,
this.isLeadOff,
this.isPoorSignal,
this.isProlongedQtc,
this.isPvcs,
this.isRegular,
this.isShortQtc,
this.isSlowHr,
this.isWideQrs});
Diagnosis.fromJson(Map<String, dynamic> json) {
bytes = json['bytes'].cast<int>();
isFastHr = json['isFastHr'];
isFibrillation = json['isFibrillation'];
isHeartPause = json['isHeartPause'];
isIrregular = json['isIrregular'];
isLeadOff = json['isLeadOff'];
isPoorSignal = json['isPoorSignal'];
isProlongedQtc = json['isProlongedQtc'];
isPvcs = json['isPvcs'];
isRegular = json['isRegular'];
isShortQtc = json['isShortQtc'];
isSlowHr = json['isSlowHr'];
isWideQrs = json['isWideQrs'];
}
}
List<int>? bytes;
bool? isFastHr;
bool? isFibrillation;
bool? isHeartPause;
bool? isIrregular;
bool? isLeadOff;
bool? isPoorSignal;
bool? isProlongedQtc;
bool? isPvcs;
bool? isRegular;
bool? isShortQtc;
bool? isSlowHr;
bool? isWideQrs;
Diagnosis({
this.bytes,
this.isFastHr,
this.isFibrillation,
this.isHeartPause,
this.isIrregular,
this.isLeadOff,
this.isPoorSignal,
this.isProlongedQtc,
this.isPvcs,
this.isRegular,
this.isShortQtc,
this.isSlowHr,
this.isWideQrs,
});
Diagnosis.fromJson(Map<String, dynamic> json)
: bytes = json['bytes']?.cast<int>(),
isFastHr = json['isFastHr'],
isFibrillation = json['isFibrillation'],
isHeartPause = json['isHeartPause'],
isIrregular = json['isIrregular'],
isLeadOff = json['isLeadOff'],
isPoorSignal = json['isPoorSignal'],
isProlongedQtc = json['isProlongedQtc'],
isPvcs = json['isPvcs'],
isRegular = json['isRegular'],
isShortQtc = json['isShortQtc'],
isSlowHr = json['isSlowHr'],
isWideQrs = json['isWideQrs'];
}

@ -1,25 +1,28 @@
class ECGFileDetailModel {
int duration;
String fileName;
List<int> shortData;
int startTime;
int? duration;
String? fileName;
List<int>? shortData;
int? startTime;
ECGFileDetailModel(
{this.duration, this.fileName, this.shortData, this.startTime});
ECGFileDetailModel({
this.duration,
this.fileName,
this.shortData,
this.startTime,
});
ECGFileDetailModel.fromJson(Map<String, dynamic> json) {
duration = json['duration'];
fileName = json['fileName'];
shortData = json['shortData'].cast<int>();
startTime = json['startTime'];
}
ECGFileDetailModel.fromJson(Map<String, dynamic> json)
: duration = json['duration'],
fileName = json['fileName'],
shortData = json['shortData'].cast<int>(),
startTime = json['startTime'];
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['duration'] = this.duration;
data['fileName'] = this.fileName;
data['shortData'] = this.shortData;
data['startTime'] = this.startTime;
final Map<String, dynamic> data = <String, dynamic>{};
data['duration'] = duration;
data['fileName'] = fileName;
data['shortData'] = shortData;
data['startTime'] = startTime;
return data;
}
}

@ -1,78 +1,75 @@
class ECGRtModel {
Param param;
Wave wave;
Param? param;
Wave? wave;
ECGRtModel({this.param, this.wave});
ECGRtModel.fromJson(Map<String, dynamic> json) {
param = json['param'] != null ? new Param.fromJson(json['param']) : null;
wave = json['wave'] != null ? new Wave.fromJson(json['wave']) : null;
}
ECGRtModel.fromJson(Map<String, dynamic> json)
: param = json['param'] != null ? Param.fromJson(json['param']) : null,
wave = json['wave'] != null ? Wave.fromJson(json['wave']) : null;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.param != null) {
data['param'] = this.param.toJson();
final Map<String, dynamic> data = <String, dynamic>{};
if (param != null) {
data['param'] = param!.toJson();
}
if (this.wave != null) {
data['wave'] = this.wave.toJson();
if (wave != null) {
data['wave'] = wave!.toJson();
}
return data;
}
}
class Param {
num battery;
num batteryState;
num curStatus;
num hr;
bool poorSignal;
bool rSignal;
num recordTime;
num? battery;
num? batteryState;
num? curStatus;
num? hr;
bool? poorSignal;
bool? rSignal;
num? recordTime;
Param({this.battery, this.batteryState, this.curStatus, this.hr, this.poorSignal, this.rSignal, this.recordTime});
Param.fromJson(Map<String, dynamic> json) {
battery = json['battery'];
batteryState = json['batteryState'];
curStatus = json['curStatus'];
hr = json['hr'];
poorSignal = json['poorSignal'];
rSignal = json['rSignal'];
recordTime = json['recordTime'];
}
Param.fromJson(Map<String, dynamic> json)
: battery = json['battery'],
batteryState = json['batteryState'],
curStatus = json['curStatus'],
hr = json['hr'],
poorSignal = json['poorSignal'],
rSignal = json['rSignal'],
recordTime = json['recordTime'];
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['battery'] = this.battery;
data['batteryState'] = this.batteryState;
data['curStatus'] = this.curStatus;
data['hr'] = this.hr;
data['poorSignal'] = this.poorSignal;
data['rSignal'] = this.rSignal;
data['recordTime'] = this.recordTime;
final Map<String, dynamic> data = <String, dynamic>{};
data['battery'] = battery;
data['batteryState'] = batteryState;
data['curStatus'] = curStatus;
data['hr'] = hr;
data['poorSignal'] = poorSignal;
data['rSignal'] = rSignal;
data['recordTime'] = recordTime;
return data;
}
}
class Wave {
List<int> ecgBytes;
List<num> ecgFloats;
List<num> ecgShorts;
List<int>? ecgBytes;
List<num>? ecgFloats;
List<num>? ecgShorts;
Wave({this.ecgBytes, this.ecgFloats, this.ecgShorts});
Wave.fromJson(Map<String, dynamic> json) {
ecgBytes = json['ecgBytes'].cast<int>();
ecgFloats = json['ecgFloats'].cast<double>();
ecgShorts = json['ecgShorts'].cast<int>();
}
Wave.fromJson(Map<String, dynamic> json)
: ecgBytes = json['ecgBytes']?.cast<int>(),
ecgFloats = json['ecgFloats']?.cast<double>(),
ecgShorts = json['ecgShorts']?.cast<int>();
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ecgBytes'] = this.ecgBytes;
data['ecgFloats'] = this.ecgFloats;
data['ecgShorts'] = this.ecgShorts;
final Map<String, dynamic> data = <String, dynamic>{};
data['ecgBytes'] = ecgBytes;
data['ecgFloats'] = ecgFloats;
data['ecgShorts'] = ecgShorts;
return data;
}
}

@ -1,33 +1,40 @@
class OxyRtModel {
int battery;
bool isCheckProbe;
bool isProbeOff;
bool isPulseSearching;
num pi;
int pr;
int spo2;
int? battery;
bool? isCheckProbe;
bool? isProbeOff;
bool? isPulseSearching;
num? pi;
int? pr;
int? spo2;
OxyRtModel({this.battery, this.isCheckProbe, this.isProbeOff, this.isPulseSearching, this.pi, this.pr, this.spo2});
OxyRtModel({
this.battery,
required this.isCheckProbe,
required this.isProbeOff,
required this.isPulseSearching,
required this.pi,
required this.pr,
required this.spo2,
});
OxyRtModel.fromJson(Map<String, dynamic> json) {
battery = json['battery'];
isCheckProbe = json['isCheckProbe'];
isProbeOff = json['isProbeOff'];
isPulseSearching = json['isPulseSearching'];
pi = json['pi'];
pr = json['pr'];
spo2 = json['spo2'];
}
OxyRtModel.fromJson(Map<String, dynamic> json)
: battery = json['battery'],
isCheckProbe = json['isCheckProbe'],
isProbeOff = json['isProbeOff'],
isPulseSearching = json['isPulseSearching'],
pi = json['pi'],
pr = json['pr'],
spo2 = json['spo2'];
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['battery'] = this.battery;
data['isCheckProbe'] = this.isCheckProbe;
data['isProbeOff'] = this.isProbeOff;
data['isPulseSearching'] = this.isPulseSearching;
data['pi'] = this.pi;
data['pr'] = this.pr;
data['spo2'] = this.spo2;
final Map<String, dynamic> data = <String, dynamic>{};
data['battery'] = battery;
data['isCheckProbe'] = isCheckProbe;
data['isProbeOff'] = isProbeOff;
data['isPulseSearching'] = isPulseSearching;
data['pi'] = pi;
data['pr'] = pr;
data['spo2'] = spo2;
return data;
}
}

@ -19,19 +19,19 @@ class _BloodGlucoseBLEState extends State<BloodGlucoseBLE> {
String connectionStatus = "disconnected";
String currentBloodGlucose = "0.0";
BluetoothDevice currentConnectedDevice;
BluetoothDevice? currentConnectedDevice;
StreamSubscription bleDevicesStream;
StreamSubscription bloodGlucoseValuesStream;
StreamSubscription? bleDevicesStream;
StreamSubscription? bloodGlucoseValuesStream;
bool isDataMeasured = false;
@override
void dispose() {
super.dispose();
if (bleDevicesStream != null) bleDevicesStream.cancel();
if (bloodGlucoseValuesStream != null) bloodGlucoseValuesStream.cancel();
if (currentConnectedDevice != null) currentConnectedDevice.disconnect();
if (bleDevicesStream != null) bleDevicesStream!.cancel();
if (bloodGlucoseValuesStream != null) bloodGlucoseValuesStream!.cancel();
if (currentConnectedDevice != null) currentConnectedDevice!.disconnect();
}
@override
@ -75,7 +75,7 @@ class _BloodGlucoseBLEState extends State<BloodGlucoseBLE> {
);
} else {
FlutterBluePlus.stopScan();
return SizedBox(height: 300.0, child: BluetoothOffScreen(adapterState: adapterState));
return SizedBox(height: 300.0, child: BluetoothOffScreen(adapterState: adapterState!));
}
}),
),
@ -110,7 +110,7 @@ class _BloodGlucoseBLEState extends State<BloodGlucoseBLE> {
}
if (state == BluetoothConnectionState.connected) {
currentConnectedDevice = element.device;
bleDevicesStream.cancel();
bleDevicesStream!.cancel();
List<BluetoothService> services = await element.device.discoverServices();
services.forEach((service) {
if (service.serviceUuid.toString().toLowerCase() == BLEUtils.BLOOD_GLUCOSE_SERVICE) {
@ -131,13 +131,13 @@ class _BloodGlucoseBLEState extends State<BloodGlucoseBLE> {
await characteristic.setNotifyValue(true);
}
});
return true;
return;
}
});
}
});
await element.device.connect(timeout: Duration(seconds: 35));
return true;
return;
}
}
});
@ -163,7 +163,7 @@ class _BloodGlucoseBLEState extends State<BloodGlucoseBLE> {
num measuredValue = byteArray[9];
results.add("Measured: $measuredValue");
isDataMeasured = true;
bloodGlucoseValuesStream.cancel();
bloodGlucoseValuesStream!.cancel();
}
return results;

@ -21,27 +21,27 @@ class _BloodPressureBLEState extends State<BloodPressureBLE> {
String currentBPmmHG = "0/0 mmHG";
String currentPulse = "0 PPM";
BluetoothDevice currentConnectedDevice;
BluetoothDevice? currentConnectedDevice;
StreamSubscription bloodPressureReadingStream;
StreamSubscription? bloodPressureReadingStream;
StreamSubscription bleDevicesStream;
StreamSubscription bleDeviceConnectionStream;
StreamSubscription? bleDevicesStream;
StreamSubscription? bleDeviceConnectionStream;
final bleConnectionStatus = ValueNotifier<String>("Disconnected");
Timer _timer;
Timer? _timer;
@override
void dispose() {
super.dispose();
if (bleDevicesStream != null) bleDevicesStream.cancel();
if (currentConnectedDevice != null) currentConnectedDevice.disconnect();
if (bleDevicesStream != null) bleDevicesStream!.cancel();
if (currentConnectedDevice != null) currentConnectedDevice!.disconnect();
bleConnectionStatus.dispose();
if (bleDeviceConnectionStream != null) bleDeviceConnectionStream.cancel();
if (bloodPressureReadingStream != null) bloodPressureReadingStream.cancel();
if (currentConnectedDevice != null) currentConnectedDevice.disconnect();
if (_timer != null && _timer.isActive) _timer.cancel();
if (bleDeviceConnectionStream != null) bleDeviceConnectionStream!.cancel();
if (bloodPressureReadingStream != null) bloodPressureReadingStream!.cancel();
if (currentConnectedDevice != null) currentConnectedDevice!.disconnect();
if (_timer != null && _timer!.isActive) _timer!.cancel();
}
@override
@ -89,7 +89,7 @@ class _BloodPressureBLEState extends State<BloodPressureBLE> {
);
} else {
FlutterBluePlus.stopScan();
return SizedBox(height: 300.0, child: BluetoothOffScreen(adapterState: adapterState));
return SizedBox(height: 300.0, child: BluetoothOffScreen(adapterState: adapterState!));
}
}),
),
@ -112,12 +112,12 @@ class _BloodPressureBLEState extends State<BloodPressureBLE> {
if (element.device.localName.isNotEmpty) {
log("blueToothDevices: ${element.device.localName}");
if (element.device.localName.toLowerCase() == "pm101897") {
bleDevicesStream.cancel();
bleDevicesStream!.cancel();
element.device.connect(timeout: Duration(seconds: 30), autoConnect: false).then((value) async {
bleConnectionStatus.value = "Connected...";
print("Device Connected-------");
currentConnectedDevice = element.device;
bleDeviceConnectionStream = currentConnectedDevice.connectionState.listen((event) {
bleDeviceConnectionStream = currentConnectedDevice!.connectionState.listen((event) {
if (event == BluetoothConnectionState.disconnected) {
bleConnectionStatus.value = "Disconnected...";
print("Device Disconnected-------");
@ -231,13 +231,13 @@ void startBLEConnectionII() {
await characteristic.setNotifyValue(true);
}
});
return true;
return ;
}
});
}
});
await element.device.connect(timeout: Duration(seconds: 35));
return true;
return;
}
}
});
@ -279,7 +279,7 @@ Map<String, dynamic> handleBPResult(List<int> byteArray, BluetoothCharacteristic
}
class BluetoothOffScreen extends StatelessWidget {
const BluetoothOffScreen({Key key, this.adapterState}) : super(key: key);
const BluetoothOffScreen({Key? key, required this.adapterState}) : super(key: key);
final BluetoothAdapterState adapterState;

@ -18,22 +18,22 @@ class ECG_BLE extends StatefulWidget {
class _ECG_BLEState extends State<ECG_BLE> {
String connectionStatus = "disconnected";
BluetoothDevice currentConnectedDevice;
BluetoothDevice? currentConnectedDevice;
BluetoothCharacteristic ecgWriteCharacteristic;
BluetoothCharacteristic? ecgWriteCharacteristic;
StreamSubscription bleDevicesStream;
StreamSubscription bleDeviceConnectionStream;
StreamSubscription? bleDevicesStream;
StreamSubscription? bleDeviceConnectionStream;
final bleConnectionStatus = ValueNotifier<String>("Disconnected");
@override
void dispose() {
super.dispose();
if (bleDevicesStream != null) bleDevicesStream.cancel();
if (currentConnectedDevice != null) currentConnectedDevice.disconnect();
if (bleDevicesStream != null) bleDevicesStream!.cancel();
if (currentConnectedDevice != null) currentConnectedDevice!.disconnect();
bleConnectionStatus.dispose();
if (bleDeviceConnectionStream != null) bleDeviceConnectionStream.cancel();
if (bleDeviceConnectionStream != null) bleDeviceConnectionStream!.cancel();
}
@override
@ -88,7 +88,7 @@ class _ECG_BLEState extends State<ECG_BLE> {
);
} else {
FlutterBluePlus.stopScan();
return SizedBox(height: 300.0, child: BluetoothOffScreen(adapterState: adapterState));
return SizedBox(height: 300.0, child: BluetoothOffScreen(adapterState: adapterState!));
}
}),
),
@ -111,12 +111,12 @@ class _ECG_BLEState extends State<ECG_BLE> {
if (element.device.localName.isNotEmpty) {
log("blueToothDevices: ${element.device.localName}");
if (element.device.localName.toLowerCase() == "pm101897") {
bleDevicesStream.cancel();
bleDevicesStream!.cancel();
element.device.connect(timeout: Duration(seconds: 30), autoConnect: false).then((value) async {
bleConnectionStatus.value = "Connected...";
print("Device Connected-------");
currentConnectedDevice = element.device;
bleDeviceConnectionStream = currentConnectedDevice.connectionState.listen((event) {
bleDeviceConnectionStream = currentConnectedDevice!.connectionState.listen((event) {
if (event == BluetoothConnectionState.disconnected) {
bleConnectionStatus.value = "Disconnected...";
print("Device Disconnected-------");

@ -70,7 +70,7 @@ class MyTrackersViewModel extends ChangeNotifier {
List<BleDeviceModel> devicesList = [];
var devicesInfoJsonViatom = {
Map<String, List<Map<String, String>>> devicesInfoJsonViatom = {
"OxymeterTracker": [
{"model": "SP-20"}, // DONE
{"model": "POD-1"}, // DONE
@ -106,7 +106,7 @@ class MyTrackersViewModel extends ChangeNotifier {
],
};
var devicesInfoJsonAndesfit = {
Map<String, List<Map<String, String>>> devicesInfoJsonAndesfit = {
"OxymeterTracker": [
{"model": ""}
],
@ -164,11 +164,11 @@ class MyTrackersViewModel extends ChangeNotifier {
"BLE-MSA",
];
StreamSubscription bleDevicesStream;
StreamSubscription? bleDevicesStream;
//************************************* OXYMETER *************************************
OxyRtModel oxyRtModel;
OxyRtModel? oxyRtModel;
void updateOxyRtModel(Map<String, dynamic> mapData) {
oxyRtModel = OxyRtModel.fromJson(mapData);
@ -177,21 +177,21 @@ class MyTrackersViewModel extends ChangeNotifier {
// ************************************* BLOOD PRESSURE *************************************
BpRtMeasuringModel bpRtMeasuringModel;
BpRtMeasuringModel? bpRtMeasuringModel;
void updateBpRtMeasuringModel(Map<String, dynamic> mapData) {
bpRtMeasuringModel = BpRtMeasuringModel.fromJson(mapData);
notifyListeners();
}
BpRtResultModel bpRtResultModel;
BpRtResultModel? bpRtResultModel;
void updateBpRtResultModel(Map<String, dynamic> mapData) {
bpRtResultModel = BpRtResultModel.fromJson(mapData);
notifyListeners();
}
String bpCurrentStatus;
String? bpCurrentStatus;
updateBpCurrentStatus(var value) {
bpCurrentStatus = value;
@ -213,7 +213,7 @@ class MyTrackersViewModel extends ChangeNotifier {
filesLoader = value;
}
ECGRtModel ecgRtModel;
ECGRtModel? ecgRtModel;
void updateEcgRtModel(Map<String, dynamic> mapData) {
ecgRtModel = ECGRtModel.fromJson(mapData);
@ -242,21 +242,21 @@ class MyTrackersViewModel extends ChangeNotifier {
notifyListeners();
}
String ecgCurrentStatus;
String? ecgCurrentStatus;
updateEcgCurrentStatus(var value) {
ecgCurrentStatus = value;
notifyListeners();
}
ECGRtMeasuringModelFromBP ecgRtMeasuringModelFromBP;
ECGRtMeasuringModelFromBP? ecgRtMeasuringModelFromBP;
void updateEcgRtMeasuringModelFromBP(Map<String, dynamic> mapData) {
ecgRtMeasuringModelFromBP = ECGRtMeasuringModelFromBP.fromJson(mapData);
notifyListeners();
}
ECGRtResultModelFromBP ecgRtResultModelFromBP;
ECGRtResultModelFromBP? ecgRtResultModelFromBP;
void updateEcgRtResultModelFromBP(Map<String, dynamic> mapData) {
ecgRtResultModelFromBP = ECGRtResultModelFromBP.fromJson(mapData);
@ -282,11 +282,11 @@ class MyTrackersViewModel extends ChangeNotifier {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(ecgFileDetailModel.fileName),
Text(ecgFileDetailModel.fileName!),
mHeight(6.0),
Text("Duration: ${ecgFileDetailModel.duration} seconds"),
mHeight(6.0),
Text("Date: ${DateUtil.getDayMonthYearHourMinuteDateFormatted(DateTime.fromMillisecondsSinceEpoch((ecgFileDetailModel.startTime * 1000)))}"),
Text("Date: ${DateUtil.getDayMonthYearHourMinuteDateFormatted(DateTime.fromMillisecondsSinceEpoch((ecgFileDetailModel.startTime! * 1000)))}"),
],
),
),
@ -303,12 +303,12 @@ class MyTrackersViewModel extends ChangeNotifier {
if (devicesInfoJsonViatom.containsKey(currentSelectedTrackerType.name)) {
allDevices.forEach(
(foundDevice) {
List devicesInSelectedType = devicesInfoJsonViatom[currentSelectedTrackerType.name];
for (var device in devicesInSelectedType) {
List<Map<String, String>>? devicesInSelectedType = devicesInfoJsonViatom[currentSelectedTrackerType.name];
for (var device in devicesInSelectedType!) {
// log("foundDevice.name: ${foundDevice.name.toString()}");
foundDevice.deviceType = currentSelectedTrackerType;
// log("device['model']: ${device['model']}");
if (device['model'] != "" && foundDevice.name.contains(device['model'])) {
if (device['model'] != "" && foundDevice.name!.contains((device['model'])!)) {
devicesList.add(foundDevice);
}
}
@ -320,7 +320,7 @@ class MyTrackersViewModel extends ChangeNotifier {
void filterOutTheSearchedDevicesFlutter(List<BleDeviceModel> allDevices) {
if (devicesInfoJsonAndesfit.containsKey(currentSelectedTrackerType.name)) {
List devicesInSelectedType = devicesInfoJsonAndesfit[currentSelectedTrackerType.name];
List<Map<String, String>> devicesInSelectedType = (devicesInfoJsonAndesfit[currentSelectedTrackerType.name])!;
for (var foundDevice in allDevices) {
for (var device in devicesInSelectedType) {
if (isDeviceSelected) {
@ -330,7 +330,7 @@ class MyTrackersViewModel extends ChangeNotifier {
foundDevice.deviceType = currentSelectedTrackerType;
log("here1: ${device['model']}");
log("here2: ${foundDevice.name}");
if (device['model'] != "" && foundDevice.name.contains(device['model'])) {
if (device['model'] != "" && foundDevice.name!.contains(device['model'] as String)) {
if (!ifDeviceAlreadyThere(devicesList, foundDevice)) {
devicesList.add(foundDevice);
notifyListeners();
@ -427,27 +427,27 @@ class MyTrackersViewModel extends ChangeNotifier {
void resetList() {
devicesList.clear();
if (bleDevicesStream != null) {
bleDevicesStream.cancel();
bleDevicesStream!.cancel();
}
FlutterBluePlus.stopScan();
secondsToWaitForNativeScan = 5;
}
Future<void> getEcgFilesList(BleDeviceModel device) async {
await BleChannel.getECGFilesList([device.name, device.model.toString()]);
await BleChannel.getECGFilesList([device.name!, device.model.toString()]);
}
Future<void> factoryResetECG(BleDeviceModel device) async {
await BleChannel.factoryResetECG([device.name, device.model.toString()]);
await BleChannel.factoryResetECG([device.name!, device.model.toString()]);
}
Future<void> connectDevice(BleDeviceModel device) async {
if (currentSelectedTrackerType == TrackerTypeEnum.AllInOneTracker) {
await BleChannel.connectDeviceCheckMe([device.name, device.model.toString(), currentSelectedTrackerType.name]);
await BleChannel.connectDeviceCheckMe([device.name!, device.model.toString(), currentSelectedTrackerType.name]);
} else if (currentSelectedTrackerType == TrackerTypeEnum.SmartRing) {
await BleChannel.connectDeviceSmartRing(device.macAddr);
await BleChannel.connectDeviceSmartRing(device.macAddr!);
} else {
await BleChannel.connectDevice([device.name, device.model.toString(), currentSelectedTrackerType.name]);
await BleChannel.connectDevice([device.name!, device.model.toString(), currentSelectedTrackerType.name]);
}
}
@ -474,8 +474,8 @@ class MyTrackersViewModel extends ChangeNotifier {
bleDevicesStream = FlutterBluePlus.scanResults.listen((results) {
List<ScanResult> blueToothDevices = results;
List<BleDeviceModel> bleDevices = [];
if (isAndesfitDeviceConnected != null && isAndesfitDeviceConnected) {
bleDevicesStream.cancel();
if (isAndesfitDeviceConnected != null && isAndesfitDeviceConnected!) {
bleDevicesStream!.cancel();
FlutterBluePlus.stopScan();
return;
}
@ -499,7 +499,7 @@ class MyTrackersViewModel extends ChangeNotifier {
}
bool ifDeviceAlreadyThere(List<BleDeviceModel> devicesList, BleDeviceModel device) {
int index = devicesList.indexWhere((element) => element.name.toLowerCase() == device.name.toLowerCase());
int index = devicesList.indexWhere((element) => element.name!.toLowerCase() == device.name!.toLowerCase());
return index != -1;
}
@ -547,7 +547,7 @@ class MyTrackersViewModel extends ChangeNotifier {
// *********************** ANDESFIT ************************
bool isAndesfitDeviceConnected;
bool? isAndesfitDeviceConnected;
Future<void> connectAndesfitBloodPressureDevice(BluetoothDevice device) async {
device.connectionState.listen((BluetoothConnectionState state) async {
@ -558,7 +558,7 @@ class MyTrackersViewModel extends ChangeNotifier {
if (state == BluetoothConnectionState.connected) {
isAndesfitDeviceConnected = true;
notifyListeners();
bleDevicesStream.cancel();
bleDevicesStream!.cancel();
List<BluetoothService> services = await device.discoverServices();
services.forEach((service) {
if (service.serviceUuid.toString().toLowerCase() == BLEUtils.BLOOD_PRESSURE_SERVICE) {
@ -588,28 +588,28 @@ class MyTrackersViewModel extends ChangeNotifier {
device.disconnect();
}
ScanResult selectedAndesFitScanResult;
ScanResult? selectedAndesFitScanResult;
updateSelectedAndesFitScanResult(var value) {
selectedAndesFitScanResult = value;
notifyListeners();
}
BpRtMeasuringModel andesfitBpRtMeasuringModel;
BpRtMeasuringModel? andesfitBpRtMeasuringModel;
void updateAndesfitBpRtMeasuringModel(BpRtMeasuringModel model) {
andesfitBpRtMeasuringModel = model;
notifyListeners();
}
BpRtResultModel andesfitBpRtResultModel;
BpRtResultModel? andesfitBpRtResultModel;
void updateAndesfitBpRtResultModel(BpRtResultModel model) {
andesfitBpRtResultModel = model;
notifyListeners();
}
String andesfitBpCurrentStatus;
String? andesfitBpCurrentStatus;
updateAndesfitBpCurrentStatus(var value) {
andesfitBpCurrentStatus = value;
@ -668,7 +668,7 @@ class MyTrackersViewModel extends ChangeNotifier {
}
}
WeightScaleData andesfitWeightScaleData;
WeightScaleData? andesfitWeightScaleData;
void updateAndesfitWeightScaleData(WeightScaleData model) {
andesfitWeightScaleData = model;
@ -689,7 +689,7 @@ class MyTrackersViewModel extends ChangeNotifier {
if (state == BluetoothConnectionState.connected) {
isAndesfitDeviceConnected = true;
notifyListeners();
bleDevicesStream.cancel();
bleDevicesStream!.cancel();
List<BluetoothService> services = await device.discoverServices();
services.forEach((service) {
log("services in weightscale: ${service.serviceUuid}");
@ -733,7 +733,7 @@ class MyTrackersViewModel extends ChangeNotifier {
});
await Future.delayed(Duration(milliseconds: 500)).then((value) async {
print("Delayed fff1 done");
if (!characteristic.isNotifying) await characteristic.setNotifyValue(true).catchError((err) {});
if (!characteristic.isNotifying) await characteristic.setNotifyValue(true);
});
}
@ -747,7 +747,7 @@ class MyTrackersViewModel extends ChangeNotifier {
await Future.delayed(Duration(milliseconds: 1000)).then((value) async {
print("Delayed fff2 done");
if (!characteristic.isNotifying) await characteristic.setNotifyValue(true).catchError((err) {});
if (!characteristic.isNotifying) await characteristic.setNotifyValue(true);
});
// Write user data to fff2
@ -846,7 +846,7 @@ class MyTrackersViewModel extends ChangeNotifier {
return resSet;
}
String currentTempInCelsius;
String? currentTempInCelsius;
updateCurrentTempInCelsius(var value) {
currentTempInCelsius = value;
@ -862,7 +862,7 @@ class MyTrackersViewModel extends ChangeNotifier {
if (state == BluetoothConnectionState.connected) {
isAndesfitDeviceConnected = true;
notifyListeners();
bleDevicesStream.cancel();
bleDevicesStream!.cancel();
List<BluetoothService> services = await device.discoverServices();
services.forEach((service) {
if (service.serviceUuid.toString().toLowerCase() == BLEUtils.TEMPERATURE_SERVICE) {
@ -874,14 +874,14 @@ class MyTrackersViewModel extends ChangeNotifier {
print("onValueReceived Stream");
print(event);
updateCurrentTempInCelsius(convertIntListToHexTemp(event));
String currentTempInFahrenheit = ((num.parse(currentTempInCelsius) * 1.8) + 32).toStringAsFixed(1);
String tempCurrentTempInCelsius = currentTempInCelsius + "\u2103" + " / " + currentTempInFahrenheit + "\u2109";
String currentTempInFahrenheit = ((num.parse(currentTempInCelsius!) * 1.8) + 32).toStringAsFixed(1);
String tempCurrentTempInCelsius = currentTempInCelsius! + "\u2103" + " / " + currentTempInFahrenheit + "\u2109";
updateCurrentTempInCelsius(tempCurrentTempInCelsius);
});
await characteristic.setNotifyValue(true);
}
});
return true;
return;
}
});
}
@ -917,9 +917,9 @@ class MyTrackersViewModel extends ChangeNotifier {
// return (number * 0.1).toStringAsFixed(1);
// }
StreamSubscription bloodSugarValuesStream;
StreamSubscription? bloodSugarValuesStream;
String currentBloodGlucose;
String? currentBloodGlucose;
updateCurrentBloodGlucose(var value) {
currentBloodGlucose = value;
@ -937,7 +937,7 @@ class MyTrackersViewModel extends ChangeNotifier {
if (state == BluetoothConnectionState.connected) {
isAndesfitDeviceConnected = true;
notifyListeners();
bleDevicesStream.cancel();
bleDevicesStream!.cancel();
List<BluetoothService> services = await device.discoverServices();
services.forEach((service) {
if (service.serviceUuid.toString().toLowerCase() == BLEUtils.BLOOD_GLUCOSE_SERVICE) {
@ -954,7 +954,7 @@ class MyTrackersViewModel extends ChangeNotifier {
await characteristic.setNotifyValue(true);
}
});
return true;
return;
}
});
}
@ -976,20 +976,20 @@ class MyTrackersViewModel extends ChangeNotifier {
num measuredValue = byteArray[9];
results.add("Measured: $measuredValue");
isDataMeasured = true;
bloodSugarValuesStream.cancel();
bloodSugarValuesStream!.cancel();
}
return results;
}
BluetoothCharacteristic spirometerReadCharacteristicFf0a;
BluetoothCharacteristic spirometerWriteCharacteristicFf0b;
BluetoothCharacteristic? spirometerReadCharacteristicFf0a;
BluetoothCharacteristic? spirometerWriteCharacteristicFf0b;
String valuePEF;
String? valuePEF;
String valueFEV;
String? valueFEV;
Timer timerForSpirometer;
Timer? timerForSpirometer;
bool isHistoryCommandWritten = false;
@ -1002,7 +1002,7 @@ class MyTrackersViewModel extends ChangeNotifier {
if (state == BluetoothConnectionState.connected) {
isAndesfitDeviceConnected = true;
notifyListeners();
bleDevicesStream.cancel();
bleDevicesStream!.cancel();
List<BluetoothService> services = await device.discoverServices(timeout: 5);
services.forEach(
(service) {
@ -1012,9 +1012,9 @@ class MyTrackersViewModel extends ChangeNotifier {
(characteristic) async {
if (characteristic.characteristicUuid.toString().toLowerCase() == BLEUtils.BLE_TO_MSA100_READ_CHARACTERISTIC) {
spirometerReadCharacteristicFf0a = characteristic;
print(spirometerReadCharacteristicFf0a.characteristicUuid);
print(spirometerReadCharacteristicFf0a.properties.toString());
spirometerReadCharacteristicFf0a.onValueReceived.listen((event) async {
print(spirometerReadCharacteristicFf0a!.characteristicUuid);
print(spirometerReadCharacteristicFf0a!.properties.toString());
spirometerReadCharacteristicFf0a!.onValueReceived.listen((event) async {
print("onValueReceived ff0a Stream");
print(event);
@ -1024,12 +1024,12 @@ class MyTrackersViewModel extends ChangeNotifier {
}
if (event[0] == 170) {
timerForSpirometer.cancel();
timerForSpirometer!.cancel();
// Write get history command to ff0b
if (!isHistoryCommandWritten) {
await Future.delayed(Duration(milliseconds: 1000)).then((value) async {
spirometerWriteCharacteristicFf0b.write([0x55, 0x01], withoutResponse: false).then((value) {
spirometerWriteCharacteristicFf0b!.write([0x55, 0x01], withoutResponse: false).then((value) {
print("----ff0b get history command data written----");
isHistoryCommandWritten = true;
});
@ -1037,13 +1037,13 @@ class MyTrackersViewModel extends ChangeNotifier {
// Write get 1st history command to ff0b
await Future.delayed(Duration(milliseconds: 1000)).then((value) async {
spirometerWriteCharacteristicFf0b.write([0x55, 0x02, 0x01, 0x00], withoutResponse: false).then((value) async {
spirometerWriteCharacteristicFf0b!.write([0x55, 0x02, 0x01, 0x00], withoutResponse: false).then((value) async {
print("----ff0b get 1st history command data written----");
isHistoryCommandWritten = true;
// Write delete history command to ff0b
await Future.delayed(Duration(milliseconds: 1000)).then((value) async {
spirometerWriteCharacteristicFf0b.write([0x55, 0x03], withoutResponse: false).then((value) async {
spirometerWriteCharacteristicFf0b!.write([0x55, 0x03], withoutResponse: false).then((value) async {
print("----ff0b delete history command data written----");
isHistoryCommandWritten = true;
await Future.delayed(Duration(milliseconds: 500)).then((value) async {
@ -1061,14 +1061,14 @@ class MyTrackersViewModel extends ChangeNotifier {
await Future.delayed(Duration(milliseconds: 1000)).then((value) async {
print("Delayed ff0a done");
if (!spirometerReadCharacteristicFf0a.isNotifying) await spirometerReadCharacteristicFf0a.setNotifyValue(true).catchError((err) {});
if (!spirometerReadCharacteristicFf0a!.isNotifying) await spirometerReadCharacteristicFf0a!.setNotifyValue(true);
});
}
if (characteristic.characteristicUuid.toString().toLowerCase() == BLEUtils.BLE_TO_MSA100_WRITE_CHARACTERISTIC) {
spirometerWriteCharacteristicFf0b = characteristic;
print(spirometerWriteCharacteristicFf0b.characteristicUuid);
print(spirometerWriteCharacteristicFf0b.properties.toString());
print(spirometerWriteCharacteristicFf0b!.characteristicUuid);
print(spirometerWriteCharacteristicFf0b!.properties.toString());
// Write ACK command to ff0b every 500 ms
startACKCommandToMSA100();
@ -1109,7 +1109,7 @@ class MyTrackersViewModel extends ChangeNotifier {
// Write ACK command to ff0b every 500 ms
await Future.delayed(Duration(milliseconds: 1000)).then((value) async {
timerForSpirometer = Timer.periodic(Duration(milliseconds: 500), (Timer t) {
spirometerWriteCharacteristicFf0b.write([0x55, 0x06], withoutResponse: false).then((value) {
spirometerWriteCharacteristicFf0b!.write([0x55, 0x06], withoutResponse: false).then((value) {
print("----ff0b ACK command data written----");
});
});
@ -1172,11 +1172,11 @@ class MyTrackersViewModel extends ChangeNotifier {
await scanForCheckMe();
}
List<CheckMeUserInfoModel> checkMeProUsersList;
List<CheckMeUserInfoModel>? checkMeProUsersList;
void updateCheckMeUserInfoModel(List returnData) {
if (checkMeProUsersList != null) {
checkMeProUsersList.clear();
checkMeProUsersList!.clear();
}
if (Platform.isIOS) {
checkMeProUsersList = List.generate(returnData.length, (index) => CheckMeUserInfoModel.fromJson(returnData[index]));
@ -1195,7 +1195,7 @@ class MyTrackersViewModel extends ChangeNotifier {
padding: const EdgeInsets.all(20),
margin: const EdgeInsets.symmetric(vertical: 35, horizontal: 30),
child: SingleChildScrollView(
child: Consumer(builder: (BuildContext context, MyTrackersViewModel myTrackersVm, Widget child) {
child: Consumer(builder: (BuildContext context, MyTrackersViewModel myTrackersVm, Widget? child) {
return Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
@ -1205,7 +1205,7 @@ class MyTrackersViewModel extends ChangeNotifier {
child: Text(
"Users List",
style: TextStyle(
fontSize: SizeConfig.textMultiplier * 1.8,
fontSize: SizeConfig.textMultiplier! * 1.8,
fontWeight: FontWeight.w600,
letterSpacing: -0.3,
height: 13 / 10,
@ -1215,23 +1215,23 @@ class MyTrackersViewModel extends ChangeNotifier {
),
if (myTrackersVm.filesLoader) ...[
Center(child: CircularProgressIndicator())
] else if (myTrackersVm.checkMeProUsersList != null && myTrackersVm.checkMeProUsersList.isNotEmpty) ...[
] else if (myTrackersVm.checkMeProUsersList != null && myTrackersVm.checkMeProUsersList!.isNotEmpty) ...[
Material(
child: SizedBox(
height: MediaQuery.of(context).size.height * 0.7,
child: ListView.separated(
itemCount: checkMeProUsersList.length,
itemCount: checkMeProUsersList!.length,
separatorBuilder: (context, index) => SizedBox(height: 14),
shrinkWrap: true,
reverse: false,
itemBuilder: (context, index) {
CheckMeUserInfoModel userModel = checkMeProUsersList[index];
CheckMeUserInfoModel userModel = checkMeProUsersList![index];
return InkWell(
onTap: () {
if (trackerTypeEnum == TrackerTypeEnum.BloodSugarTracker) {
myTrackersVm.getGlucoseDataFromCheckMePro(userModel.id);
myTrackersVm.getGlucoseDataFromCheckMePro(userModel.id!);
} else if (trackerTypeEnum == TrackerTypeEnum.BloodPressureTracker) {
myTrackersVm.getBPDataFromCheckMePro(userModel.id);
myTrackersVm.getBPDataFromCheckMePro(userModel.id!);
}
Navigator.of(context).pushReplacement(FadePage(page: CheckMeAllInOneInfoScreen(trackerTypeEnum)));
},
@ -1269,16 +1269,16 @@ class MyTrackersViewModel extends ChangeNotifier {
Future<void> getTempDataFromCheckMePro() async {
if (checkMeTemperatures != null) {
checkMeTemperatures.clear();
checkMeTemperatures!.clear();
}
await BleChannel.getTempDataFromCheckMePro();
}
List<CheckMeTemperatureModel> checkMeTemperatures;
List<CheckMeTemperatureModel>? checkMeTemperatures;
void updateCheckMeTemperatureInfoModel(List returnData) {
if (checkMeTemperatures != null) {
checkMeTemperatures.clear();
checkMeTemperatures!.clear();
}
checkMeTemperatures = List.generate(returnData.length, (index) => CheckMeTemperatureModel.fromJson(returnData[index]));
notifyListeners();
@ -1286,16 +1286,16 @@ class MyTrackersViewModel extends ChangeNotifier {
Future<void> getOxiDataFromCheckMePro() async {
if (checkMeOxi != null) {
checkMeOxi.clear();
checkMeOxi!.clear();
}
await BleChannel.getOxiDataFromCheckMePro();
}
List<CheckMeOxiModel> checkMeOxi;
List<CheckMeOxiModel>? checkMeOxi;
void updateCheckMeOxiInfoModel(List returnData) {
if (checkMeOxi != null) {
checkMeOxi.clear();
checkMeOxi!.clear();
}
checkMeOxi = List.generate(returnData.length, (index) => CheckMeOxiModel.fromJson(returnData[index]));
notifyListeners();
@ -1303,16 +1303,16 @@ class MyTrackersViewModel extends ChangeNotifier {
Future<void> getECGDataFromCheckMePro() async {
if (checkMeEcg != null) {
checkMeEcg.clear();
checkMeEcg!.clear();
}
await BleChannel.getEcgDataFromCheckMePro();
}
List<CheckMeECGModel> checkMeEcg;
List<CheckMeECGModel>? checkMeEcg;
void updateCheckMeEcgInfoModel(List returnData) {
if (checkMeEcg != null) {
checkMeEcg.clear();
checkMeEcg!.clear();
}
checkMeEcg = List.generate(returnData.length, (index) => CheckMeECGModel.fromJson(returnData[index]));
notifyListeners();
@ -1325,7 +1325,7 @@ class MyTrackersViewModel extends ChangeNotifier {
await BleChannel.getEcgWaveDataFromCheckMePro(timeString);
}
CheckMeECGWaveModel checkMeECGWave;
CheckMeECGWaveModel? checkMeECGWave;
void updateCheckMeEcgWaveInfoModel(returnData) {
if (checkMeECGWave != null) {
@ -1337,16 +1337,16 @@ class MyTrackersViewModel extends ChangeNotifier {
Future<void> getBPDataFromCheckMePro(String userId) async {
if (checkMeBP != null) {
checkMeBP.clear();
checkMeBP!.clear();
}
await BleChannel.getBPDataFromCheckMePro(userId);
}
List<CheckMeBPModel> checkMeBP;
List<CheckMeBPModel>? checkMeBP;
void updateCheckMeBPInfoModel(List returnData) {
if (checkMeBP != null) {
checkMeBP.clear();
checkMeBP!.clear();
}
checkMeBP = List.generate(returnData.length, (index) => CheckMeBPModel.fromJson(returnData[index]));
notifyListeners();
@ -1354,16 +1354,16 @@ class MyTrackersViewModel extends ChangeNotifier {
Future<void> getGlucoseDataFromCheckMePro(String userId) async {
if (checkMeGlucose != null) {
checkMeGlucose.clear();
checkMeGlucose!.clear();
}
await BleChannel.getGlucoseDataFromCheckMePro(userId);
}
List<CheckMeGlucoseModel> checkMeGlucose;
List<CheckMeGlucoseModel>? checkMeGlucose;
void updateCheckMeGlucoseInfoModel(List returnData) {
if (checkMeGlucose != null) {
checkMeGlucose.clear();
checkMeGlucose!.clear();
}
checkMeGlucose = List.generate(returnData.length, (index) => CheckMeGlucoseModel.fromJson(returnData[index]));
notifyListeners();
@ -1440,7 +1440,7 @@ class MyTrackersViewModel extends ChangeNotifier {
if (state == BluetoothConnectionState.connected) {
isAndesfitDeviceConnected = true;
notifyListeners();
bleDevicesStream.cancel();
bleDevicesStream!.cancel();
List<BluetoothService> services = await device.discoverServices();
services.forEach((service) {
if (service.serviceUuid.toString().toLowerCase() == BLEUtils.TEMPERATURE_SERVICE) {
@ -1452,14 +1452,14 @@ class MyTrackersViewModel extends ChangeNotifier {
print("onValueReceived Stream");
print(event);
updateCurrentTempInCelsius(convertIntListToHexTemp(event));
String currentTempInFahrenheit = ((num.parse(currentTempInCelsius) * 1.8) + 32).toStringAsFixed(1);
String tempCurrentTempInCelsius = currentTempInCelsius + "\u2103" + " / " + currentTempInFahrenheit + "\u2109";
String currentTempInFahrenheit = ((num.parse(currentTempInCelsius!) * 1.8) + 32).toStringAsFixed(1);
String tempCurrentTempInCelsius = currentTempInCelsius! + "\u2103" + " / " + currentTempInFahrenheit + "\u2109";
updateCurrentTempInCelsius(tempCurrentTempInCelsius);
});
await characteristic.setNotifyValue(true);
}
});
return true;
return;
}
});
}
@ -1469,7 +1469,7 @@ class MyTrackersViewModel extends ChangeNotifier {
Future<void> getTemperatureSmartRing() async {
if (smartRingTemperatureHistory != null) {
smartRingTemperatureHistory.clear();
smartRingTemperatureHistory!.clear();
smartRingTemperatureHistory = null;
}
String data = await BleChannel.getTemperatureSmartRing();
@ -1516,7 +1516,7 @@ class MyTrackersViewModel extends ChangeNotifier {
logger.i(jsonEncode(data.toString()));
}
String smartRingBatteryLevel;
String? smartRingBatteryLevel;
void updateSmartRingBatteryLevelModel(dynamic returnData) {
if (smartRingBatteryLevel != null) {
@ -1529,7 +1529,7 @@ class MyTrackersViewModel extends ChangeNotifier {
//TEMPERATURE
List<SmartRingGenericModel> smartRingTemperatureHistory;
List<SmartRingGenericModel>? smartRingTemperatureHistory;
void updateSmartRingTemperatureHistory(dynamic returnData) {
Map<dynamic, dynamic> data = returnData;
@ -1539,14 +1539,14 @@ class MyTrackersViewModel extends ChangeNotifier {
if (smartRingTemperatureHistory == null) {
smartRingTemperatureHistory = list;
} else {
smartRingTemperatureHistory.addAll(list);
smartRingTemperatureHistory!.addAll(list);
}
notifyListeners();
}
//BLOOD OXYGEN
List<SmartRingGenericModel> smartRingBloodOxygenHistory;
List<SmartRingGenericModel>? smartRingBloodOxygenHistory;
void updateSmartRingBloodOxygenHistory(dynamic returnData) {
Map<dynamic, dynamic> data = returnData;
@ -1556,14 +1556,14 @@ class MyTrackersViewModel extends ChangeNotifier {
if (smartRingBloodOxygenHistory == null) {
smartRingBloodOxygenHistory = list;
} else {
smartRingBloodOxygenHistory.addAll(list);
smartRingBloodOxygenHistory!.addAll(list);
}
notifyListeners();
}
//HEART RATE DYNAMIC
List<SmartRingGenericModel> smartRingHeartRateDynamicHistory;
List<SmartRingGenericModel>? smartRingHeartRateDynamicHistory;
void updateSmartRingHeartRateDynamicHistory(dynamic returnData) {
Map<dynamic, dynamic> data = returnData;
@ -1573,13 +1573,13 @@ class MyTrackersViewModel extends ChangeNotifier {
if (smartRingHeartRateDynamicHistory == null) {
smartRingHeartRateDynamicHistory = list;
} else {
smartRingHeartRateDynamicHistory.addAll(list);
smartRingHeartRateDynamicHistory!.addAll(list);
}
log("smartRingHeartRateDynamicHistory: ${smartRingHeartRateDynamicHistory.length}");
log("smartRingHeartRateDynamicHistory: ${smartRingHeartRateDynamicHistory!.length}");
notifyListeners();
}
List<SmartRingGenericModel> smartRingHeartRateStaticHistory;
List<SmartRingGenericModel>? smartRingHeartRateStaticHistory;
void updateSmartRingHeartRateStaticHistory(dynamic returnData) {
Map<dynamic, dynamic> data = returnData;
@ -1589,13 +1589,13 @@ class MyTrackersViewModel extends ChangeNotifier {
if (smartRingHeartRateStaticHistory == null) {
smartRingHeartRateStaticHistory = list;
} else {
smartRingHeartRateStaticHistory.addAll(list);
smartRingHeartRateStaticHistory!.addAll(list);
}
log("smartRingHeartRateStaticHistory: ${smartRingHeartRateStaticHistory.length}");
log("smartRingHeartRateStaticHistory: ${smartRingHeartRateStaticHistory!.length}");
notifyListeners();
}
List<SmartRingHrvModel> smartRingHrvHistory;
List<SmartRingHrvModel>? smartRingHrvHistory;
void updateSmartRingHrvHistory(dynamic returnData) {
Map<dynamic, dynamic> data = returnData;
@ -1605,13 +1605,13 @@ class MyTrackersViewModel extends ChangeNotifier {
if (smartRingHrvHistory == null) {
smartRingHrvHistory = list;
} else {
smartRingHrvHistory.addAll(list);
smartRingHrvHistory!.addAll(list);
}
log("smartRingHrvHistory: ${smartRingHrvHistory.length}");
log("smartRingHrvHistory: ${smartRingHrvHistory!.length}");
notifyListeners();
}
List<SmartRingStepCountModel> smartRingStepCountHistory;
List<SmartRingStepCountModel>? smartRingStepCountHistory;
void updateSmartRingStepCountHistory(dynamic returnData) {
Map<dynamic, dynamic> data = returnData;
@ -1621,17 +1621,17 @@ class MyTrackersViewModel extends ChangeNotifier {
if (smartRingStepCountHistory == null) {
smartRingStepCountHistory = list;
} else {
smartRingStepCountHistory.addAll(list);
smartRingStepCountHistory!.addAll(list);
}
log("smartRingStepCountHistory: ${smartRingStepCountHistory.length}");
log("smartRingStepCountHistory: ${smartRingStepCountHistory!.length}");
notifyListeners();
}
RtSportDataSmartRingModel rtSportDataSmartRingModel;
RtSportDataSmartRingModel? rtSportDataSmartRingModel;
void updateRtSportDataSmartRingModel(dynamic returnData) {
Map<dynamic, dynamic> data = returnData;
rtSportDataSmartRingModel = RtSportDataSmartRingModel.fromJson(data["dicData"] as Map);
rtSportDataSmartRingModel = RtSportDataSmartRingModel.fromJson(data["dicData"] as Map<String, dynamic>);
log("rtSportDataSmartRingModel: ${data.toString()}");
notifyListeners();
}

@ -17,34 +17,34 @@ class SpirometerBLE extends StatefulWidget {
class _SpirometerBLEState extends State<SpirometerBLE> {
String connectionStatus = "disconnected";
BluetoothDevice currentConnectedDevice;
BluetoothDevice? currentConnectedDevice;
StreamSubscription bleDevicesStream;
StreamSubscription bleDeviceConnectionStream;
StreamSubscription? bleDevicesStream;
StreamSubscription? bleDeviceConnectionStream;
BluetoothCharacteristic spirometerReadCharacteristicFf0a;
BluetoothCharacteristic spirometerWriteCharacteristicFf0b;
BluetoothCharacteristic? spirometerReadCharacteristicFf0a;
BluetoothCharacteristic? spirometerWriteCharacteristicFf0b;
String valuePEF = "0";
String valueFEV = "0.0";
final bleConnectionStatus = ValueNotifier<String>("Disconnected");
Timer _timer;
Timer? _timer;
Timer _timerRead;
Timer? _timerRead;
bool isHistoryCommandWritten = false;
@override
void dispose() {
super.dispose();
if (currentConnectedDevice != null) currentConnectedDevice.disconnect();
if (_timer != null && _timer.isActive) _timer.cancel();
if (_timerRead != null && _timerRead.isActive) _timerRead.cancel();
if (currentConnectedDevice != null) currentConnectedDevice!.disconnect();
if (_timer != null && _timer!.isActive) _timer!.cancel();
if (_timerRead != null && _timerRead!.isActive) _timerRead!.cancel();
bleConnectionStatus.dispose();
if (bleDevicesStream != null) bleDevicesStream.cancel();
if (bleDeviceConnectionStream != null) bleDeviceConnectionStream.cancel();
if (bleDevicesStream != null) bleDevicesStream!.cancel();
if (bleDeviceConnectionStream != null) bleDeviceConnectionStream!.cancel();
}
@override
@ -94,7 +94,7 @@ class _SpirometerBLEState extends State<SpirometerBLE> {
);
} else {
FlutterBluePlus.stopScan();
return SizedBox(height: 300.0, child: BluetoothOffScreen(adapterState: adapterState));
return SizedBox(height: 300.0, child: BluetoothOffScreen(adapterState: adapterState!));
}
}),
),
@ -118,16 +118,16 @@ class _SpirometerBLEState extends State<SpirometerBLE> {
(element) {
if (element.device.localName.isNotEmpty) {
if (element.device.localName.toLowerCase() == "ble-msa") {
bleDevicesStream.cancel();
bleDevicesStream!.cancel();
element.device.connect(timeout: Duration(seconds: 5), autoConnect: false).then((value) async {
bleConnectionStatus.value = "Connected...";
print("Device Connected-------");
currentConnectedDevice = element.device;
bleDeviceConnectionStream = currentConnectedDevice.connectionState.listen((event) {
bleDeviceConnectionStream = currentConnectedDevice!.connectionState.listen((event) {
if (event == BluetoothConnectionState.disconnected) {
bleConnectionStatus.value = "Disconnected...";
print("Device Disconnected-------");
if (_timer.isActive) _timer.cancel();
if (_timer!.isActive) _timer!.cancel();
}
});
FlutterBluePlus.stopScan();
@ -140,9 +140,7 @@ class _SpirometerBLEState extends State<SpirometerBLE> {
(characteristic) async {
if (characteristic.characteristicUuid.toString().toLowerCase() == BLEUtils.BLE_TO_MSA100_READ_CHARACTERISTIC) {
spirometerReadCharacteristicFf0a = characteristic;
print(spirometerReadCharacteristicFf0a.characteristicUuid);
print(spirometerReadCharacteristicFf0a.properties.toString());
spirometerReadCharacteristicFf0a.onValueReceived.listen((event) async {
spirometerReadCharacteristicFf0a!.onValueReceived.listen((event) async {
print("onValueReceived ff0a Stream");
print(event);
@ -152,12 +150,12 @@ class _SpirometerBLEState extends State<SpirometerBLE> {
}
if (event[0] == 170) {
_timer.cancel();
_timer!.cancel();
// Write get history command to ff0b
if (!isHistoryCommandWritten) {
await Future.delayed(Duration(milliseconds: 1000)).then((value) async {
spirometerWriteCharacteristicFf0b.write([0x55, 0x01], withoutResponse: false).then((value) {
spirometerWriteCharacteristicFf0b!.write([0x55, 0x01], withoutResponse: false).then((value) {
print("----ff0b get history command data written----");
isHistoryCommandWritten = true;
});
@ -165,13 +163,13 @@ class _SpirometerBLEState extends State<SpirometerBLE> {
// Write get 1st history command to ff0b
await Future.delayed(Duration(milliseconds: 1000)).then((value) async {
spirometerWriteCharacteristicFf0b.write([0x55, 0x02, 0x01, 0x00], withoutResponse: false).then((value) async {
spirometerWriteCharacteristicFf0b!.write([0x55, 0x02, 0x01, 0x00], withoutResponse: false).then((value) async {
print("----ff0b get 1st history command data written----");
isHistoryCommandWritten = true;
// Write delete history command to ff0b
await Future.delayed(Duration(milliseconds: 1000)).then((value) async {
spirometerWriteCharacteristicFf0b.write([0x55, 0x03], withoutResponse: false).then((value) async {
spirometerWriteCharacteristicFf0b!.write([0x55, 0x03], withoutResponse: false).then((value) async {
print("----ff0b delete history command data written----");
isHistoryCommandWritten = true;
await Future.delayed(Duration(milliseconds: 500)).then((value) async {
@ -189,15 +187,12 @@ class _SpirometerBLEState extends State<SpirometerBLE> {
await Future.delayed(Duration(milliseconds: 1000)).then((value) async {
print("Delayed ff0a done");
if (!spirometerReadCharacteristicFf0a.isNotifying) await spirometerReadCharacteristicFf0a.setNotifyValue(true).catchError((err) {});
if (!spirometerReadCharacteristicFf0a!.isNotifying) await spirometerReadCharacteristicFf0a!.setNotifyValue(true).catchError((err) {});
});
}
if (characteristic.characteristicUuid.toString().toLowerCase() == BLEUtils.BLE_TO_MSA100_WRITE_CHARACTERISTIC) {
spirometerWriteCharacteristicFf0b = characteristic;
print(spirometerWriteCharacteristicFf0b.characteristicUuid);
print(spirometerWriteCharacteristicFf0b.properties.toString());
// Write ACK command to ff0b every 500 ms
startACKCommandToMSA100();
@ -230,7 +225,7 @@ class _SpirometerBLEState extends State<SpirometerBLE> {
// Write ACK command to ff0b every 500 ms
await Future.delayed(Duration(milliseconds: 1000)).then((value) async {
_timer = Timer.periodic(Duration(milliseconds: 500), (Timer t) {
spirometerWriteCharacteristicFf0b.write([0x55, 0x06], withoutResponse: false).then((value) {
spirometerWriteCharacteristicFf0b!.write([0x55, 0x06], withoutResponse: false).then((value) {
print("----ff0b ACK command data written----");
});
});
@ -264,7 +259,7 @@ class _SpirometerBLEState extends State<SpirometerBLE> {
}
class BluetoothOffScreen extends StatelessWidget {
const BluetoothOffScreen({Key key, this.adapterState}) : super(key: key);
const BluetoothOffScreen({Key? key, required this.adapterState}) : super(key: key);
final BluetoothAdapterState adapterState;

@ -1,4 +1,3 @@
import 'dart:io';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/ble_utils.dart';
@ -19,12 +18,12 @@ class _TemperatureHomePageState extends State<TemperatureHomePage> {
String connectionStatus = "disconnected";
String currentTempInCelsius = "0.0";
BluetoothDevice currentConnectedDevice;
BluetoothDevice? currentConnectedDevice;
@override
void dispose() {
super.dispose();
currentConnectedDevice.disconnect(timeout: 15);
currentConnectedDevice!.disconnect(timeout: 15);
}
@override
@ -68,7 +67,7 @@ class _TemperatureHomePageState extends State<TemperatureHomePage> {
);
} else {
FlutterBluePlus.stopScan();
return SizedBox(height: 300.0, child: BluetoothOffScreen(adapterState: adapterState));
return SizedBox(height: 300.0, child: BluetoothOffScreen(adapterState: adapterState!));
}
}),
),
@ -122,13 +121,13 @@ class _TemperatureHomePageState extends State<TemperatureHomePage> {
await characteristic.setNotifyValue(true);
}
});
return true;
return;
}
});
}
});
await element.device.connect(timeout: Duration(seconds: 35));
return true;
return ;
}
}
});

@ -4,9 +4,9 @@ import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
class EKGChartView extends StatefulWidget {
ECGFileDetailModel ekgFileDetailResponseModel;
final ECGFileDetailModel ekgFileDetailResponseModel;
EKGChartView({@required this.ekgFileDetailResponseModel});
EKGChartView({required this.ekgFileDetailResponseModel});
@override
State<EKGChartView> createState() => _EKGChartViewState();
@ -22,7 +22,7 @@ class _EKGChartViewState extends State<EKGChartView> {
@override
Widget build(BuildContext context) {
List<int> list = widget.ekgFileDetailResponseModel.shortData;
List<int> list = widget.ekgFileDetailResponseModel.shortData ?? [];
List<List<int>> mainList = chunkIntList(list, 1250);
return AppScaffold(
@ -48,13 +48,13 @@ class _EKGChartViewState extends State<EKGChartView> {
horizontalInterval: 30,
getDrawingVerticalLine: (value) {
return FlLine(
color: Colors.red[300],
color: Colors.red[300]!,
strokeWidth: 0.4,
);
},
getDrawingHorizontalLine: (value) {
return FlLine(
color: Colors.red[300],
color: Colors.red[300]!,
strokeWidth: 0.4,
);
},
@ -75,7 +75,7 @@ class _EKGChartViewState extends State<EKGChartView> {
barWidth: 0.5,
dotData: FlDotData(show: false),
spots: getDataList(mainList[index]),
colors: [Colors.grey[800]],
color: Colors.grey[800],
isStrokeCapRound: true,
belowBarData: BarAreaData(show: false),
),

@ -36,29 +36,27 @@ class _EKG_BLEState extends State<EKG_BLE> {
List<ECGFileDetailModel> ekgFileDetailResponseModelList = [];
ECGRtModel ekgRealTimeDataResponseModel;
ECGRtModel? ekgRealTimeDataResponseModel;
List<int> ecgBytesAllDataList = [];
Timer timer;
List<_ChartData> chartData;
int count;
ChartSeriesController _chartSeriesController;
Timer? timer;
late List<_ChartData> chartData;
int count = 0;
ChartSeriesController? _chartSeriesController;
@override
void dispose() {
ekgValueNotifier.dispose();
super.dispose();
BleChannel.disconnect();
timer?.cancel();
chartData.clear();
timer!.cancel();
chartData!.clear();
_chartSeriesController = null;
}
@override
void initState() {
// TODO: implement initState
count = 19;
chartData = <_ChartData>[
_ChartData(0, 42),
@ -95,7 +93,7 @@ class _EKG_BLEState extends State<EKG_BLE> {
onRendererCreated: (ChartSeriesController controller) {
_chartSeriesController = controller;
},
dataSource: chartData,
dataSource: chartData!,
color: const Color.fromRGBO(192, 108, 132, 1),
xValueMapper: (_ChartData sales, _) => sales.country,
yValueMapper: (_ChartData sales, _) => sales.sales,
@ -108,12 +106,12 @@ class _EKG_BLEState extends State<EKG_BLE> {
chartData.add(_ChartData(count, _getRandomInt(10, 100)));
if (chartData.length == 20) {
chartData.removeAt(0);
_chartSeriesController?.updateDataSource(
_chartSeriesController!.updateDataSource(
addedDataIndexes: <int>[chartData.length - 1],
removedDataIndexes: <int>[0],
);
} else {
_chartSeriesController?.updateDataSource(
_chartSeriesController!.updateDataSource(
addedDataIndexes: <int>[chartData.length - 1],
);
}
@ -254,11 +252,11 @@ class _EKG_BLEState extends State<EKG_BLE> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(ekgFileDetailResponseModel.fileName),
Text(ekgFileDetailResponseModel.fileName!),
mHeight(6.0),
Text("Duration: ${ekgFileDetailResponseModel.duration} seconds"),
mHeight(6.0),
Text("Date: ${DateUtil.getDayMonthYearHourMinuteDateFormatted(DateTime.fromMillisecondsSinceEpoch((ekgFileDetailResponseModel.startTime * 1000)))}"),
Text("Date: ${DateUtil.getDayMonthYearHourMinuteDateFormatted(DateTime.fromMillisecondsSinceEpoch((ekgFileDetailResponseModel.startTime! * 1000)))}"),
],
),
);
@ -281,7 +279,7 @@ class _EKG_BLEState extends State<EKG_BLE> {
String parseEKGRealTimeDataObject(dynamic returnData) {
ekgRealTimeDataResponseModel = ECGRtModel.fromJson(json.decode(returnData));
return "HeartRate: ${ekgRealTimeDataResponseModel.param.hr} - Current State: ${ekgRealTimeDataResponseModel.param.curStatus}";
return "HeartRate: ${ekgRealTimeDataResponseModel!.param!.hr} - Current State: ${ekgRealTimeDataResponseModel!.param!.curStatus}";
}
}

@ -16,9 +16,15 @@ class SP20PulseTracker extends StatefulWidget {
class _SP20PulseTrackerState extends State<SP20PulseTracker> {
EventChannel eventChannel = EventChannel('BLE-Platform-Bridge-Event');
// final bpDataNotifierMeasuring = ValueNotifier<BpRtDataMeasuringModel>(BpRtDataMeasuringModel());
final sp20RtParamNotifier = ValueNotifier<OxyRtModel>(OxyRtModel());
final sp20StatusNotifier = ValueNotifier<String>("");
final sp20RtParamNotifier = ValueNotifier<OxyRtModel>(OxyRtModel(
isCheckProbe: null,
isProbeOff: null,
isPulseSearching: null,
pi: null,
pr: null,
spo2: null,
));
final ValueNotifier<String> sp20StatusNotifier = ValueNotifier<String>("");
final bpDeviceDataNotifier = ValueNotifier<String>("");
String deviceName = "SP20";
@ -61,7 +67,7 @@ class _SP20PulseTrackerState extends State<SP20PulseTracker> {
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text(
value == null || value.isEmpty ? "" : "Connected",
value.isEmpty ? "" : "Connected",
style: TextStyle(fontSize: 18),
),
Text(
@ -86,7 +92,7 @@ class _SP20PulseTrackerState extends State<SP20PulseTracker> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
if (sp20RtModel.isProbeOff) ...[
if (sp20RtModel.isProbeOff ?? false) ...[
Text("Check Probe", style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
] else ...[
Column(
@ -137,7 +143,7 @@ class _SP20PulseTrackerState extends State<SP20PulseTracker> {
ValueListenableBuilder(
valueListenable: sp20StatusNotifier,
builder: (context, value, _) {
if (value == null || value.isEmpty) {
if (value.isEmpty) {
return Row(
children: [
Expanded(

@ -20,12 +20,12 @@ class _WeightScaleBLEState extends State<WeightScaleBLE> {
String connectionStatus = "disconnected";
String currentWeight = "0.0";
BluetoothDevice currentConnectedDevice;
BluetoothDevice? currentConnectedDevice;
StreamSubscription bleDevicesStream;
StreamSubscription weightValuesStream;
StreamSubscription? bleDevicesStream;
StreamSubscription? weightValuesStream;
WeightScaleData weightScaleData = WeightScaleData();
WeightScaleData? weightScaleData ;
final bleConnectionStatus = ValueNotifier<String>("Disconnected");
@ -36,9 +36,9 @@ class _WeightScaleBLEState extends State<WeightScaleBLE> {
void dispose() {
super.dispose();
bleConnectionStatus.dispose();
bleDevicesStream.cancel();
weightValuesStream.cancel();
currentConnectedDevice.disconnect();
bleDevicesStream!.cancel();
weightValuesStream!.cancel();
currentConnectedDevice!.disconnect();
}
@override
@ -84,13 +84,13 @@ class _WeightScaleBLEState extends State<WeightScaleBLE> {
),
Column(
children: [
Text("Current Weight: ${weightScaleData.weight}" + " kg"),
Text("Current BMI: ${weightScaleData.bmi}"),
Text("Current Body Fat: ${weightScaleData.fat}" + "%"),
Text("Current Bone Weight: ${weightScaleData.bone}" + " kg"),
Text("Current Water: ${weightScaleData.water}" + "%"),
Text("Current Muscle: ${weightScaleData.muscle}" + "%"),
Text("Current BMR: ${weightScaleData.bmr}" + " calories/day"),
Text("Current Weight: ${weightScaleData!.weight}" + " kg"),
Text("Current BMI: ${weightScaleData!.bmi}"),
Text("Current Body Fat: ${weightScaleData!.fat}" + "%"),
Text("Current Bone Weight: ${weightScaleData!.bone}" + " kg"),
Text("Current Water: ${weightScaleData!.water}" + "%"),
Text("Current Muscle: ${weightScaleData!.muscle}" + "%"),
Text("Current BMR: ${weightScaleData!.bmr}" + " calories/day"),
],
),
// })
@ -99,7 +99,7 @@ class _WeightScaleBLEState extends State<WeightScaleBLE> {
);
} else {
FlutterBluePlus.stopScan();
return SizedBox(height: 300.0, child: BluetoothOffScreen(adapterState: adapterState));
return SizedBox(height: 300.0, child: BluetoothOffScreen(adapterState: adapterState!));
}
}),
),
@ -122,7 +122,7 @@ class _WeightScaleBLEState extends State<WeightScaleBLE> {
blueToothDevices.forEach((element) async {
if (element.device.localName.isNotEmpty) {
if (element.device.localName.toLowerCase() == "sdic") {
bleDevicesStream.cancel();
bleDevicesStream!.cancel();
element.device.connect(timeout: Duration(seconds: 5), autoConnect: false).then((value) async {
bleConnectionStatus.value = "Connected...";
print("Device Connected-------");
@ -170,7 +170,7 @@ class _WeightScaleBLEState extends State<WeightScaleBLE> {
});
await Future.delayed(Duration(milliseconds: 500)).then((value) async {
print("Delayed fff1 done");
if (!characteristic.isNotifying) await characteristic.setNotifyValue(true).catchError((err) {});
if (!characteristic.isNotifying) await characteristic.setNotifyValue(true);
});
}
@ -184,7 +184,7 @@ class _WeightScaleBLEState extends State<WeightScaleBLE> {
await Future.delayed(Duration(milliseconds: 1000)).then((value) async {
print("Delayed fff2 done");
if (!characteristic.isNotifying) await characteristic.setNotifyValue(true).catchError((err) {});
if (!characteristic.isNotifying) await characteristic.setNotifyValue(true);
});
// Write user data to fff2
@ -202,11 +202,11 @@ class _WeightScaleBLEState extends State<WeightScaleBLE> {
});
}
});
return true;
return ;
}
});
});
return true;
return ;
}
}
});
@ -243,13 +243,13 @@ class _WeightScaleBLEState extends State<WeightScaleBLE> {
print((int.parse(hexStringWater, radix: 16) * 0.1).toStringAsFixed(1));
setState(() {
weightScaleData.weight = (int.parse(hexStringWeight, radix: 16) * 0.1).toStringAsFixed(1);
weightScaleData.bmi = (int.parse(hexStringBMI, radix: 16) * 0.1).toStringAsFixed(1);
weightScaleData.fat = (int.parse(hexStringFat, radix: 16) * 0.1).toStringAsFixed(1);
weightScaleData.muscle = (int.parse(hexStringMuscle, radix: 16) * 0.1).toStringAsFixed(1);
weightScaleData.bmr = (int.parse(hexStringBMR, radix: 16)).toString();
weightScaleData.bone = (int.parse(hexStringBone, radix: 16) * 0.1).toStringAsFixed(1);
weightScaleData.water = (int.parse(hexStringWater, radix: 16) * 0.1).toStringAsFixed(1);
weightScaleData!.weight = (int.parse(hexStringWeight, radix: 16) * 0.1).toStringAsFixed(1);
weightScaleData!.bmi = (int.parse(hexStringBMI, radix: 16) * 0.1).toStringAsFixed(1);
weightScaleData!.fat = (int.parse(hexStringFat, radix: 16) * 0.1).toStringAsFixed(1);
weightScaleData!.muscle = (int.parse(hexStringMuscle, radix: 16) * 0.1).toStringAsFixed(1);
weightScaleData!.bmr = (int.parse(hexStringBMR, radix: 16)).toString();
weightScaleData!.bone = (int.parse(hexStringBone, radix: 16) * 0.1).toStringAsFixed(1);
weightScaleData!.water = (int.parse(hexStringWater, radix: 16) * 0.1).toStringAsFixed(1);
});
}

@ -42,7 +42,7 @@ class PayfortService extends BaseService {
Future<void> addPayfortApplePayResponse(num patientID, {PayFortResult? result}) async {
Map<String, dynamic> body = {
"Fort_id": result!.fortId,
"CommandType": result!.command,
"CommandType": result.command,
"Amount": (num.parse(result.amount!) / 100),
"Payment_Option": result.paymentOption,
"Customer_IP": result.customerIp,

@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
class BluetoothOffScreen extends StatelessWidget {
const BluetoothOffScreen({Key key, this.adapterState}) : super(key: key);
const BluetoothOffScreen({Key? key, required this.adapterState}) : super(key: key);
final BluetoothAdapterState adapterState;

@ -930,8 +930,8 @@ class Utils {
return projectDetailListModel;
}
//static String generateSignature() {}
static String generateSignature() {}
//static String generateSignature() {}
//
}
Widget applyShadow({Color color = Colors.grey, double shadowOpacity = 0.5, double spreadRadius = 2, double blurRadius = 7, Offset offset = const Offset(2, 2), required Widget child}) {

@ -7,25 +7,17 @@ import 'package:flutter_svg/flutter_svg.dart';
class MedicalProfileItem extends StatelessWidget {
final String imagePath;
final String title;
final String subTitle;
final String? subTitle;
final bool hasBadge = false;
final bool isPngImage;
final bool isInPatient;
bool isEnable;
Color? imgColor;
final bool isEnable;
final Color? imgColor;
final width;
final height;
MedicalProfileItem(
{required this.imagePath,
required this.title,
required this.subTitle,
hasBadge,
this.isEnable = true,
this.imgColor,
this.isPngImage = false,
this.width,
this.height, this.isInPatient = false});
{required this.imagePath, required this.title, this.subTitle, hasBadge, this.isEnable = true, this.imgColor, this.isPngImage = false, this.width, this.height, this.isInPatient = false});
@override
Widget build(BuildContext context) {
@ -34,8 +26,7 @@ class MedicalProfileItem extends StatelessWidget {
height: double.infinity,
width: double.infinity,
margin: EdgeInsets.all(0),
decoration: containerColorRadiusBorderWidth(
Colors.white, 15, CustomColors.pharmacyGreyColor, 1),
decoration: containerColorRadiusBorderWidth(Colors.white, 15, CustomColors.pharmacyGreyColor, 1),
clipBehavior: Clip.antiAlias,
child: Stack(
children: [
@ -56,22 +47,14 @@ class MedicalProfileItem extends StatelessWidget {
isPngImage
? Image.asset(
imagePath,
width: width != null
? width
: SizeConfig.widthMultiplier! * 7,
height: height != null
? height
: SizeConfig.widthMultiplier! * 7,
width: width != null ? width : SizeConfig.widthMultiplier! * 7,
height: height != null ? height : SizeConfig.widthMultiplier! * 7,
color: imgColor,
)
: SvgPicture.asset(
isInPatient ? "assets/images/new/inpatient/$imagePath" : "assets/images/new/services/$imagePath",
height: height != null
? height
: SizeConfig.widthMultiplier! * 7,
width: width != null
? width
: SizeConfig.widthMultiplier! * 7,
height: height != null ? height : SizeConfig.widthMultiplier! * 7,
width: width != null ? width : SizeConfig.widthMultiplier! * 7,
color: imgColor,
),
mFlex(2),
@ -92,7 +75,7 @@ class MedicalProfileItem extends StatelessWidget {
children: [
Expanded(
child: Text(
subTitle,
subTitle!,
maxLines: 1,
style: TextStyle(
fontSize: SizeConfig.textMultiplier! * 1.4,

@ -100,7 +100,7 @@ dependencies:
syncfusion_flutter_calendar: ^23.1.42
#Charts for Live ECG View
syncfusion_flutter_charts: ^19.3.55
syncfusion_flutter_charts: ^23.2.7
# SVG Images
flutter_svg: ^2.0.8

Loading…
Cancel
Save