|
|
|
@ -1,5 +1,8 @@
|
|
|
|
|
|
|
|
import 'package:diplomaticquarterapp/config/config.dart';
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart';
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart';
|
|
|
|
import 'package:diplomaticquarterapp/pages/base/base_view.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/uitl/translations_delegate_base.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
@ -8,17 +11,31 @@ import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class ProfileSettings extends StatefulWidget {
|
|
|
|
class ProfileSettings extends StatefulWidget {
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
_ProfileSettings createState() => _ProfileSettings();
|
|
|
|
_ProfileSettings createState() => _ProfileSettings();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class _ProfileSettings extends State<ProfileSettings>
|
|
|
|
class _ProfileSettings extends State<ProfileSettings>
|
|
|
|
with TickerProviderStateMixin {
|
|
|
|
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) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
bool isVibration = true;
|
|
|
|
|
|
|
|
var language = 1;
|
|
|
|
|
|
|
|
return BaseView<DashboardViewModel>(
|
|
|
|
return BaseView<DashboardViewModel>(
|
|
|
|
onModelReady: (model) => model.getPatientRadOrders(),
|
|
|
|
onModelReady: (model) =>{},
|
|
|
|
builder: (_, model, wi) => Container(
|
|
|
|
builder: (_, model, wi) => Container(
|
|
|
|
child:
|
|
|
|
child:
|
|
|
|
ListView(scrollDirection: Axis.vertical, children: <Widget>[
|
|
|
|
ListView(scrollDirection: Axis.vertical, children: <Widget>[
|
|
|
|
@ -62,7 +79,10 @@ class _ProfileSettings extends State<ProfileSettings>
|
|
|
|
value: 2,
|
|
|
|
value: 2,
|
|
|
|
groupValue: language,
|
|
|
|
groupValue: language,
|
|
|
|
onChanged: (value) {
|
|
|
|
onChanged: (value) {
|
|
|
|
language = value;
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
language = value;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
],
|
|
|
|
],
|
|
|
|
@ -79,7 +99,10 @@ class _ProfileSettings extends State<ProfileSettings>
|
|
|
|
value: 1,
|
|
|
|
value: 1,
|
|
|
|
groupValue: language,
|
|
|
|
groupValue: language,
|
|
|
|
onChanged: (value) {
|
|
|
|
onChanged: (value) {
|
|
|
|
language = value;
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
language = value;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
],
|
|
|
|
],
|
|
|
|
@ -97,10 +120,10 @@ class _ProfileSettings extends State<ProfileSettings>
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
AppText(TranslationBase.of(context).emailAlert),
|
|
|
|
AppText(TranslationBase.of(context).emailAlert),
|
|
|
|
Switch(
|
|
|
|
Switch(
|
|
|
|
value: isVibration,
|
|
|
|
value: emailAlert,
|
|
|
|
onChanged: (value) {
|
|
|
|
onChanged: (value) {
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
isVibration = value;
|
|
|
|
emailAlert = value;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
activeTrackColor: Colors.lightGreenAccent,
|
|
|
|
activeTrackColor: Colors.lightGreenAccent,
|
|
|
|
@ -117,10 +140,10 @@ class _ProfileSettings extends State<ProfileSettings>
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
AppText(TranslationBase.of(context).smsAlert),
|
|
|
|
AppText(TranslationBase.of(context).smsAlert),
|
|
|
|
Switch(
|
|
|
|
Switch(
|
|
|
|
value: isVibration,
|
|
|
|
value: smsAlert,
|
|
|
|
onChanged: (value) {
|
|
|
|
onChanged: (value) {
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
isVibration = value;
|
|
|
|
smsAlert = value;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
activeTrackColor: Colors.lightGreenAccent,
|
|
|
|
activeTrackColor: Colors.lightGreenAccent,
|
|
|
|
@ -141,7 +164,7 @@ class _ProfileSettings extends State<ProfileSettings>
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
AppText(TranslationBase.of(context).email),
|
|
|
|
AppText(TranslationBase.of(context).email),
|
|
|
|
TextField(
|
|
|
|
TextField(
|
|
|
|
style: TextStyle(color: Colors.red),
|
|
|
|
controller: emailController,
|
|
|
|
decoration: InputDecoration(
|
|
|
|
decoration: InputDecoration(
|
|
|
|
suffixIcon: Icon(Icons.edit),
|
|
|
|
suffixIcon: Icon(Icons.edit),
|
|
|
|
))
|
|
|
|
))
|
|
|
|
@ -156,7 +179,7 @@ class _ProfileSettings extends State<ProfileSettings>
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
AppText(TranslationBase.of(context).emergencyName),
|
|
|
|
AppText(TranslationBase.of(context).emergencyName),
|
|
|
|
TextField(
|
|
|
|
TextField(
|
|
|
|
style: TextStyle(color: Colors.red),
|
|
|
|
controller: emergencyContactName,
|
|
|
|
decoration: InputDecoration(
|
|
|
|
decoration: InputDecoration(
|
|
|
|
suffixIcon: Icon(Icons.edit),
|
|
|
|
suffixIcon: Icon(Icons.edit),
|
|
|
|
))
|
|
|
|
))
|
|
|
|
@ -171,7 +194,7 @@ class _ProfileSettings extends State<ProfileSettings>
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
AppText(TranslationBase.of(context).emergencyContact),
|
|
|
|
AppText(TranslationBase.of(context).emergencyContact),
|
|
|
|
TextField(
|
|
|
|
TextField(
|
|
|
|
style: TextStyle(color: Colors.red),
|
|
|
|
controller: emergencyContact,
|
|
|
|
decoration: InputDecoration(
|
|
|
|
decoration: InputDecoration(
|
|
|
|
suffixIcon: Icon(Icons.edit),
|
|
|
|
suffixIcon: Icon(Icons.edit),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -186,11 +209,44 @@ class _ProfileSettings extends State<ProfileSettings>
|
|
|
|
child: DefaultButton(
|
|
|
|
child: DefaultButton(
|
|
|
|
TranslationBase.of(context).submit,
|
|
|
|
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<String, dynamic> 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)
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|