Merged latest 3.16

dev_v3.13.6_BLE_Faiz
Faiz Hashmi 2 years ago
parent c10fb7f1a9
commit 336536df4a

@ -48,14 +48,14 @@ configurations.all {
//configurations.all { //configurations.all {
// resolutionStrategy { // resolutionStrategy {
// force 'androidx.core:core-ktx:1.6.0' // force "androidx.core:core:1.13.1"
// } // }
//} //}
android { android {
compileSdkVersion 34 compileSdkVersion 34
// ndkVersion "24.0.8215888" // ndkVersion "24.0.8215888"
buildToolsVersion "31.0.0" // buildToolsVersion "31.0.0"
sourceSets { sourceSets {
main.java.srcDirs += 'src/main/kotlin' main.java.srcDirs += 'src/main/kotlin'
@ -190,7 +190,7 @@ dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2"
implementation 'com.android.support:appcompat-v7:27.1.1' implementation 'com.android.support:appcompat-v7:27.1.1'
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
implementation project(':blesdk_2301') // implementation project(':blesdk_2301')
// compile "com.jstyle:1770sdk:1.0.2" // compile "com.jstyle:1770sdk:1.0.2"
implementation 'io.reactivex.rxjava3:rxjava:3.1.3' implementation 'io.reactivex.rxjava3:rxjava:3.1.3'
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0' 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.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" tools:node="remove"/> <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.READ_PHONE_STATE" tools:node="remove"/>
<uses-permission android:name="android.permission.BLUETOOTH" 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_ADMIN" tools:node="remove"/>-->
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" 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="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="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" tools:node="remove"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CONNECTED_DEVICE" 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"/> <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 { init {
if (serviceIntent == null) { if (serviceIntent == null) {
serviceIntent = Intent(context, BleService::class.java) 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 val bluetoothManager = context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager
bluetoothAdapter = bluetoothManager.adapter bluetoothAdapter = bluetoothManager.adapter

@ -1,5 +1,5 @@
buildscript { buildscript {
ext.kotlin_version = '1.8.0' ext.kotlin_version = '1.8.20'
// if (System.properties['os.arch'] == "aarch64") { // if (System.properties['os.arch'] == "aarch64") {
// // For M1 Users we need to use the NDK 24 which added support for 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" // ndkVersion = "21.4.7075529"
// } // }
ext.kotlin_version = '1.8.20' // ext.kotlin_version = '1.8.20'
repositories { repositories {
google() google()
jcenter() jcenter()
@ -22,7 +22,7 @@ buildscript {
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:7.1.3' 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.gms:google-services:4.3.8'
// classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1' // classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
classpath 'com.huawei.agconnect:agcp:1.5.2.300' 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:provider/provider.dart';
import 'package:local_auth_ios/types/auth_messages_ios.dart'; import 'package:local_auth_ios/types/auth_messages_ios.dart';
class ConfirmLogin extends StatefulWidget { class ConfirmLogin extends StatefulWidget {
final Function? changePageViewIndex; final Function? changePageViewIndex;
final fromRegistration; final fromRegistration;

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

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

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

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

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

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

@ -11,14 +11,14 @@ import 'package:provider/provider.dart';
class CheckMeAllInOneConnectScreen extends StatefulWidget { class CheckMeAllInOneConnectScreen extends StatefulWidget {
final BleDeviceModel deviceModel; final BleDeviceModel deviceModel;
const CheckMeAllInOneConnectScreen({this.deviceModel}); const CheckMeAllInOneConnectScreen({required this.deviceModel});
@override @override
State<CheckMeAllInOneConnectScreen> createState() => _CheckMeAllInOneConnectScreenState(); State<CheckMeAllInOneConnectScreen> createState() => _CheckMeAllInOneConnectScreenState();
} }
class _CheckMeAllInOneConnectScreenState extends State<CheckMeAllInOneConnectScreen> { class _CheckMeAllInOneConnectScreenState extends State<CheckMeAllInOneConnectScreen> {
MyTrackersViewModel myTrackersVm; late MyTrackersViewModel myTrackersVm;
@override @override
void initState() { void initState() {
@ -62,7 +62,6 @@ class _CheckMeAllInOneConnectScreenState extends State<CheckMeAllInOneConnectScr
case TrackerTypeEnum.AllInOneTracker: case TrackerTypeEnum.AllInOneTracker:
return "All in One"; return "All in One";
} }
return "All in One";
} }
Future<void> onTrackerTypePressed(TrackerTypeEnum trackerTypeEnum, MyTrackersViewModel myTrackersViewModel) async { Future<void> onTrackerTypePressed(TrackerTypeEnum trackerTypeEnum, MyTrackersViewModel myTrackersViewModel) async {
@ -147,7 +146,7 @@ class _CheckMeAllInOneConnectScreenState extends State<CheckMeAllInOneConnectScr
body: Padding( body: Padding(
padding: const EdgeInsets.all(24.0), padding: const EdgeInsets.all(24.0),
child: Consumer( child: Consumer(
builder: (BuildContext context, MyTrackersViewModel myTrackersViewModel, Widget child) { builder: (BuildContext context, MyTrackersViewModel myTrackersViewModel, Widget? child) {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween, 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_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_bp_model.dart';
import 'package:diplomaticquarterapp/pages/medical/my_trackers/ble_models/checkmepro_all_in_one_models/checkme_ecg_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: case TrackerTypeEnum.SmartRing:
return "Smart Ring"; return "Smart Ring";
} }
return "All in One";
} }
Widget getAllInOneOperationWidgets(MyTrackersViewModel myTrackersVm, TrackerTypeEnum trackerTypeEnum, BuildContext context) { Widget getAllInOneOperationWidgets(MyTrackersViewModel myTrackersVm, TrackerTypeEnum trackerTypeEnum, BuildContext context) {
@ -69,9 +67,7 @@ class CheckMeAllInOneInfoScreen extends StatelessWidget {
case TrackerTypeEnum.AllInOneTracker: case TrackerTypeEnum.AllInOneTracker:
case TrackerTypeEnum.SmartRing: case TrackerTypeEnum.SmartRing:
return getNoDataWidget(context); return getNoDataWidget(context);
break;
} }
return getNoDataWidget(context);
} }
Widget buildTemperatureWidget(MyTrackersViewModel myTrackersVm, BuildContext context) { Widget buildTemperatureWidget(MyTrackersViewModel myTrackersVm, BuildContext context) {
@ -80,15 +76,15 @@ class CheckMeAllInOneInfoScreen extends StatelessWidget {
children: [ children: [
if (myTrackersVm.filesLoader) ...[ if (myTrackersVm.filesLoader) ...[
Center(child: CircularProgressIndicator()) Center(child: CircularProgressIndicator())
] else if (myTrackersVm.checkMeTemperatures != null && myTrackersVm.checkMeTemperatures.isNotEmpty) ...[ ] else if (myTrackersVm.checkMeTemperatures != null && myTrackersVm.checkMeTemperatures!.isNotEmpty) ...[
Material( Material(
child: ListView.separated( child: ListView.separated(
itemCount: myTrackersVm.checkMeTemperatures.length, itemCount: myTrackersVm.checkMeTemperatures!.length,
separatorBuilder: (context, index) => SizedBox(height: 14), separatorBuilder: (context, index) => SizedBox(height: 14),
shrinkWrap: true, shrinkWrap: true,
reverse: false, reverse: false,
itemBuilder: (context, index) { itemBuilder: (context, index) {
CheckMeTemperatureModel checkMeTemp = myTrackersVm.checkMeTemperatures[index]; CheckMeTemperatureModel checkMeTemp = myTrackersVm.checkMeTemperatures![index];
return InkWell( return InkWell(
onTap: () => Navigator.pop(context), onTap: () => Navigator.pop(context),
child: Container( child: Container(
@ -120,18 +116,18 @@ class CheckMeAllInOneInfoScreen extends StatelessWidget {
children: [ children: [
if (myTrackersVm.filesLoader) ...[ if (myTrackersVm.filesLoader) ...[
Center(child: CircularProgressIndicator()) Center(child: CircularProgressIndicator())
] else if (myTrackersVm.checkMeEcg != null && myTrackersVm.checkMeEcg.isNotEmpty) ...[ ] else if (myTrackersVm.checkMeEcg != null && myTrackersVm.checkMeEcg!.isNotEmpty) ...[
Material( Material(
child: ListView.separated( child: ListView.separated(
itemCount: myTrackersVm.checkMeEcg.length, itemCount: myTrackersVm.checkMeEcg!.length,
separatorBuilder: (context, index) => SizedBox(height: 14), separatorBuilder: (context, index) => SizedBox(height: 14),
shrinkWrap: true, shrinkWrap: true,
reverse: false, reverse: false,
itemBuilder: (context, index) { itemBuilder: (context, index) {
CheckMeECGModel checkMeECGModel = myTrackersVm.checkMeEcg[index]; CheckMeECGModel checkMeECGModel = myTrackersVm.checkMeEcg![index];
return InkWell( return InkWell(
onTap: () { onTap: () {
myTrackersVm.getEcgWaveDataFromCheckMePro(checkMeECGModel.timeString); myTrackersVm.getEcgWaveDataFromCheckMePro(checkMeECGModel.timeString!);
Navigator.push(context, MaterialPageRoute(builder: (context) => CheckMeECGInfoScreen(TrackerTypeEnum.ECGTracker))); Navigator.push(context, MaterialPageRoute(builder: (context) => CheckMeECGInfoScreen(TrackerTypeEnum.ECGTracker)));
}, },
child: Container( child: Container(
@ -163,15 +159,15 @@ class CheckMeAllInOneInfoScreen extends StatelessWidget {
children: [ children: [
if (myTrackersVm.filesLoader) ...[ if (myTrackersVm.filesLoader) ...[
Center(child: CircularProgressIndicator()) Center(child: CircularProgressIndicator())
] else if (myTrackersVm.checkMeOxi != null && myTrackersVm.checkMeOxi.isNotEmpty) ...[ ] else if (myTrackersVm.checkMeOxi != null && myTrackersVm.checkMeOxi!.isNotEmpty) ...[
Material( Material(
child: ListView.separated( child: ListView.separated(
itemCount: myTrackersVm.checkMeOxi.length, itemCount: myTrackersVm.checkMeOxi!.length,
separatorBuilder: (context, index) => SizedBox(height: 14), separatorBuilder: (context, index) => SizedBox(height: 14),
shrinkWrap: true, shrinkWrap: true,
reverse: false, reverse: false,
itemBuilder: (context, index) { itemBuilder: (context, index) {
CheckMeOxiModel checkMeOxiModel = myTrackersVm.checkMeOxi[index]; CheckMeOxiModel checkMeOxiModel = myTrackersVm.checkMeOxi![index];
return InkWell( return InkWell(
onTap: () => Navigator.pop(context), onTap: () => Navigator.pop(context),
child: Container( child: Container(
@ -205,15 +201,15 @@ class CheckMeAllInOneInfoScreen extends StatelessWidget {
children: [ children: [
if (myTrackersVm.filesLoader) ...[ if (myTrackersVm.filesLoader) ...[
Center(child: CircularProgressIndicator()) Center(child: CircularProgressIndicator())
] else if (myTrackersVm.checkMeBP != null && myTrackersVm.checkMeBP.isNotEmpty) ...[ ] else if (myTrackersVm.checkMeBP != null && myTrackersVm.checkMeBP!.isNotEmpty) ...[
Material( Material(
child: ListView.separated( child: ListView.separated(
itemCount: myTrackersVm.checkMeBP.length, itemCount: myTrackersVm.checkMeBP!.length,
separatorBuilder: (context, index) => SizedBox(height: 14), separatorBuilder: (context, index) => SizedBox(height: 14),
shrinkWrap: true, shrinkWrap: true,
reverse: false, reverse: false,
itemBuilder: (context, index) { itemBuilder: (context, index) {
CheckMeBPModel checkMeBPModel = myTrackersVm.checkMeBP[index]; CheckMeBPModel checkMeBPModel = myTrackersVm.checkMeBP![index];
return InkWell( return InkWell(
onTap: () => Navigator.pop(context), onTap: () => Navigator.pop(context),
child: Container( child: Container(
@ -247,15 +243,15 @@ class CheckMeAllInOneInfoScreen extends StatelessWidget {
children: [ children: [
if (myTrackersVm.filesLoader) ...[ if (myTrackersVm.filesLoader) ...[
Center(child: CircularProgressIndicator()) Center(child: CircularProgressIndicator())
] else if (myTrackersVm.checkMeGlucose != null && myTrackersVm.checkMeGlucose.isNotEmpty) ...[ ] else if (myTrackersVm.checkMeGlucose != null && myTrackersVm.checkMeGlucose!.isNotEmpty) ...[
Material( Material(
child: ListView.separated( child: ListView.separated(
itemCount: myTrackersVm.checkMeGlucose.length, itemCount: myTrackersVm.checkMeGlucose!.length,
separatorBuilder: (context, index) => SizedBox(height: 14), separatorBuilder: (context, index) => SizedBox(height: 14),
shrinkWrap: true, shrinkWrap: true,
reverse: false, reverse: false,
itemBuilder: (context, index) { itemBuilder: (context, index) {
CheckMeGlucoseModel checkMeGlucoseModel = myTrackersVm.checkMeGlucose[index]; CheckMeGlucoseModel checkMeGlucoseModel = myTrackersVm.checkMeGlucose![index];
return InkWell( return InkWell(
onTap: () => null, onTap: () => null,
child: Container( child: Container(
@ -293,7 +289,7 @@ class CheckMeAllInOneInfoScreen extends StatelessWidget {
child: Padding( child: Padding(
padding: const EdgeInsets.all(24.0), padding: const EdgeInsets.all(24.0),
child: Consumer( child: Consumer(
builder: (BuildContext context, MyTrackersViewModel myTrackersVm, Widget child) { builder: (BuildContext context, MyTrackersViewModel myTrackersVm, Widget? child) {
return getAllInOneOperationWidgets(myTrackersVm, allInOneTrackerTypeEnum, context); return getAllInOneOperationWidgets(myTrackersVm, allInOneTrackerTypeEnum, context);
}, },
), ),

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

@ -30,6 +30,9 @@ class CheckMeECGInfoScreen extends StatelessWidget {
case TrackerTypeEnum.ECGTracker: case TrackerTypeEnum.ECGTracker:
return "ECG"; return "ECG";
case TrackerTypeEnum.SmartRing:
return "Smart Ring";
case TrackerTypeEnum.WeightScale: case TrackerTypeEnum.WeightScale:
return "Weight Scale"; return "Weight Scale";
@ -42,7 +45,6 @@ class CheckMeECGInfoScreen extends StatelessWidget {
case TrackerTypeEnum.AllInOneTracker: case TrackerTypeEnum.AllInOneTracker:
return "All in One"; return "All in One";
} }
return "All in One";
} }
Widget buildECGDetailsWidget(MyTrackersViewModel myTrackersVm, BuildContext context) { Widget buildECGDetailsWidget(MyTrackersViewModel myTrackersVm, BuildContext context) {
@ -55,18 +57,18 @@ class CheckMeECGInfoScreen extends StatelessWidget {
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [ children: [
Text("HR: ${myTrackersVm.checkMeECGWave.hr} bpm"), Text("HR: ${myTrackersVm.checkMeECGWave!.hr} bpm"),
Text("ST: ${myTrackersVm.checkMeECGWave.st} mV"), Text("ST: ${myTrackersVm.checkMeECGWave!.st} mV"),
Text("QRS: ${myTrackersVm.checkMeECGWave.qrs} ms"), Text("QRS: ${myTrackersVm.checkMeECGWave!.qrs} ms"),
], ],
), ),
mHeight(4.0), mHeight(4.0),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [ children: [
Text("PVCS: ${myTrackersVm.checkMeECGWave.pvcs} "), Text("PVCS: ${myTrackersVm.checkMeECGWave!.pvcs} "),
Text("QTC: ${myTrackersVm.checkMeECGWave.qtc} ms"), Text("QTC: ${myTrackersVm.checkMeECGWave!.qtc} ms"),
Text("QT: ${myTrackersVm.checkMeECGWave.qt} ms"), Text("QT: ${myTrackersVm.checkMeECGWave!.qt} ms"),
], ],
), ),
], ],
@ -86,7 +88,7 @@ class CheckMeECGInfoScreen extends StatelessWidget {
child: Padding( child: Padding(
padding: const EdgeInsets.all(24.0), padding: const EdgeInsets.all(24.0),
child: Consumer( child: Consumer(
builder: (BuildContext context, MyTrackersViewModel myTrackersVm, Widget child) { builder: (BuildContext context, MyTrackersViewModel myTrackersVm, Widget? child) {
if (myTrackersVm.checkMeECGWave == null) { if (myTrackersVm.checkMeECGWave == null) {
return Padding( return Padding(
padding: const EdgeInsets.all(24.0), padding: const EdgeInsets.all(24.0),
@ -102,7 +104,7 @@ class CheckMeECGInfoScreen extends StatelessWidget {
children: [ children: [
buildECGDetailsWidget(myTrackersVm, context), buildECGDetailsWidget(myTrackersVm, context),
mHeight(20), 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: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/pages/medical/my_trackers/my_trackers_view_model/my_trackers_view_model.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
@ -11,14 +9,14 @@ import 'package:provider/provider.dart';
class AndesAllInOneConnectScreenIos extends StatefulWidget { class AndesAllInOneConnectScreenIos extends StatefulWidget {
final BleDeviceModel deviceModel; final BleDeviceModel deviceModel;
const AndesAllInOneConnectScreenIos({this.deviceModel}); const AndesAllInOneConnectScreenIos({required this.deviceModel});
@override @override
State<AndesAllInOneConnectScreenIos> createState() => _AndesAllInOneConnectScreenState(); State<AndesAllInOneConnectScreenIos> createState() => _AndesAllInOneConnectScreenState();
} }
class _AndesAllInOneConnectScreenState extends State<AndesAllInOneConnectScreenIos> { class _AndesAllInOneConnectScreenState extends State<AndesAllInOneConnectScreenIos> {
MyTrackersViewModel myTrackersVm; late MyTrackersViewModel myTrackersVm;
@override @override
void initState() { void initState() {
@ -37,7 +35,7 @@ class _AndesAllInOneConnectScreenState extends State<AndesAllInOneConnectScreenI
return Expanded( return Expanded(
child: ListView( child: ListView(
children: [ children: [
if (myTrackersViewModel.andesfitWeightScaleData == null && (myTrackersViewModel.isAndesfitDeviceConnected != null && myTrackersViewModel.isAndesfitDeviceConnected)) ...[ if (myTrackersViewModel.andesfitWeightScaleData == null && (myTrackersViewModel.isAndesfitDeviceConnected != null && myTrackersViewModel.isAndesfitDeviceConnected!)) ...[
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
@ -79,7 +77,7 @@ class _AndesAllInOneConnectScreenState extends State<AndesAllInOneConnectScreenI
body: Padding( body: Padding(
padding: const EdgeInsets.all(24.0), padding: const EdgeInsets.all(24.0),
child: Consumer( child: Consumer(
builder: (BuildContext context, MyTrackersViewModel myTrackersViewModel, Widget child) { builder: (BuildContext context, MyTrackersViewModel myTrackersViewModel, Widget? child) {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,

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

@ -17,14 +17,14 @@ import 'package:provider/provider.dart';
class ECGConnectScreen extends StatefulWidget { class ECGConnectScreen extends StatefulWidget {
final BleDeviceModel deviceModel; final BleDeviceModel deviceModel;
const ECGConnectScreen({this.deviceModel}); const ECGConnectScreen({required this.deviceModel});
@override @override
State<ECGConnectScreen> createState() => _ECGConnectScreenState(); State<ECGConnectScreen> createState() => _ECGConnectScreenState();
} }
class _ECGConnectScreenState extends State<ECGConnectScreen> { class _ECGConnectScreenState extends State<ECGConnectScreen> {
MyTrackersViewModel myTrackersVm; late MyTrackersViewModel myTrackersVm;
@override @override
void initState() { void initState() {
@ -39,7 +39,7 @@ class _ECGConnectScreenState extends State<ECGConnectScreen> {
super.dispose(); super.dispose();
} }
Widget buildStatus(int currentStatus) { Widget buildStatus(int? currentStatus) {
String resultStatus = ""; String resultStatus = "";
if (currentStatus == 0) { if (currentStatus == 0) {
@ -72,8 +72,6 @@ class _ECGConnectScreenState extends State<ECGConnectScreen> {
); );
} }
showHistoryDialog(BuildContext context) { showHistoryDialog(BuildContext context) {
return showDialog( return showDialog(
context: context, context: context,
@ -82,7 +80,7 @@ class _ECGConnectScreenState extends State<ECGConnectScreen> {
padding: const EdgeInsets.all(20), padding: const EdgeInsets.all(20),
margin: const EdgeInsets.symmetric(vertical: 35, horizontal: 30), margin: const EdgeInsets.symmetric(vertical: 35, horizontal: 30),
child: SingleChildScrollView( child: SingleChildScrollView(
child: Consumer(builder: (BuildContext context, MyTrackersViewModel myTrackersVm, Widget child) { child: Consumer(builder: (BuildContext context, MyTrackersViewModel myTrackersVm, Widget? child) {
return Column( return Column(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@ -169,21 +167,21 @@ class _ECGConnectScreenState extends State<ECGConnectScreen> {
Column( Column(
children: [ children: [
Text("Record Time", style: TextStyle(fontSize: 20)), 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)), Text("seconds", style: TextStyle(fontSize: 10)),
], ],
), ),
Column( Column(
children: [ children: [
Text("♥︎", style: TextStyle(fontSize: 20)), 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)), Text("/min", style: TextStyle(fontSize: 10)),
], ],
), ),
], ],
), ),
mHeight(30.0), 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 { class OxymeterConnectScreen extends StatefulWidget {
final BleDeviceModel deviceModel; final BleDeviceModel deviceModel;
const OxymeterConnectScreen({this.deviceModel}); const OxymeterConnectScreen({required this.deviceModel});
@override @override
State<OxymeterConnectScreen> createState() => _OxymeterConnectScreenState(); State<OxymeterConnectScreen> createState() => _OxymeterConnectScreenState();
} }
class _OxymeterConnectScreenState extends State<OxymeterConnectScreen> { class _OxymeterConnectScreenState extends State<OxymeterConnectScreen> {
MyTrackersViewModel myTrackersVm; late MyTrackersViewModel myTrackersVm;
@override @override
void initState() { void initState() {
@ -42,7 +42,7 @@ class _OxymeterConnectScreenState extends State<OxymeterConnectScreen> {
body: Padding( body: Padding(
padding: const EdgeInsets.all(24.0), padding: const EdgeInsets.all(24.0),
child: Consumer( child: Consumer(
builder: (BuildContext context, MyTrackersViewModel myTrackersViewModel, Widget child) { builder: (BuildContext context, MyTrackersViewModel myTrackersViewModel, Widget? child) {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
@ -58,27 +58,27 @@ class _OxymeterConnectScreenState extends State<OxymeterConnectScreen> {
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [ children: [
if (myTrackersViewModel.oxyRtModel.isProbeOff) ...[ if (myTrackersViewModel.oxyRtModel!.isProbeOff ?? false) ...[
Text("Check Probe", style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)), Text("Check Probe", style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
] else ...[ ] else ...[
Column( Column(
children: [ children: [
Text("SPO₂", style: TextStyle(fontSize: 20)), 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)), Text("%", style: TextStyle(fontSize: 10)),
], ],
), ),
Column( Column(
children: [ children: [
Text("Pulse", style: TextStyle(fontSize: 20)), 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)), Text("bpm", style: TextStyle(fontSize: 10)),
], ],
), ),
Column( Column(
children: [ children: [
Text("PI", style: TextStyle(fontSize: 20)), 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)), Text("%", style: TextStyle(fontSize: 10)),
], ],
), ),

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

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

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

@ -7,5 +7,5 @@ class WeightScaleData {
String muscle; String muscle;
String bmr; 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'; import 'package:flutter_blue_plus/flutter_blue_plus.dart';
class BleDeviceModel { class BleDeviceModel {
String macAddr; String? macAddr;
int model; int? model;
String name; String? name;
int rssi; int? rssi;
TrackerTypeEnum deviceType; TrackerTypeEnum? deviceType;
BluetoothDevice andesfitBluetoothDevice; 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) { BleDeviceModel.fromJson(Map<String, dynamic> json, TrackerTypeEnum trackerType) {
macAddr = json['macAddr']; macAddr = json['macAddr'];
@ -17,11 +23,11 @@ class BleDeviceModel {
name = json['name']; name = json['name'];
rssi = json['rssi']; rssi = json['rssi'];
deviceType = trackerType; deviceType = trackerType;
andesfitBluetoothDevice = null; andesfitBluetoothDevice = null; // You can remove this line if it's intended to be null by default
} }
@override @override
String toString() { 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 { class CheckMeInfoModel {
String region; String? region;
String model; String? model;
String hardwareVer; String? hardwareVer;
String softwareVer; String? softwareVer;
String languageVer; String? languageVer;
String curLanguage; String? curLanguage;
String fileVer; String? fileVer;
String sPCPVer; String? sPCPVer;
String application; String? application;
String sN; String? sN;
String branchCode; String? branchCode;
CheckMeInfoModel( CheckMeInfoModel({
{this.region, required this.region,
this.model, required this.model,
this.hardwareVer, required this.hardwareVer,
this.softwareVer, required this.softwareVer,
this.languageVer, required this.languageVer,
this.curLanguage, required this.curLanguage,
this.fileVer, required this.fileVer,
this.sPCPVer, required this.sPCPVer,
this.application, required this.application,
this.sN, required this.sN,
this.branchCode}); required this.branchCode,
});
@override @override
String toString() { String toString() {

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -21,27 +21,27 @@ class _BloodPressureBLEState extends State<BloodPressureBLE> {
String currentBPmmHG = "0/0 mmHG"; String currentBPmmHG = "0/0 mmHG";
String currentPulse = "0 PPM"; String currentPulse = "0 PPM";
BluetoothDevice currentConnectedDevice; BluetoothDevice? currentConnectedDevice;
StreamSubscription bloodPressureReadingStream; StreamSubscription? bloodPressureReadingStream;
StreamSubscription bleDevicesStream; StreamSubscription? bleDevicesStream;
StreamSubscription bleDeviceConnectionStream; StreamSubscription? bleDeviceConnectionStream;
final bleConnectionStatus = ValueNotifier<String>("Disconnected"); final bleConnectionStatus = ValueNotifier<String>("Disconnected");
Timer _timer; Timer? _timer;
@override @override
void dispose() { void dispose() {
super.dispose(); super.dispose();
if (bleDevicesStream != null) bleDevicesStream.cancel(); if (bleDevicesStream != null) bleDevicesStream!.cancel();
if (currentConnectedDevice != null) currentConnectedDevice.disconnect(); if (currentConnectedDevice != null) currentConnectedDevice!.disconnect();
bleConnectionStatus.dispose(); bleConnectionStatus.dispose();
if (bleDeviceConnectionStream != null) bleDeviceConnectionStream.cancel(); if (bleDeviceConnectionStream != null) bleDeviceConnectionStream!.cancel();
if (bloodPressureReadingStream != null) bloodPressureReadingStream.cancel(); if (bloodPressureReadingStream != null) bloodPressureReadingStream!.cancel();
if (currentConnectedDevice != null) currentConnectedDevice.disconnect(); if (currentConnectedDevice != null) currentConnectedDevice!.disconnect();
if (_timer != null && _timer.isActive) _timer.cancel(); if (_timer != null && _timer!.isActive) _timer!.cancel();
} }
@override @override
@ -89,7 +89,7 @@ class _BloodPressureBLEState extends State<BloodPressureBLE> {
); );
} else { } else {
FlutterBluePlus.stopScan(); 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) { if (element.device.localName.isNotEmpty) {
log("blueToothDevices: ${element.device.localName}"); log("blueToothDevices: ${element.device.localName}");
if (element.device.localName.toLowerCase() == "pm101897") { if (element.device.localName.toLowerCase() == "pm101897") {
bleDevicesStream.cancel(); bleDevicesStream!.cancel();
element.device.connect(timeout: Duration(seconds: 30), autoConnect: false).then((value) async { element.device.connect(timeout: Duration(seconds: 30), autoConnect: false).then((value) async {
bleConnectionStatus.value = "Connected..."; bleConnectionStatus.value = "Connected...";
print("Device Connected-------"); print("Device Connected-------");
currentConnectedDevice = element.device; currentConnectedDevice = element.device;
bleDeviceConnectionStream = currentConnectedDevice.connectionState.listen((event) { bleDeviceConnectionStream = currentConnectedDevice!.connectionState.listen((event) {
if (event == BluetoothConnectionState.disconnected) { if (event == BluetoothConnectionState.disconnected) {
bleConnectionStatus.value = "Disconnected..."; bleConnectionStatus.value = "Disconnected...";
print("Device Disconnected-------"); print("Device Disconnected-------");
@ -231,13 +231,13 @@ void startBLEConnectionII() {
await characteristic.setNotifyValue(true); await characteristic.setNotifyValue(true);
} }
}); });
return true; return ;
} }
}); });
} }
}); });
await element.device.connect(timeout: Duration(seconds: 35)); 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 { 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; final BluetoothAdapterState adapterState;

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

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

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

@ -1,4 +1,3 @@
import 'dart:io';
import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/ble_utils.dart'; import 'package:diplomaticquarterapp/uitl/ble_utils.dart';
@ -19,12 +18,12 @@ class _TemperatureHomePageState extends State<TemperatureHomePage> {
String connectionStatus = "disconnected"; String connectionStatus = "disconnected";
String currentTempInCelsius = "0.0"; String currentTempInCelsius = "0.0";
BluetoothDevice currentConnectedDevice; BluetoothDevice? currentConnectedDevice;
@override @override
void dispose() { void dispose() {
super.dispose(); super.dispose();
currentConnectedDevice.disconnect(timeout: 15); currentConnectedDevice!.disconnect(timeout: 15);
} }
@override @override
@ -68,7 +67,7 @@ class _TemperatureHomePageState extends State<TemperatureHomePage> {
); );
} else { } else {
FlutterBluePlus.stopScan(); 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); await characteristic.setNotifyValue(true);
} }
}); });
return true; return;
} }
}); });
} }
}); });
await element.device.connect(timeout: Duration(seconds: 35)); 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'; import 'package:flutter/material.dart';
class EKGChartView extends StatefulWidget { class EKGChartView extends StatefulWidget {
ECGFileDetailModel ekgFileDetailResponseModel; final ECGFileDetailModel ekgFileDetailResponseModel;
EKGChartView({@required this.ekgFileDetailResponseModel}); EKGChartView({required this.ekgFileDetailResponseModel});
@override @override
State<EKGChartView> createState() => _EKGChartViewState(); State<EKGChartView> createState() => _EKGChartViewState();
@ -22,7 +22,7 @@ class _EKGChartViewState extends State<EKGChartView> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
List<int> list = widget.ekgFileDetailResponseModel.shortData; List<int> list = widget.ekgFileDetailResponseModel.shortData ?? [];
List<List<int>> mainList = chunkIntList(list, 1250); List<List<int>> mainList = chunkIntList(list, 1250);
return AppScaffold( return AppScaffold(
@ -48,13 +48,13 @@ class _EKGChartViewState extends State<EKGChartView> {
horizontalInterval: 30, horizontalInterval: 30,
getDrawingVerticalLine: (value) { getDrawingVerticalLine: (value) {
return FlLine( return FlLine(
color: Colors.red[300], color: Colors.red[300]!,
strokeWidth: 0.4, strokeWidth: 0.4,
); );
}, },
getDrawingHorizontalLine: (value) { getDrawingHorizontalLine: (value) {
return FlLine( return FlLine(
color: Colors.red[300], color: Colors.red[300]!,
strokeWidth: 0.4, strokeWidth: 0.4,
); );
}, },
@ -75,7 +75,7 @@ class _EKGChartViewState extends State<EKGChartView> {
barWidth: 0.5, barWidth: 0.5,
dotData: FlDotData(show: false), dotData: FlDotData(show: false),
spots: getDataList(mainList[index]), spots: getDataList(mainList[index]),
colors: [Colors.grey[800]], color: Colors.grey[800],
isStrokeCapRound: true, isStrokeCapRound: true,
belowBarData: BarAreaData(show: false), belowBarData: BarAreaData(show: false),
), ),

@ -36,29 +36,27 @@ class _EKG_BLEState extends State<EKG_BLE> {
List<ECGFileDetailModel> ekgFileDetailResponseModelList = []; List<ECGFileDetailModel> ekgFileDetailResponseModelList = [];
ECGRtModel ekgRealTimeDataResponseModel; ECGRtModel? ekgRealTimeDataResponseModel;
List<int> ecgBytesAllDataList = []; List<int> ecgBytesAllDataList = [];
Timer timer; Timer? timer;
List<_ChartData> chartData; late List<_ChartData> chartData;
int count; int count = 0;
ChartSeriesController _chartSeriesController; ChartSeriesController? _chartSeriesController;
@override @override
void dispose() { void dispose() {
ekgValueNotifier.dispose(); ekgValueNotifier.dispose();
super.dispose(); super.dispose();
BleChannel.disconnect(); BleChannel.disconnect();
timer?.cancel(); timer!.cancel();
chartData.clear(); chartData!.clear();
_chartSeriesController = null; _chartSeriesController = null;
} }
@override @override
void initState() { void initState() {
// TODO: implement initState
count = 19; count = 19;
chartData = <_ChartData>[ chartData = <_ChartData>[
_ChartData(0, 42), _ChartData(0, 42),
@ -95,7 +93,7 @@ class _EKG_BLEState extends State<EKG_BLE> {
onRendererCreated: (ChartSeriesController controller) { onRendererCreated: (ChartSeriesController controller) {
_chartSeriesController = controller; _chartSeriesController = controller;
}, },
dataSource: chartData, dataSource: chartData!,
color: const Color.fromRGBO(192, 108, 132, 1), color: const Color.fromRGBO(192, 108, 132, 1),
xValueMapper: (_ChartData sales, _) => sales.country, xValueMapper: (_ChartData sales, _) => sales.country,
yValueMapper: (_ChartData sales, _) => sales.sales, yValueMapper: (_ChartData sales, _) => sales.sales,
@ -108,12 +106,12 @@ class _EKG_BLEState extends State<EKG_BLE> {
chartData.add(_ChartData(count, _getRandomInt(10, 100))); chartData.add(_ChartData(count, _getRandomInt(10, 100)));
if (chartData.length == 20) { if (chartData.length == 20) {
chartData.removeAt(0); chartData.removeAt(0);
_chartSeriesController?.updateDataSource( _chartSeriesController!.updateDataSource(
addedDataIndexes: <int>[chartData.length - 1], addedDataIndexes: <int>[chartData.length - 1],
removedDataIndexes: <int>[0], removedDataIndexes: <int>[0],
); );
} else { } else {
_chartSeriesController?.updateDataSource( _chartSeriesController!.updateDataSource(
addedDataIndexes: <int>[chartData.length - 1], addedDataIndexes: <int>[chartData.length - 1],
); );
} }
@ -254,11 +252,11 @@ class _EKG_BLEState extends State<EKG_BLE> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text(ekgFileDetailResponseModel.fileName), Text(ekgFileDetailResponseModel.fileName!),
mHeight(6.0), mHeight(6.0),
Text("Duration: ${ekgFileDetailResponseModel.duration} seconds"), Text("Duration: ${ekgFileDetailResponseModel.duration} seconds"),
mHeight(6.0), 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) { String parseEKGRealTimeDataObject(dynamic returnData) {
ekgRealTimeDataResponseModel = ECGRtModel.fromJson(json.decode(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> { class _SP20PulseTrackerState extends State<SP20PulseTracker> {
EventChannel eventChannel = EventChannel('BLE-Platform-Bridge-Event'); EventChannel eventChannel = EventChannel('BLE-Platform-Bridge-Event');
// final bpDataNotifierMeasuring = ValueNotifier<BpRtDataMeasuringModel>(BpRtDataMeasuringModel()); final sp20RtParamNotifier = ValueNotifier<OxyRtModel>(OxyRtModel(
final sp20RtParamNotifier = ValueNotifier<OxyRtModel>(OxyRtModel()); isCheckProbe: null,
final sp20StatusNotifier = ValueNotifier<String>(""); isProbeOff: null,
isPulseSearching: null,
pi: null,
pr: null,
spo2: null,
));
final ValueNotifier<String> sp20StatusNotifier = ValueNotifier<String>("");
final bpDeviceDataNotifier = ValueNotifier<String>(""); final bpDeviceDataNotifier = ValueNotifier<String>("");
String deviceName = "SP20"; String deviceName = "SP20";
@ -61,7 +67,7 @@ class _SP20PulseTrackerState extends State<SP20PulseTracker> {
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [ children: [
Text( Text(
value == null || value.isEmpty ? "" : "Connected", value.isEmpty ? "" : "Connected",
style: TextStyle(fontSize: 18), style: TextStyle(fontSize: 18),
), ),
Text( Text(
@ -86,7 +92,7 @@ class _SP20PulseTrackerState extends State<SP20PulseTracker> {
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [ children: [
if (sp20RtModel.isProbeOff) ...[ if (sp20RtModel.isProbeOff ?? false) ...[
Text("Check Probe", style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)), Text("Check Probe", style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)),
] else ...[ ] else ...[
Column( Column(
@ -137,7 +143,7 @@ class _SP20PulseTrackerState extends State<SP20PulseTracker> {
ValueListenableBuilder( ValueListenableBuilder(
valueListenable: sp20StatusNotifier, valueListenable: sp20StatusNotifier,
builder: (context, value, _) { builder: (context, value, _) {
if (value == null || value.isEmpty) { if (value.isEmpty) {
return Row( return Row(
children: [ children: [
Expanded( Expanded(

@ -20,12 +20,12 @@ class _WeightScaleBLEState extends State<WeightScaleBLE> {
String connectionStatus = "disconnected"; String connectionStatus = "disconnected";
String currentWeight = "0.0"; String currentWeight = "0.0";
BluetoothDevice currentConnectedDevice; BluetoothDevice? currentConnectedDevice;
StreamSubscription bleDevicesStream; StreamSubscription? bleDevicesStream;
StreamSubscription weightValuesStream; StreamSubscription? weightValuesStream;
WeightScaleData weightScaleData = WeightScaleData(); WeightScaleData? weightScaleData ;
final bleConnectionStatus = ValueNotifier<String>("Disconnected"); final bleConnectionStatus = ValueNotifier<String>("Disconnected");
@ -36,9 +36,9 @@ class _WeightScaleBLEState extends State<WeightScaleBLE> {
void dispose() { void dispose() {
super.dispose(); super.dispose();
bleConnectionStatus.dispose(); bleConnectionStatus.dispose();
bleDevicesStream.cancel(); bleDevicesStream!.cancel();
weightValuesStream.cancel(); weightValuesStream!.cancel();
currentConnectedDevice.disconnect(); currentConnectedDevice!.disconnect();
} }
@override @override
@ -84,13 +84,13 @@ class _WeightScaleBLEState extends State<WeightScaleBLE> {
), ),
Column( Column(
children: [ children: [
Text("Current Weight: ${weightScaleData.weight}" + " kg"), Text("Current Weight: ${weightScaleData!.weight}" + " kg"),
Text("Current BMI: ${weightScaleData.bmi}"), Text("Current BMI: ${weightScaleData!.bmi}"),
Text("Current Body Fat: ${weightScaleData.fat}" + "%"), Text("Current Body Fat: ${weightScaleData!.fat}" + "%"),
Text("Current Bone Weight: ${weightScaleData.bone}" + " kg"), Text("Current Bone Weight: ${weightScaleData!.bone}" + " kg"),
Text("Current Water: ${weightScaleData.water}" + "%"), Text("Current Water: ${weightScaleData!.water}" + "%"),
Text("Current Muscle: ${weightScaleData.muscle}" + "%"), Text("Current Muscle: ${weightScaleData!.muscle}" + "%"),
Text("Current BMR: ${weightScaleData.bmr}" + " calories/day"), Text("Current BMR: ${weightScaleData!.bmr}" + " calories/day"),
], ],
), ),
// }) // })
@ -99,7 +99,7 @@ class _WeightScaleBLEState extends State<WeightScaleBLE> {
); );
} else { } else {
FlutterBluePlus.stopScan(); 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 { blueToothDevices.forEach((element) async {
if (element.device.localName.isNotEmpty) { if (element.device.localName.isNotEmpty) {
if (element.device.localName.toLowerCase() == "sdic") { if (element.device.localName.toLowerCase() == "sdic") {
bleDevicesStream.cancel(); bleDevicesStream!.cancel();
element.device.connect(timeout: Duration(seconds: 5), autoConnect: false).then((value) async { element.device.connect(timeout: Duration(seconds: 5), autoConnect: false).then((value) async {
bleConnectionStatus.value = "Connected..."; bleConnectionStatus.value = "Connected...";
print("Device Connected-------"); print("Device Connected-------");
@ -170,7 +170,7 @@ class _WeightScaleBLEState extends State<WeightScaleBLE> {
}); });
await Future.delayed(Duration(milliseconds: 500)).then((value) async { await Future.delayed(Duration(milliseconds: 500)).then((value) async {
print("Delayed fff1 done"); 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 { await Future.delayed(Duration(milliseconds: 1000)).then((value) async {
print("Delayed fff2 done"); 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 // 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)); print((int.parse(hexStringWater, radix: 16) * 0.1).toStringAsFixed(1));
setState(() { setState(() {
weightScaleData.weight = (int.parse(hexStringWeight, 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!.bmi = (int.parse(hexStringBMI, radix: 16) * 0.1).toStringAsFixed(1);
weightScaleData.fat = (int.parse(hexStringFat, 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!.muscle = (int.parse(hexStringMuscle, radix: 16) * 0.1).toStringAsFixed(1);
weightScaleData.bmr = (int.parse(hexStringBMR, radix: 16)).toString(); weightScaleData!.bmr = (int.parse(hexStringBMR, radix: 16)).toString();
weightScaleData.bone = (int.parse(hexStringBone, radix: 16) * 0.1).toStringAsFixed(1); weightScaleData!.bone = (int.parse(hexStringBone, radix: 16) * 0.1).toStringAsFixed(1);
weightScaleData.water = (int.parse(hexStringWater, 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 { Future<void> addPayfortApplePayResponse(num patientID, {PayFortResult? result}) async {
Map<String, dynamic> body = { Map<String, dynamic> body = {
"Fort_id": result!.fortId, "Fort_id": result!.fortId,
"CommandType": result!.command, "CommandType": result.command,
"Amount": (num.parse(result.amount!) / 100), "Amount": (num.parse(result.amount!) / 100),
"Payment_Option": result.paymentOption, "Payment_Option": result.paymentOption,
"Customer_IP": result.customerIp, "Customer_IP": result.customerIp,

@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart';
class BluetoothOffScreen extends StatelessWidget { 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; final BluetoothAdapterState adapterState;

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

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

Loading…
Cancel
Save