diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml
index d8fd4e88..beeadd9e 100644
--- a/android/app/src/debug/AndroidManifest.xml
+++ b/android/app/src/debug/AndroidManifest.xml
@@ -3,5 +3,6 @@
+
diff --git a/android/app/src/profile/AndroidManifest.xml b/android/app/src/profile/AndroidManifest.xml
index d8fd4e88..71c11607 100644
--- a/android/app/src/profile/AndroidManifest.xml
+++ b/android/app/src/profile/AndroidManifest.xml
@@ -4,4 +4,5 @@
to allow setting breakpoints, to provide hot reload, etc.
-->
+
diff --git a/lib/pages/settings/general_setting.dart b/lib/pages/settings/general_setting.dart
index 7becd17d..86167b7d 100644
--- a/lib/pages/settings/general_setting.dart
+++ b/lib/pages/settings/general_setting.dart
@@ -19,6 +19,7 @@ class GeneralSettings extends StatefulWidget {
class _GeneralSettings extends State
with TickerProviderStateMixin {
var themeNotifier;
+ var mediaQueryData;
int blindValue = 0;
bool vibration =false;
bool accsibility =false;
@@ -26,7 +27,6 @@ class _GeneralSettings extends State
bool location =false;
var sharedPref = new AppSharedPreferences();
var permission = new PermissionService();
- var mediaQueryData;
@override
void initState() {
getValues();
@@ -81,104 +81,104 @@ class _GeneralSettings extends State
setState(() {
accsibility = value;
});
- //setAccessibility(value);
+ permission.openSettings();
},
activeTrackColor: Colors.lightGreenAccent,
activeColor: Colors.green,
)
],
)),
- Container(
- padding: EdgeInsets.all(10),
- child: AppText(
- TranslationBase.of(context).blindMode,
- color: Colors.black,
- fontWeight: FontWeight.bold,
- ),
- ),
- new Container(
- color: Colors.white,
- padding: EdgeInsets.all(8.0),
- child: new Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- new Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- new Text(
- TranslationBase.of(context).offTheme,
- style: new TextStyle(fontSize: 16.0),
- ),
- Radio(
- value: 0,
- groupValue: blindValue,
- onChanged: (value) {
- setState(() => {this.blindValue = value});
- setTheme(value);
- },
- ),
- ],
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- new Text(
- TranslationBase.of(context).invertTheme,
- style: new TextStyle(
- fontSize: 16.0,
- ),
- ),
- new Radio(
- value: 1,
- groupValue: blindValue,
- onChanged: (value) {
- setState(() => {this.blindValue = value});
- setTheme(value);
- },
- )
- ],
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- new Text(
- TranslationBase.of(context).dimTheme,
- style: new TextStyle(fontSize: 16.0),
- ),
- new Radio(
- value: 2,
- groupValue: blindValue,
- onChanged: (value) {
- setState(() => {this.blindValue = value});
- setTheme(value);
- },
- ),
- ],
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- new Text(
- TranslationBase.of(context).bwTheme,
- style: new TextStyle(fontSize: 16.0),
- ),
- new Radio(
- value: 3,
- groupValue: blindValue,
- onChanged: (value) {
- setState(() => {this.blindValue = value});
-
- setTheme(value);
- },
- ),
- ],
- ),
- ],
- )
- ])),
+ // Container(
+ // padding: EdgeInsets.all(10),
+ // child: AppText(
+ // TranslationBase.of(context).blindMode,
+ // color: Colors.black,
+ // fontWeight: FontWeight.bold,
+ // ),
+ // ),
+ // new Container(
+ // color: Colors.white,
+ // padding: EdgeInsets.all(8.0),
+ // child: new Column(
+ // mainAxisAlignment: MainAxisAlignment.center,
+ // children: [
+ // new Column(
+ // mainAxisAlignment: MainAxisAlignment.center,
+ // children: [
+ // Row(
+ // mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ // children: [
+ // new Text(
+ // TranslationBase.of(context).offTheme,
+ // style: new TextStyle(fontSize: 16.0),
+ // ),
+ // Radio(
+ // value: 0,
+ // groupValue: blindValue,
+ // onChanged: (value) {
+ // setState(() => {this.blindValue = value});
+ // setTheme(value);
+ // },
+ // ),
+ // ],
+ // ),
+ // Row(
+ // mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ // children: [
+ // new Text(
+ // TranslationBase.of(context).invertTheme,
+ // style: new TextStyle(
+ // fontSize: 16.0,
+ // ),
+ // ),
+ // new Radio(
+ // value: 1,
+ // groupValue: blindValue,
+ // onChanged: (value) {
+ // setState(() => {this.blindValue = value});
+ // setTheme(value);
+ // },
+ // )
+ // ],
+ // ),
+ // Row(
+ // mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ // children: [
+ // new Text(
+ // TranslationBase.of(context).dimTheme,
+ // style: new TextStyle(fontSize: 16.0),
+ // ),
+ // new Radio(
+ // value: 2,
+ // groupValue: blindValue,
+ // onChanged: (value) {
+ // setState(() => {this.blindValue = value});
+ // setTheme(value);
+ // },
+ // ),
+ // ],
+ // ),
+ // Row(
+ // mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ // children: [
+ // new Text(
+ // TranslationBase.of(context).bwTheme,
+ // style: new TextStyle(fontSize: 16.0),
+ // ),
+ // new Radio(
+ // value: 3,
+ // groupValue: blindValue,
+ // onChanged: (value) {
+ // setState(() => {this.blindValue = value});
+ //
+ // setTheme(value);
+ // },
+ // ),
+ // ],
+ // ),
+ // ],
+ // )
+ // ])),
Container(
padding: EdgeInsets.all(10),
child: AppText(
@@ -200,6 +200,7 @@ class _GeneralSettings extends State
setState(() {
camera = value;
});
+ permission.setCameraLocationPermission(context);
},
activeTrackColor: Colors.lightGreenAccent,
activeColor: Colors.green,
@@ -219,6 +220,7 @@ class _GeneralSettings extends State
setState(() {
location = value;
});
+ permission.setCameraLocationPermission(context);
},
activeTrackColor: Colors.lightGreenAccent,
activeColor: Colors.green,
@@ -266,16 +268,18 @@ class _GeneralSettings extends State
permission.setVibrationPermission(value);
}
- setAccessibility(){
- if(!accsibility){
-
- }
- // permission.setVibrationPermission(value);
- }
getValues() async{
- blindValue= permission.isThemeEnabled() == null ? 0 : permission.isThemeEnabled();
- vibration = permission.isVibrationEnabled() ==null ? false : permission.isVibrationEnabled();
- // accsibility = mediaQueryData.accessibleNavigation;
+ blindValue= permission.isThemeEnabled() == null ? 0 : permission.isThemeEnabled();
+ vibration = permission.isVibrationEnabled() ==null ? false : permission.isVibrationEnabled();
+ camera = await permission.isCameraEnabled();
+ location = await permission.isLocationEnabled();
+ setState(() {
+ location =location;
+ camera = camera;
+ vibration = vibration;
+ blindValue =blindValue;
+ accsibility = mediaQueryData.accessibleNavigation;
+ });
}
getTheme(value) async{
diff --git a/lib/pages/settings/profile_setting.dart b/lib/pages/settings/profile_setting.dart
index 0658e2e6..c9089351 100644
--- a/lib/pages/settings/profile_setting.dart
+++ b/lib/pages/settings/profile_setting.dart
@@ -1,5 +1,8 @@
+import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
+import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
+import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
@@ -8,17 +11,31 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class ProfileSettings extends StatefulWidget {
+
@override
_ProfileSettings createState() => _ProfileSettings();
}
class _ProfileSettings extends State
with TickerProviderStateMixin {
+ bool smsAlert = true;
+ bool emailAlert = true;
+ int language = 1;
+ final authService = new AuthProvider();
+ TextEditingController emergencyContact = new TextEditingController();
+ TextEditingController emailController = new TextEditingController();
+ TextEditingController emergencyContactName = new TextEditingController();
+ @override
+ void initState() {
+ Future.delayed(new Duration(seconds: 0), () {
+ getSettings(context);
+ });
+ super.initState();
+ }
Widget build(BuildContext context) {
- bool isVibration = true;
- var language = 1;
+
return BaseView(
- onModelReady: (model) => model.getPatientRadOrders(),
+ onModelReady: (model) =>{},
builder: (_, model, wi) => Container(
child:
ListView(scrollDirection: Axis.vertical, children: [
@@ -62,7 +79,10 @@ class _ProfileSettings extends State
value: 2,
groupValue: language,
onChanged: (value) {
- language = value;
+ setState(() {
+ language = value;
+ });
+
},
)
],
@@ -79,7 +99,10 @@ class _ProfileSettings extends State
value: 1,
groupValue: language,
onChanged: (value) {
- language = value;
+ setState(() {
+ language = value;
+ });
+
},
)
],
@@ -97,10 +120,10 @@ class _ProfileSettings extends State
children: [
AppText(TranslationBase.of(context).emailAlert),
Switch(
- value: isVibration,
+ value: emailAlert,
onChanged: (value) {
setState(() {
- isVibration = value;
+ emailAlert = value;
});
},
activeTrackColor: Colors.lightGreenAccent,
@@ -117,10 +140,10 @@ class _ProfileSettings extends State
children: [
AppText(TranslationBase.of(context).smsAlert),
Switch(
- value: isVibration,
+ value: smsAlert,
onChanged: (value) {
setState(() {
- isVibration = value;
+ smsAlert = value;
});
},
activeTrackColor: Colors.lightGreenAccent,
@@ -141,7 +164,7 @@ class _ProfileSettings extends State
children: [
AppText(TranslationBase.of(context).email),
TextField(
- style: TextStyle(color: Colors.red),
+ controller: emailController,
decoration: InputDecoration(
suffixIcon: Icon(Icons.edit),
))
@@ -156,7 +179,7 @@ class _ProfileSettings extends State
children: [
AppText(TranslationBase.of(context).emergencyName),
TextField(
- style: TextStyle(color: Colors.red),
+ controller: emergencyContactName,
decoration: InputDecoration(
suffixIcon: Icon(Icons.edit),
))
@@ -171,7 +194,7 @@ class _ProfileSettings extends State
children: [
AppText(TranslationBase.of(context).emergencyContact),
TextField(
- style: TextStyle(color: Colors.red),
+ controller: emergencyContact,
decoration: InputDecoration(
suffixIcon: Icon(Icons.edit),
),
@@ -186,11 +209,44 @@ class _ProfileSettings extends State
child: DefaultButton(
TranslationBase.of(context).submit,
() {
-// print(mobileNo.text);
+ saveSettings();
},
)),
],
))
])));
}
+
+ getSettings(context){
+ GifLoaderDialogUtils.showMyDialog(context);
+ authService.getSettings().then((result)=>{
+ GifLoaderDialogUtils.hideDialog(context),
+ setValue(result["PateintInfoForUpdateList"][0])
+ });
+ }
+ setValue(value){
+ setState(() {
+ this.language = int.parse(value["PreferredLanguage"]);
+ this.emailAlert = value["IsEmailAlertRequired"];
+ this.smsAlert = value["IsSMSAlertRequired"];
+ this.emailController.text = value["EmailAddress"];
+ this.emergencyContact.text = value["EmergencyContactNo"];
+ this.emergencyContactName.text = value["EmergencyContactName"];
+ });
+
+ }
+ saveSettings(){
+ GifLoaderDialogUtils.showMyDialog(context);
+ Map request = {};
+ request["EmailAddress"] =this.emailController.text;
+ request["EmergencyContactName"] = this.emergencyContactName.text;
+ request["EmergencyContactNo"] = this.emergencyContact.text;
+ request["IsEmailAlertRequired"] = this.emailAlert;
+ request["IsSMSAlertRequired"] = this.smsAlert;
+ request["PreferredLanguage"] = this.language.toString();
+ authService.saveSettings(request).then((result)=>{
+ print(result),
+ GifLoaderDialogUtils.hideDialog(context)
+ });
+ }
}
diff --git a/lib/services/authentication/auth_provider.dart b/lib/services/authentication/auth_provider.dart
index a8517a1e..4dedb37f 100644
--- a/lib/services/authentication/auth_provider.dart
+++ b/lib/services/authentication/auth_provider.dart
@@ -48,7 +48,8 @@ const LOGGED_IN_USER_URL =
const FORGOT_PATIENT_ID =
'Services/Authentication.svc/REST/SendPatientIDSMSByMobileNumber';
const DASHBOARD = 'Services/Patients.svc/REST/PatientDashboard';
-
+const PROFILE_SETTING = 'Services/Patients.svc/REST/GetPateintInfoForUpdate';
+const SAVE_SETTING = 'Services/Patients.svc/REST/UpdatePateintInfo';
class AuthProvider with ChangeNotifier {
bool isLogin = false;
bool isLoading = true;
@@ -457,4 +458,40 @@ class AuthProvider with ChangeNotifier {
//return Future.value(error);
}
}
+ getSettings() async{
+
+ dynamic localRes;
+ try {
+ await new BaseAppClient().post(PROFILE_SETTING,
+ onSuccess: (dynamic response, int statusCode) {
+ localRes = response; //CheckActivationCode.fromJson();
+ }, onFailure: (String error, int statusCode) {
+ localRes = error;
+ return Future.value(error);
+ // throw error;
+ }, body: {});
+ return Future.value(localRes);
+ } catch (error) {
+ throw error;
+ //return Future.value(error);
+ }
+ }
+ Future saveSettings(request) async{
+
+ dynamic localRes;
+ try {
+ await new BaseAppClient().post(SAVE_SETTING,
+ onSuccess: (dynamic response, int statusCode) {
+ localRes = response; //CheckActivationCode.fromJson();
+ }, onFailure: (String error, int statusCode) {
+ localRes = error;
+ return Future.value(error);
+ // throw error;
+ }, body: request);
+ return Future.value(localRes);
+ } catch (error) {
+ throw error;
+ //return Future.value(error);
+ }
+ }
}
diff --git a/lib/services/permission/permission_service.dart b/lib/services/permission/permission_service.dart
index 6f01f3c8..2d618f34 100644
--- a/lib/services/permission/permission_service.dart
+++ b/lib/services/permission/permission_service.dart
@@ -1,3 +1,4 @@
+import 'package:android_intent/android_intent.dart';
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';
@@ -8,7 +9,8 @@ import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:localstorage/localstorage.dart';
-
+import 'package:permission_handler/permission_handler.dart';
+import 'package:vibration/vibration.dart';
class PermissionService extends BaseService {
final LocalStorage storage = new LocalStorage("permission");
@@ -19,12 +21,21 @@ class PermissionService extends BaseService {
}
isVibrationEnabled() {
- return storage.getItem('isVibration') ==null ? false :true;
+ return (storage.getItem('isVibration') ==null) || (storage.getItem('isVibration')) ==false ? false :true;
}
- vibrate(){
+ vibrate(callback, context) async{
+
+ if (callback == null)
+ return null;
if(isVibrationEnabled() ==true){
- HapticFeedback.vibrate();
+ if (await Vibration.hasVibrator()) {
+ Vibration.vibrate(duration: 100);
+ callback();
+ }
+ }else{
+ callback();
}
+
}
@@ -35,5 +46,23 @@ class PermissionService extends BaseService {
isThemeEnabled() {
return storage.getItem('isTheme');
}
-
+ cameraPermission() async{
+ Map statuses = await [
+ Permission.camera,
+ ].request();
+ }
+ isCameraEnabled() async{
+ print(await Permission.camera.status);
+ return await Permission.camera.status == PermissionStatus.granted ? true : false;
+ }
+ setCameraLocationPermission(context) async{
+ Navigator.pop(context);
+ openAppSettings();
+ }
+ isLocationEnabled() async{
+ return await Permission.location.status == PermissionStatus.granted ? true : false;
+ }
+ openSettings() async{
+ openAppSettings();
+ }
}
diff --git a/lib/widgets/buttons/button.dart b/lib/widgets/buttons/button.dart
index 597106c9..457a1d42 100644
--- a/lib/widgets/buttons/button.dart
+++ b/lib/widgets/buttons/button.dart
@@ -90,7 +90,7 @@ class _ButtonState extends State