|
|
|
@ -11,7 +11,7 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/utils.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/utils.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:health/health.dart';
|
|
|
|
// import 'package:health/health.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class syncHealthDataButton extends StatefulWidget {
|
|
|
|
class syncHealthDataButton extends StatefulWidget {
|
|
|
|
syncHealthDataButton();
|
|
|
|
syncHealthDataButton();
|
|
|
|
@ -21,7 +21,7 @@ class syncHealthDataButton extends StatefulWidget {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class _syncHealthDataButtonState extends State<syncHealthDataButton> {
|
|
|
|
class _syncHealthDataButtonState extends State<syncHealthDataButton> {
|
|
|
|
List<HealthDataPoint> _healthDataList = [];
|
|
|
|
// List<HealthDataPoint> _healthDataList = [];
|
|
|
|
|
|
|
|
|
|
|
|
List<healthData> Med_InsertTransactionsInputsList = [];
|
|
|
|
List<healthData> Med_InsertTransactionsInputsList = [];
|
|
|
|
List<healthData> Med_InsertTransactionsInputsList2 = [];
|
|
|
|
List<healthData> Med_InsertTransactionsInputsList2 = [];
|
|
|
|
@ -35,7 +35,7 @@ class _syncHealthDataButtonState extends State<syncHealthDataButton> {
|
|
|
|
int MedCategoryID = 0;
|
|
|
|
int MedCategoryID = 0;
|
|
|
|
|
|
|
|
|
|
|
|
// HealthFactory health = HealthFactory();
|
|
|
|
// HealthFactory health = HealthFactory();
|
|
|
|
List<HealthDataType> types = [HealthDataType.STEPS, HealthDataType.HEART_RATE, Platform.isAndroid ? HealthDataType.DISTANCE_DELTA : HealthDataType.DISTANCE_WALKING_RUNNING];
|
|
|
|
// List<HealthDataType> types = [HealthDataType.STEPS, HealthDataType.HEART_RATE, Platform.isAndroid ? HealthDataType.DISTANCE_DELTA : HealthDataType.DISTANCE_WALKING_RUNNING];
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
void initState() {
|
|
|
|
@ -91,32 +91,32 @@ class _syncHealthDataButtonState extends State<syncHealthDataButton> {
|
|
|
|
|
|
|
|
|
|
|
|
// _healthDataList = HealthFactory.removeDuplicates(_healthDataList);
|
|
|
|
// _healthDataList = HealthFactory.removeDuplicates(_healthDataList);
|
|
|
|
|
|
|
|
|
|
|
|
_healthDataList.forEach((x) {
|
|
|
|
// _healthDataList.forEach((x) {
|
|
|
|
if (x.type == HealthDataType.STEPS) {
|
|
|
|
// if (x.type == HealthDataType.STEPS) {
|
|
|
|
Med_InsertTransactionsInputsList.add(healthData(
|
|
|
|
// Med_InsertTransactionsInputsList.add(healthData(
|
|
|
|
MedCategoryID: 6,
|
|
|
|
// MedCategoryID: 6,
|
|
|
|
MedSubCategoryID: MedSubCategoryID,
|
|
|
|
// MedSubCategoryID: MedSubCategoryID,
|
|
|
|
MachineDate: DateUtil.convertDateToString(x.dateFrom),
|
|
|
|
// MachineDate: DateUtil.convertDateToString(x.dateFrom),
|
|
|
|
Value: double.tryParse(x.value.toString()),
|
|
|
|
// Value: double.tryParse(x.value.toString()),
|
|
|
|
TransactionsListID: TransactionsListID++));
|
|
|
|
// TransactionsListID: TransactionsListID++));
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
if (x.type == HealthDataType.HEART_RATE) {
|
|
|
|
// if (x.type == HealthDataType.HEART_RATE) {
|
|
|
|
Med_InsertTransactionsInputsList.add(healthData(
|
|
|
|
// Med_InsertTransactionsInputsList.add(healthData(
|
|
|
|
MedCategoryID: 3,
|
|
|
|
// MedCategoryID: 3,
|
|
|
|
MedSubCategoryID: MedSubCategoryID,
|
|
|
|
// MedSubCategoryID: MedSubCategoryID,
|
|
|
|
MachineDate: DateUtil.convertDateToString(x.dateFrom),
|
|
|
|
// MachineDate: DateUtil.convertDateToString(x.dateFrom),
|
|
|
|
Value: double.tryParse(x.value.toString()),
|
|
|
|
// Value: double.tryParse(x.value.toString()),
|
|
|
|
TransactionsListID: TransactionsListID++));
|
|
|
|
// TransactionsListID: TransactionsListID++));
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
if (x.type == HealthDataType.DISTANCE_DELTA || x.type == HealthDataType.DISTANCE_WALKING_RUNNING) {
|
|
|
|
// if (x.type == HealthDataType.DISTANCE_DELTA || x.type == HealthDataType.DISTANCE_WALKING_RUNNING) {
|
|
|
|
Med_InsertTransactionsInputsList.add(healthData(
|
|
|
|
// Med_InsertTransactionsInputsList.add(healthData(
|
|
|
|
MedCategoryID: 7,
|
|
|
|
// MedCategoryID: 7,
|
|
|
|
MedSubCategoryID: MedSubCategoryID,
|
|
|
|
// MedSubCategoryID: MedSubCategoryID,
|
|
|
|
MachineDate: DateUtil.convertDateToString(x.dateFrom),
|
|
|
|
// MachineDate: DateUtil.convertDateToString(x.dateFrom),
|
|
|
|
Value: double.tryParse(x.value.toString()),
|
|
|
|
// Value: double.tryParse(x.value.toString()),
|
|
|
|
TransactionsListID: TransactionsListID++));
|
|
|
|
// TransactionsListID: TransactionsListID++));
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
});
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
|
|
getAllHealthDataLists();
|
|
|
|
getAllHealthDataLists();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|