merge-requests/268/head
HMG\Lama.Herbish 4 years ago
parent ca82024f9e
commit 031be1ac56

@ -1,5 +1,8 @@
import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/stepsTracker.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:fit_kit/fit_kit.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class HealthDataList extends StatefulWidget { class HealthDataList extends StatefulWidget {
@ -8,13 +11,30 @@ class HealthDataList extends StatefulWidget {
} }
class _HealthDataListState extends State<HealthDataList> { class _HealthDataListState extends State<HealthDataList> {
List<DataType> dataTypes = List();
@override
void initState() {
dataTypes.add(DataType.DISTANCE);
dataTypes.add(DataType.STEP_COUNT);
dataTypes.add(DataType.HEART_RATE);
dataTypes.add(DataType.SLEEP);
dataTypes.add(DataType.ENERGY);
super.initState();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AppScaffold( return AppScaffold(
appBarTitle: "Smartwatches", appBarTitle: "Smartwatches",
isShowAppBar: true, isShowAppBar: true,
body: Container( body: Container(
height: MediaQuery.of(context).size.height, height: MediaQuery
.of(context)
.size
.height,
margin: EdgeInsets.all(20.0), margin: EdgeInsets.all(20.0),
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
@ -58,21 +78,31 @@ class _HealthDataListState extends State<HealthDataList> {
Divider( Divider(
color: Colors.grey[500], color: Colors.grey[500],
), ),
Row( InkWell(
children: [ onTap: () {
Container( Navigator.push(
child: Image.asset( context,
"assets/images/SmartWatches/heartrate_icon.png", FadePage(
width: 60.0, page: StepsTracker(),
height: 60.0), ),
), );
Container( },
margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0), child: Row(
child: Text("Steps", children: [
style: TextStyle( Container(
fontSize: 20.0, fontWeight: FontWeight.bold)), child: Image.asset(
), "assets/images/SmartWatches/heartrate_icon.png",
], width: 60.0,
height: 60.0),
),
Container(
margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0),
child: Text("Steps",
style: TextStyle(
fontSize: 20.0, fontWeight: FontWeight.bold)),
),
],
),
), ),
Divider( Divider(
color: Colors.grey[500], color: Colors.grey[500],
@ -121,25 +151,68 @@ class _HealthDataListState extends State<HealthDataList> {
), ),
bottomSheet: Container( bottomSheet: Container(
width: double.infinity, width: double.infinity,
height: MediaQuery.of(context).size.height * 0.1, height: MediaQuery
.of(context)
.size
.height * 0.1,
color: Colors.grey[100], color: Colors.grey[100],
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Divider( Divider(
color: Colors.transparent, color: Colors.transparent,
), ),
Container( InkWell(
width: MediaQuery.of(context).size.width * 0.8, onTap: () {
child: Button( print("ReadLast");
onTap: () { readLast();
// launch(model.radImageURL); },
}, child:Container(
label: 'Sync Health Data', height: (MediaQuery
backgroundColor: Colors.grey[800], .of(context)
), .size
), .height/2)*0.12,
width: MediaQuery
.of(context)
.size
.width * 0.8,
decoration: BoxDecoration(
color: Colors.grey[800],
borderRadius: BorderRadius.circular(6.0),
),
child: Container(
padding: EdgeInsets.only(top: 10.0),
child: Text(
'Sync Health Data' , textAlign: TextAlign.center,style: TextStyle(
color: Colors.white , fontSize: 18.0
),
),
),),),
], ],
), ),
)); ));
} }
}
void readLast() async {
print("ReadLast");
final result = await FitKit.readLast(DataType.DISTANCE);
print(result);
print(result);
}
void readAll() async {
if (await FitKit.requestPermissions(dataTypes)) {
for (DataType type in dataTypes) {
final results = await FitKit.read(
type,
dateFrom: DateTime.now().subtract(Duration(days: 7)),
dateTo: DateTime.now(),
limit: 100,
);
print(results);
print(results.length);
}
readLast();
}
}
}

@ -4,6 +4,7 @@ import 'package:carousel_slider/carousel_slider.dart';
import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/health_data_list.dart'; import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/health_data_list.dart';
import 'package:diplomaticquarterapp/services/smartwatch_integration/SmartWatchIntegrationService.dart'; import 'package:diplomaticquarterapp/services/smartwatch_integration/SmartWatchIntegrationService.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:smart_progress_bar/smart_progress_bar.dart'; import 'package:smart_progress_bar/smart_progress_bar.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
@ -88,8 +89,9 @@ class _SmartWatchInstructionsState extends State<SmartWatchInstructions> {
width: 70.0, width: 70.0,
height: 70.0), height: 70.0),
Container( Container(
width: MediaQuery.of(context).size.width*0.22,
child: Text( child: Text(
"Apple Watch Series 1", "Apple Watch Series 1", overflow: TextOverflow.clip,
style: TextStyle( style: TextStyle(
fontSize: 12.0)), fontSize: 12.0)),
) )
@ -108,8 +110,9 @@ class _SmartWatchInstructionsState extends State<SmartWatchInstructions> {
width: 70.0, width: 70.0,
height: 70.0), height: 70.0),
Container( Container(
width: MediaQuery.of(context).size.width*0.22,
child: Text( child: Text(
"Apple Watch Series 2", "Apple Watch Series 2", overflow: TextOverflow.clip,
style: TextStyle( style: TextStyle(
fontSize: 12.0)), fontSize: 12.0)),
) )
@ -135,8 +138,9 @@ class _SmartWatchInstructionsState extends State<SmartWatchInstructions> {
width: 70.0, width: 70.0,
height: 70.0), height: 70.0),
Container( Container(
width: MediaQuery.of(context).size.width*0.22,
child: Text( child: Text(
"Apple Watch Series 3", "Apple Watch Series 3", overflow: TextOverflow.clip,
style: TextStyle( style: TextStyle(
fontSize: 12.0)), fontSize: 12.0)),
) )
@ -155,8 +159,9 @@ class _SmartWatchInstructionsState extends State<SmartWatchInstructions> {
width: 70.0, width: 70.0,
height: 70.0), height: 70.0),
Container( Container(
width: MediaQuery.of(context).size.width*0.22,
child: Text( child: Text(
"Apple Watch Series 4", "Apple Watch Series 4", overflow: TextOverflow.clip ,
style: TextStyle( style: TextStyle(
fontSize: 12.0)), fontSize: 12.0)),
) )
@ -182,8 +187,9 @@ class _SmartWatchInstructionsState extends State<SmartWatchInstructions> {
width: 70.0, width: 70.0,
height: 70.0), height: 70.0),
Container( Container(
width: MediaQuery.of(context).size.width*0.22,
child: Text( child: Text(
"Apple Watch Series 5", "Apple Watch Series 5", overflow: TextOverflow.clip,
style: TextStyle( style: TextStyle(
fontSize: 12.0)), fontSize: 12.0)),
) )
@ -202,8 +208,9 @@ class _SmartWatchInstructionsState extends State<SmartWatchInstructions> {
width: 70.0, width: 70.0,
height: 70.0), height: 70.0),
Container( Container(
width: MediaQuery.of(context).size.width*0.22,
child: Text( child: Text(
"Apple Watch Series 6", "Apple Watch Series 6", overflow: TextOverflow.clip,
style: TextStyle( style: TextStyle(
fontSize: 12.0)), fontSize: 12.0)),
) )
@ -229,7 +236,8 @@ class _SmartWatchInstructionsState extends State<SmartWatchInstructions> {
width: 70.0, width: 70.0,
height: 70.0), height: 70.0),
Container( Container(
child: Text("Mi Band 3", width: MediaQuery.of(context).size.width*0.22,
child: Text("Mi Band 3", overflow: TextOverflow.clip,
style: TextStyle( style: TextStyle(
fontSize: 12.0)), fontSize: 12.0)),
) )
@ -248,7 +256,8 @@ class _SmartWatchInstructionsState extends State<SmartWatchInstructions> {
width: 70.0, width: 70.0,
height: 70.0), height: 70.0),
Container( Container(
child: Text("Mi Band 4", width: MediaQuery.of(context).size.width*0.22,
child: Text("Mi Band 4", overflow: TextOverflow.clip,
style: TextStyle( style: TextStyle(
fontSize: 12.0)), fontSize: 12.0)),
) )
@ -417,9 +426,9 @@ class _SmartWatchInstructionsState extends State<SmartWatchInstructions> {
child: CarouselSlider( child: CarouselSlider(
carouselController: buttonCarouselController, carouselController: buttonCarouselController,
options: CarouselOptions( options: CarouselOptions(
enableInfiniteScroll: false, // enableInfiniteScroll: true,
viewportFraction: 0.95, viewportFraction: 0.99,
height: MediaQuery.of(context).size.height * 0.9), height: MediaQuery.of(context).size.height*1.02 ),
items: [1, 2].map((i) { items: [1, 2].map((i) {
return Builder( return Builder(
builder: (BuildContext context) { builder: (BuildContext context) {
@ -427,7 +436,8 @@ class _SmartWatchInstructionsState extends State<SmartWatchInstructions> {
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
margin: EdgeInsets.symmetric(horizontal: 5.0), margin: EdgeInsets.symmetric(horizontal: 5.0),
child: Card( child: Card(
margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), margin: EdgeInsets.only(top:16.0 , bottom: 8.0),
// fromLTRB(8.0, 16.0, 8.0, 8.0),
color: Colors.white.withOpacity(1.0), color: Colors.white.withOpacity(1.0),
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
@ -457,8 +467,9 @@ class _SmartWatchInstructionsState extends State<SmartWatchInstructions> {
width: 70.0, width: 70.0,
height: 70.0), height: 70.0),
Container( Container(
width: MediaQuery.of(context).size.width*0.22,
child: Text( child: Text(
"Huawei Watch 2", "Huawei Watch 2", overflow: TextOverflow.clip,
style: TextStyle( style: TextStyle(
fontSize: 12.0)), fontSize: 12.0)),
) )
@ -477,8 +488,10 @@ class _SmartWatchInstructionsState extends State<SmartWatchInstructions> {
width: 70.0, width: 70.0,
height: 70.0), height: 70.0),
Container( Container(
width: MediaQuery.of(context).size.width*0.22,
child: Text( child: Text(
"Mobovi TicWatch E2", "Mobovi TicWatch E2",
overflow: TextOverflow.clip,
style: TextStyle( style: TextStyle(
fontSize: 12.0)), fontSize: 12.0)),
) )
@ -504,7 +517,8 @@ class _SmartWatchInstructionsState extends State<SmartWatchInstructions> {
width: 70.0, width: 70.0,
height: 70.0), height: 70.0),
Container( Container(
child: Text("Huawei Watch", width: MediaQuery.of(context).size.width*0.22,
child: Text("Huawei Watch", overflow: TextOverflow.clip,
style: TextStyle( style: TextStyle(
fontSize: 12.0)), fontSize: 12.0)),
) )
@ -523,7 +537,8 @@ class _SmartWatchInstructionsState extends State<SmartWatchInstructions> {
width: 70.0, width: 70.0,
height: 70.0), height: 70.0),
Container( Container(
child: Text("Fossil Sport", width: MediaQuery.of(context).size.width*0.22,
child: Text("Fossil Sport", overflow: TextOverflow.clip,
style: TextStyle( style: TextStyle(
fontSize: 12.0)), fontSize: 12.0)),
) )
@ -549,8 +564,9 @@ class _SmartWatchInstructionsState extends State<SmartWatchInstructions> {
width: 70.0, width: 70.0,
height: 70.0), height: 70.0),
Container( Container(
width: MediaQuery.of(context).size.width*0.22,
child: Text( child: Text(
"MisFit Vapor 2", "MisFit Vapor 2", overflow: TextOverflow.clip,
style: TextStyle( style: TextStyle(
fontSize: 12.0)), fontSize: 12.0)),
) )
@ -569,8 +585,9 @@ class _SmartWatchInstructionsState extends State<SmartWatchInstructions> {
width: 70.0, width: 70.0,
height: 70.0), height: 70.0),
Container( Container(
width: MediaQuery.of(context).size.width*0.22,
child: Text( child: Text(
"LG Watch Sport", "LG Watch Sport", overflow: TextOverflow.clip,
style: TextStyle( style: TextStyle(
fontSize: 12.0)), fontSize: 12.0)),
) )
@ -596,7 +613,8 @@ class _SmartWatchInstructionsState extends State<SmartWatchInstructions> {
width: 70.0, width: 70.0,
height: 70.0), height: 70.0),
Container( Container(
child: Text("Mi Band 3", width: MediaQuery.of(context).size.width*0.22,
child: Text("Mi Band 3", overflow: TextOverflow.clip,
style: TextStyle( style: TextStyle(
fontSize: 12.0)), fontSize: 12.0)),
) )
@ -615,7 +633,8 @@ class _SmartWatchInstructionsState extends State<SmartWatchInstructions> {
width: 70.0, width: 70.0,
height: 70.0), height: 70.0),
Container( Container(
child: Text("Mi Band 4", width: MediaQuery.of(context).size.width*0.22,
child: Text("Mi Band 4", overflow: TextOverflow.clip,
style: TextStyle( style: TextStyle(
fontSize: 12.0)), fontSize: 12.0)),
) )
@ -735,7 +754,7 @@ class _SmartWatchInstructionsState extends State<SmartWatchInstructions> {
), ),
Container( Container(
margin: EdgeInsets.fromLTRB( margin: EdgeInsets.fromLTRB(
15.0, 95.0, 15.0, 15.0), 15.0, 75.0, 15.0, 15.0),
child: ButtonTheme( child: ButtonTheme(
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: borderRadius:

@ -84,6 +84,7 @@ class _StepsTrackerState extends State<StepsTracker>
print(res['Med_GetYearStepsTransactionsStsList']); print(res['Med_GetYearStepsTransactionsStsList']);
yearlyStepsList.clear(); yearlyStepsList.clear();
res['Med_GetYearStepsTransactionsStsList'].forEach((element) { res['Med_GetYearStepsTransactionsStsList'].forEach((element) {
print('in forEach');
yearlyStepsList.add(new YearlyStepsResModel.fromJson(element)); yearlyStepsList.add(new YearlyStepsResModel.fromJson(element));
if (element['ValueSum'] != null) { if (element['ValueSum'] != null) {
double value = element['ValueSum']; double value = element['ValueSum'];
@ -91,7 +92,7 @@ class _StepsTrackerState extends State<StepsTracker>
dataLength++; dataLength++;
} }
}); });
print("innnnnnnnnnnnnnnnn");
print(avgStepsValue); print(avgStepsValue);
print(dataLength); print(dataLength);
setState(() { setState(() {

Loading…
Cancel
Save