Merge branch 'Haroon' into 'master'
Haroon See merge request Cloud_Solution/diplomatic-quarter!74merge-update-with-lab-changes
@ -1,36 +1,11 @@
|
|||||||
package com.cloud.diplomaticquarterapp
|
package com.cloud.diplomaticquarterapp
|
||||||
import android.content.ContentResolver
|
import androidx.annotation.NonNull;
|
||||||
import android.content.Context
|
import io.flutter.embedding.android.FlutterFragmentActivity
|
||||||
import android.media.RingtoneManager
|
import io.flutter.embedding.engine.FlutterEngine
|
||||||
import io.flutter.embedding.android.FlutterActivity
|
import io.flutter.plugins.GeneratedPluginRegistrant
|
||||||
import io.flutter.embedding.engine.FlutterEngine
|
|
||||||
import io.flutter.plugin.common.MethodCall
|
|
||||||
import io.flutter.plugin.common.MethodChannel
|
|
||||||
import io.flutter.plugins.GeneratedPluginRegistrant
|
|
||||||
|
|
||||||
class MainActivity : FlutterActivity() {
|
class MainActivity: FlutterFragmentActivity() {
|
||||||
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
|
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
|
||||||
GeneratedPluginRegistrant.registerWith(flutterEngine)
|
GeneratedPluginRegistrant.registerWith(flutterEngine);
|
||||||
MethodChannel(flutterEngine.dartExecutor, "crossingthestreams.io/resourceResolver").setMethodCallHandler { call: MethodCall, result: MethodChannel.Result ->
|
}
|
||||||
if ("drawableToUri" == call.method) {
|
|
||||||
val resourceId = this@MainActivity.resources.getIdentifier(call.arguments as String, "drawable", this@MainActivity.packageName)
|
|
||||||
result.success(resourceToUriString(this@MainActivity.applicationContext, resourceId))
|
|
||||||
}
|
|
||||||
if ("getAlarmUri" == call.method) {
|
|
||||||
result.success(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM).toString())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private fun resourceToUriString(context: Context, resId: Int): String {
|
|
||||||
return (ContentResolver.SCHEME_ANDROID_RESOURCE
|
|
||||||
+ "://"
|
|
||||||
+ context.resources.getResourcePackageName(resId)
|
|
||||||
+ "/"
|
|
||||||
+ context.resources.getResourceTypeName(resId)
|
|
||||||
+ "/"
|
|
||||||
+ context.resources.getResourceEntryName(resId))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
After Width: | Height: | Size: 130 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 60 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 76 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 154 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
@ -0,0 +1,145 @@
|
|||||||
|
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class HealthDataList extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_HealthDataListState createState() => _HealthDataListState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _HealthDataListState extends State<HealthDataList> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return AppScaffold(
|
||||||
|
appBarTitle: "Smartwatches",
|
||||||
|
isShowAppBar: true,
|
||||||
|
body: Container(
|
||||||
|
height: MediaQuery.of(context).size.height,
|
||||||
|
margin: EdgeInsets.all(20.0),
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
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("Heart Rate",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20.0, fontWeight: FontWeight.bold)),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Divider(
|
||||||
|
color: Colors.grey[500],
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
child: Image.asset(
|
||||||
|
"assets/images/SmartWatches/sleep_data.png",
|
||||||
|
width: 60.0,
|
||||||
|
height: 60.0),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0),
|
||||||
|
child: Text("Sleep Data",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20.0, fontWeight: FontWeight.bold)),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Divider(
|
||||||
|
color: Colors.grey[500],
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
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(
|
||||||
|
color: Colors.grey[500],
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
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("Distance",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20.0, fontWeight: FontWeight.bold)),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Divider(
|
||||||
|
color: Colors.grey[500],
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
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("Energy",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20.0, fontWeight: FontWeight.bold)),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Divider(
|
||||||
|
color: Colors.grey[500],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
bottomSheet: Container(
|
||||||
|
width: double.infinity,
|
||||||
|
height: MediaQuery.of(context).size.height * 0.1,
|
||||||
|
color: Colors.grey[100],
|
||||||
|
child: Column(
|
||||||
|
children: <Widget>[
|
||||||
|
Divider(
|
||||||
|
color: Colors.transparent,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.8,
|
||||||
|
child: Button(
|
||||||
|
onTap: () {
|
||||||
|
// launch(model.radImageURL);
|
||||||
|
},
|
||||||
|
label: 'Sync Health Data',
|
||||||
|
backgroundColor: Colors.grey[800],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,819 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:carousel_slider/carousel_slider.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/widgets/others/app_scaffold_widget.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:smart_progress_bar/smart_progress_bar.dart';
|
||||||
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
|
class SmartWatchInstructions extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_SmartWatchInstructionsState createState() => _SmartWatchInstructionsState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SmartWatchInstructionsState extends State<SmartWatchInstructions> {
|
||||||
|
CarouselController buttonCarouselController = CarouselController();
|
||||||
|
|
||||||
|
bool hasAlreadySynced = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||||
|
getLastPatientRecord(context);
|
||||||
|
});
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return AppScaffold(
|
||||||
|
appBarTitle: "Sync Health Data",
|
||||||
|
isShowAppBar: true,
|
||||||
|
body: Container(
|
||||||
|
child: Platform.isIOS
|
||||||
|
? _getAppleWatchInstructions()
|
||||||
|
: _getGoogleWatchInstructions(),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
_getAppleWatchInstructions() {
|
||||||
|
return SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(top: 10.0),
|
||||||
|
child: CarouselSlider(
|
||||||
|
carouselController: buttonCarouselController,
|
||||||
|
options: CarouselOptions(
|
||||||
|
enableInfiniteScroll: false,
|
||||||
|
viewportFraction: 0.95,
|
||||||
|
height: MediaQuery.of(context).size.height * 0.9),
|
||||||
|
items: [1, 2].map((i) {
|
||||||
|
return Builder(
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
width: MediaQuery.of(context).size.width,
|
||||||
|
margin: EdgeInsets.symmetric(horizontal: 5.0),
|
||||||
|
child: Card(
|
||||||
|
margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0),
|
||||||
|
color: Colors.white.withOpacity(1.0),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
),
|
||||||
|
child: i == 1
|
||||||
|
? Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(top: 10.0),
|
||||||
|
child: Text("Supported Smartwatches",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 22.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontFamily: "WorkSans")),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
margin:
|
||||||
|
EdgeInsets.only(top: 10.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
"assets/images/SmartWatches/apple-watch-1.jpeg",
|
||||||
|
width: 70.0,
|
||||||
|
height: 70.0),
|
||||||
|
Container(
|
||||||
|
child: Text(
|
||||||
|
"Apple Watch Series 1",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12.0)),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
margin:
|
||||||
|
EdgeInsets.only(top: 10.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
"assets/images/SmartWatches/apple-watch-2.jpg",
|
||||||
|
width: 70.0,
|
||||||
|
height: 70.0),
|
||||||
|
Container(
|
||||||
|
child: Text(
|
||||||
|
"Apple Watch Series 2",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12.0)),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(top: 10.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
margin:
|
||||||
|
EdgeInsets.only(top: 15.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
"assets/images/SmartWatches/apple-watch-3.jpg",
|
||||||
|
width: 70.0,
|
||||||
|
height: 70.0),
|
||||||
|
Container(
|
||||||
|
child: Text(
|
||||||
|
"Apple Watch Series 3",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12.0)),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
margin:
|
||||||
|
EdgeInsets.only(top: 15.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
"assets/images/SmartWatches/apple-watch-4.jpg",
|
||||||
|
width: 70.0,
|
||||||
|
height: 70.0),
|
||||||
|
Container(
|
||||||
|
child: Text(
|
||||||
|
"Apple Watch Series 4",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12.0)),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(top: 10.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
margin:
|
||||||
|
EdgeInsets.only(top: 15.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
"assets/images/SmartWatches/apple-watch-5.jpg",
|
||||||
|
width: 70.0,
|
||||||
|
height: 70.0),
|
||||||
|
Container(
|
||||||
|
child: Text(
|
||||||
|
"Apple Watch Series 5",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12.0)),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
margin:
|
||||||
|
EdgeInsets.only(top: 15.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
"assets/images/SmartWatches/Apple-Watch-6.png",
|
||||||
|
width: 70.0,
|
||||||
|
height: 70.0),
|
||||||
|
Container(
|
||||||
|
child: Text(
|
||||||
|
"Apple Watch Series 6",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12.0)),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(top: 10.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
margin:
|
||||||
|
EdgeInsets.only(top: 15.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
"assets/images/SmartWatches/miBand3.jpg",
|
||||||
|
width: 70.0,
|
||||||
|
height: 70.0),
|
||||||
|
Container(
|
||||||
|
child: Text("Mi Band 3",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12.0)),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
margin:
|
||||||
|
EdgeInsets.only(top: 15.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
"assets/images/SmartWatches/miBand4.jpg",
|
||||||
|
width: 70.0,
|
||||||
|
height: 70.0),
|
||||||
|
Container(
|
||||||
|
child: Text("Mi Band 4",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12.0)),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.fromLTRB(
|
||||||
|
10.0, 30.0, 10.0, 10.0),
|
||||||
|
child: Text(
|
||||||
|
"It Seems like you haven't synced your health data with the Dr. Alhabib App before. To proceed further, you need to sync your health data with the Dr. Alhabib App",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(fontSize: 17.0)),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.all(10.0),
|
||||||
|
child: Text(
|
||||||
|
"Before syncing data, please make sure that you have followed the instructions properly",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(fontSize: 17.0)),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.all(15.0),
|
||||||
|
child: ButtonTheme(
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.circular(10.0),
|
||||||
|
),
|
||||||
|
minWidth:
|
||||||
|
MediaQuery.of(context).size.width,
|
||||||
|
height: 45.0,
|
||||||
|
child: RaisedButton(
|
||||||
|
color: new Color(0xFF60686b),
|
||||||
|
textColor: Colors.white,
|
||||||
|
disabledTextColor: Colors.white,
|
||||||
|
disabledColor: new Color(0xFFbcc2c4),
|
||||||
|
onPressed: () {
|
||||||
|
buttonCarouselController.nextPage();
|
||||||
|
},
|
||||||
|
child: Text("CONTINUE",
|
||||||
|
style: TextStyle(fontSize: 18.0)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(top: 10.0),
|
||||||
|
child: Text("Watch Instructions:",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 22.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontFamily: "WorkSans")),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.all(10.0),
|
||||||
|
child: Text(
|
||||||
|
"It Seems like you haven't synced your health data with the Dr. Alhabib App before. To proceed further, you need to sync your health data with the Dr. Alhabib App",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(fontSize: 17.0)),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.fromLTRB(
|
||||||
|
10.0, 20.0, 10.0, 10.0),
|
||||||
|
child: Text(
|
||||||
|
"Before syncing data, please make sure that following instructions are met: ",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(fontSize: 17.0)),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.fromLTRB(
|
||||||
|
10.0, 20.0, 10.0, 10.0),
|
||||||
|
child: Text(
|
||||||
|
"1. Make sure that you have installed 'Health' App & 'Watch' App from Apple Store.",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(fontSize: 17.0)),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.all(10.0),
|
||||||
|
child: Text(
|
||||||
|
"2. Make sure that your Apple Watch is connected with the Watch & Health Apps.",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(fontSize: 17.0)),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.all(10.0),
|
||||||
|
child: Text(
|
||||||
|
"3. Make sure that data like heart rate, steps, distance etc. are being shown on your health app.",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(fontSize: 17.0)),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.fromLTRB(
|
||||||
|
15.0, 110.0, 15.0, 15.0),
|
||||||
|
child: ButtonTheme(
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.circular(10.0),
|
||||||
|
),
|
||||||
|
minWidth:
|
||||||
|
MediaQuery.of(context).size.width,
|
||||||
|
height: 45.0,
|
||||||
|
child: RaisedButton(
|
||||||
|
color: new Color(0xFF60686b),
|
||||||
|
textColor: Colors.white,
|
||||||
|
disabledTextColor: Colors.white,
|
||||||
|
disabledColor: new Color(0xFFbcc2c4),
|
||||||
|
onPressed: () {
|
||||||
|
buttonCarouselController.nextPage();
|
||||||
|
},
|
||||||
|
child: Text("SYNC HEALTH DATA",
|
||||||
|
style: TextStyle(fontSize: 18.0)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
hasAlreadySynced ? Container(
|
||||||
|
margin: EdgeInsets.fromLTRB(
|
||||||
|
15.0, 0.0, 15.0, 15.0),
|
||||||
|
child: ButtonTheme(
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.circular(10.0),
|
||||||
|
),
|
||||||
|
minWidth:
|
||||||
|
MediaQuery.of(context).size.width,
|
||||||
|
height: 45.0,
|
||||||
|
child: RaisedButton(
|
||||||
|
color: new Color(0xFF60686b),
|
||||||
|
textColor: Colors.white,
|
||||||
|
disabledTextColor: Colors.white,
|
||||||
|
disabledColor: new Color(0xFFbcc2c4),
|
||||||
|
onPressed: () {
|
||||||
|
_openHealthDataList();
|
||||||
|
},
|
||||||
|
child: Text("ALREADY SYNCED",
|
||||||
|
style: TextStyle(fontSize: 18.0)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
): Container(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
));
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
_getGoogleWatchInstructions() {
|
||||||
|
return SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(top: 10.0),
|
||||||
|
child: CarouselSlider(
|
||||||
|
carouselController: buttonCarouselController,
|
||||||
|
options: CarouselOptions(
|
||||||
|
enableInfiniteScroll: false,
|
||||||
|
viewportFraction: 0.95,
|
||||||
|
height: MediaQuery.of(context).size.height * 0.9),
|
||||||
|
items: [1, 2].map((i) {
|
||||||
|
return Builder(
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
width: MediaQuery.of(context).size.width,
|
||||||
|
margin: EdgeInsets.symmetric(horizontal: 5.0),
|
||||||
|
child: Card(
|
||||||
|
margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0),
|
||||||
|
color: Colors.white.withOpacity(1.0),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
),
|
||||||
|
child: i == 1
|
||||||
|
? Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(top: 10.0),
|
||||||
|
child: Text("Supported Smartwatches",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 22.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontFamily: "WorkSans")),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
margin:
|
||||||
|
EdgeInsets.only(top: 10.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
"assets/images/SmartWatches/huawei-watch-2.png",
|
||||||
|
width: 70.0,
|
||||||
|
height: 70.0),
|
||||||
|
Container(
|
||||||
|
child: Text(
|
||||||
|
"Huawei Watch 2",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12.0)),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
margin:
|
||||||
|
EdgeInsets.only(top: 10.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
"assets/images/SmartWatches/ticwatche2.png",
|
||||||
|
width: 70.0,
|
||||||
|
height: 70.0),
|
||||||
|
Container(
|
||||||
|
child: Text(
|
||||||
|
"Mobovi TicWatch E2",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12.0)),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(top: 10.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
margin:
|
||||||
|
EdgeInsets.only(top: 15.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
"assets/images/SmartWatches/huawei-watch-2-classic.png",
|
||||||
|
width: 70.0,
|
||||||
|
height: 70.0),
|
||||||
|
Container(
|
||||||
|
child: Text("Huawei Watch",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12.0)),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
margin:
|
||||||
|
EdgeInsets.only(top: 15.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
"assets/images/SmartWatches/ticwatche2.png",
|
||||||
|
width: 70.0,
|
||||||
|
height: 70.0),
|
||||||
|
Container(
|
||||||
|
child: Text("Fossil Sport",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12.0)),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(top: 10.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
margin:
|
||||||
|
EdgeInsets.only(top: 15.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
"assets/images/SmartWatches/misfit-vapor-2.jpg",
|
||||||
|
width: 70.0,
|
||||||
|
height: 70.0),
|
||||||
|
Container(
|
||||||
|
child: Text(
|
||||||
|
"MisFit Vapor 2",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12.0)),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
margin:
|
||||||
|
EdgeInsets.only(top: 15.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
"assets/images/SmartWatches/lg-watch-sport.jpg",
|
||||||
|
width: 70.0,
|
||||||
|
height: 70.0),
|
||||||
|
Container(
|
||||||
|
child: Text(
|
||||||
|
"LG Watch Sport",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12.0)),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(top: 10.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
margin:
|
||||||
|
EdgeInsets.only(top: 15.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
"assets/images/SmartWatches/miBand3.jpg",
|
||||||
|
width: 70.0,
|
||||||
|
height: 70.0),
|
||||||
|
Container(
|
||||||
|
child: Text("Mi Band 3",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12.0)),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
margin:
|
||||||
|
EdgeInsets.only(top: 15.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
"assets/images/SmartWatches/miBand4.jpg",
|
||||||
|
width: 70.0,
|
||||||
|
height: 70.0),
|
||||||
|
Container(
|
||||||
|
child: Text("Mi Band 4",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12.0)),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
launch(
|
||||||
|
"https://wearos.google.com/#find-your-watch");
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
margin: EdgeInsets.only(top: 20.0),
|
||||||
|
child: Text(
|
||||||
|
"More Supported Smartwatches...",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 17.0,
|
||||||
|
color: Colors.blue,
|
||||||
|
decoration:
|
||||||
|
TextDecoration.underline)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.all(10.0),
|
||||||
|
child: Text(
|
||||||
|
"It Seems like you haven't synced your health data with the Dr. Alhabib App before. To proceed further, you need to sync your health data with the Dr. Alhabib App",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(fontSize: 17.0)),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.all(10.0),
|
||||||
|
child: Text(
|
||||||
|
"Before syncing data, please make sure that you have followed the instructions properly",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(fontSize: 17.0)),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.all(15.0),
|
||||||
|
child: ButtonTheme(
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.circular(10.0),
|
||||||
|
),
|
||||||
|
minWidth:
|
||||||
|
MediaQuery.of(context).size.width,
|
||||||
|
height: 45.0,
|
||||||
|
child: RaisedButton(
|
||||||
|
color: new Color(0xFF60686b),
|
||||||
|
textColor: Colors.white,
|
||||||
|
disabledTextColor: Colors.white,
|
||||||
|
disabledColor: new Color(0xFFbcc2c4),
|
||||||
|
onPressed: () {
|
||||||
|
buttonCarouselController.nextPage();
|
||||||
|
},
|
||||||
|
child: Text("CONTINUE",
|
||||||
|
style: TextStyle(fontSize: 18.0)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(top: 10.0),
|
||||||
|
child: Text("Watch Instructions:",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 22.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontFamily: "WorkSans")),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.all(10.0),
|
||||||
|
child: Text(
|
||||||
|
"It Seems like you haven't synced your health data with the Dr. Alhabib App before. To proceed further, you need to sync your health data with the Dr. Alhabib App",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(fontSize: 17.0)),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.all(10.0),
|
||||||
|
child: Text(
|
||||||
|
"Before syncing data, please make sure that following instructions are met: ",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(fontSize: 17.0)),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.all(10.0),
|
||||||
|
child: Text(
|
||||||
|
"1. Make sure that you have installed 'WearOS' & 'Google Fit' apps from Google PlayStore.",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(fontSize: 17.0)),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.all(10.0),
|
||||||
|
child: Text(
|
||||||
|
"2. Make sure that you have installed your watch related apps from Google PlayStore.",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(fontSize: 17.0)),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.all(10.0),
|
||||||
|
child: Text(
|
||||||
|
"3. Make sure that your Smart Watch is connected with the WearOS app & your watch apps.",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(fontSize: 17.0)),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.all(10.0),
|
||||||
|
child: Text(
|
||||||
|
"4. Make sure that your smart watch apps are linked/associated with Google Fit App.",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(fontSize: 17.0)),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.fromLTRB(
|
||||||
|
15.0, 95.0, 15.0, 15.0),
|
||||||
|
child: ButtonTheme(
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.circular(10.0),
|
||||||
|
),
|
||||||
|
minWidth:
|
||||||
|
MediaQuery.of(context).size.width,
|
||||||
|
height: 45.0,
|
||||||
|
child: RaisedButton(
|
||||||
|
color: new Color(0xFF60686b),
|
||||||
|
textColor: Colors.white,
|
||||||
|
disabledTextColor: Colors.white,
|
||||||
|
disabledColor: new Color(0xFFbcc2c4),
|
||||||
|
onPressed: () {
|
||||||
|
buttonCarouselController.nextPage();
|
||||||
|
},
|
||||||
|
child: Text("SYNC HEALTH DATA",
|
||||||
|
style: TextStyle(fontSize: 18.0)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
hasAlreadySynced ? Container(
|
||||||
|
margin: EdgeInsets.fromLTRB(
|
||||||
|
15.0, 0.0, 15.0, 15.0),
|
||||||
|
child: ButtonTheme(
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.circular(10.0),
|
||||||
|
),
|
||||||
|
minWidth:
|
||||||
|
MediaQuery.of(context).size.width,
|
||||||
|
height: 45.0,
|
||||||
|
child: RaisedButton(
|
||||||
|
color: new Color(0xFF60686b),
|
||||||
|
textColor: Colors.white,
|
||||||
|
disabledTextColor: Colors.white,
|
||||||
|
disabledColor: new Color(0xFFbcc2c4),
|
||||||
|
onPressed: () {
|
||||||
|
_openHealthDataList();
|
||||||
|
},
|
||||||
|
child: Text("ALREADY SYNCED",
|
||||||
|
style: TextStyle(fontSize: 18.0)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
) : Container(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
));
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
getLastPatientRecord(BuildContext context) {
|
||||||
|
SmartWatchIntegrationService service = new SmartWatchIntegrationService();
|
||||||
|
service.getLastPatientRecord(context).then((res) {
|
||||||
|
if (res['MessageStatus'] == 1) {
|
||||||
|
print(res['Med_GetPatientLastRecordList']);
|
||||||
|
setState(() {
|
||||||
|
if (res['Med_GetPatientLastRecordList'] != null)
|
||||||
|
hasAlreadySynced = true;
|
||||||
|
else
|
||||||
|
hasAlreadySynced = false;
|
||||||
|
});
|
||||||
|
} else {}
|
||||||
|
}).catchError((err) {
|
||||||
|
print(err);
|
||||||
|
}).showProgressBar(
|
||||||
|
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
|
||||||
|
}
|
||||||
|
|
||||||
|
_openHealthDataList() {
|
||||||
|
Navigator.push(
|
||||||
|
context, MaterialPageRoute(builder: (context) => HealthDataList()));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,54 @@
|
|||||||
|
import 'package:diplomaticquarterapp/config/config.dart';
|
||||||
|
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/service/base_service.dart';
|
||||||
|
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
|
||||||
|
import 'package:diplomaticquarterapp/models/Request.dart';
|
||||||
|
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class SmartWatchIntegrationService extends BaseService {
|
||||||
|
AppSharedPreferences sharedPref = AppSharedPreferences();
|
||||||
|
AppGlobal appGlobal = new AppGlobal();
|
||||||
|
|
||||||
|
AuthenticatedUser authUser = new AuthenticatedUser();
|
||||||
|
AuthProvider authProvider = new AuthProvider();
|
||||||
|
|
||||||
|
Future<Map> getLastPatientRecord(BuildContext context) async {
|
||||||
|
Map<String, dynamic> request;
|
||||||
|
|
||||||
|
if (await this.sharedPref.getObject(USER_PROFILE) != null) {
|
||||||
|
var data = AuthenticatedUser.fromJson(
|
||||||
|
await this.sharedPref.getObject(USER_PROFILE));
|
||||||
|
authUser = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
var languageID = await sharedPref.getString(APP_LANGUAGE);
|
||||||
|
Request req = appGlobal.getPublicRequest();
|
||||||
|
|
||||||
|
request = {
|
||||||
|
"LanguageID": languageID == 'ar' ? 1 : 2,
|
||||||
|
"IPAdress": "10.20.10.20",
|
||||||
|
"VersionID": req.VersionID,
|
||||||
|
"Channel": req.Channel,
|
||||||
|
"generalid": 'Cs2020@2016\$2958',
|
||||||
|
"PatientOutSA": authUser.outSA,
|
||||||
|
"TokenID": "",
|
||||||
|
"DeviceTypeID": req.DeviceTypeID,
|
||||||
|
"SessionID": "YckwoXhUmWBsnHKEKig",
|
||||||
|
"PatientID": authUser.patientID != null ? authUser.patientID : 0,
|
||||||
|
"License": true
|
||||||
|
};
|
||||||
|
|
||||||
|
dynamic localRes;
|
||||||
|
|
||||||
|
await baseAppClient.post(GET_PATIENT_LAST_RECORD,
|
||||||
|
onSuccess: (response, statusCode) async {
|
||||||
|
localRes = response;
|
||||||
|
}, onFailure: (String error, int statusCode) {
|
||||||
|
throw error;
|
||||||
|
}, body: request);
|
||||||
|
return Future.value(localRes);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 3.2 KiB |