Merge branch 'development_new_design_2.0' of https://gitlab.com/Cloud_Solution/diplomatic-quarter into development_new_design_2.0

merge-requests/390/head
haroon amjad 5 years ago
commit f33272f8d9

@ -1175,6 +1175,7 @@ const Map localizedValues = {
"generalHealth": {"en": "General Health", "ar": "صحة عامة"}, "generalHealth": {"en": "General Health", "ar": "صحة عامة"},
"womanHealth": {"en": "Women's Health", "ar": "صحة المرأة"}, "womanHealth": {"en": "Women's Health", "ar": "صحة المرأة"},
"bmi": {"en": "BMI", "ar": "الكتلة"}, "bmi": {"en": "BMI", "ar": "الكتلة"},
"bloodType": {"en": "Blood Type:", "ar": ":فصيلة الدم"},
"calc-health": {"en": "Calculators", "ar": "الصحية"}, "calc-health": {"en": "Calculators", "ar": "الصحية"},
"calories": {"en": "Calories", "ar": "سعرات"}, "calories": {"en": "Calories", "ar": "سعرات"},
"bmr": {"en": "BMR", "ar": "معدل الأيض القاعدي"}, "bmr": {"en": "BMR", "ar": "معدل الأيض القاعدي"},
@ -1225,7 +1226,7 @@ const Map localizedValues = {
"en": "Choose one of the following symptoms to show the right doctors or choose a consultation to show all", "en": "Choose one of the following symptoms to show the right doctors or choose a consultation to show all",
"ar": "اختر أحد الأعراض التالية لتظهر للأطباء المناسبين أو اختر استشارة لإظهار الكل" "ar": "اختر أحد الأعراض التالية لتظهر للأطباء المناسبين أو اختر استشارة لإظهار الكل"
}, },
"continue": {"en": "CONTINUE", "ar": "إستمرار"}, "continue": {"en": "Continue", "ar": "إستمرار"},
"skip": {"en": "SKIP", "ar": "تخطى"}, "skip": {"en": "SKIP", "ar": "تخطى"},
"calorieCalcDesc": { "calorieCalcDesc": {
"en": "Calculates daily calorie intake based on several factors, like height, weight, age, gender and daily physical activity ", "en": "Calculates daily calorie intake based on several factors, like height, weight, age, gender and daily physical activity ",
@ -1417,10 +1418,7 @@ const Map localizedValues = {
}, },
"dental-procedure-list": {"en": "Dental Procedures for this Appointment: ", "ar": "إجراءات الأسنان لهذا الموعد:"}, "dental-procedure-list": {"en": "Dental Procedures for this Appointment: ", "ar": "إجراءات الأسنان لهذا الموعد:"},
"time-needed": {"en": "Time Needed:", "ar": "الوقت اللازم:"}, "time-needed": {"en": "Time Needed:", "ar": "الوقت اللازم:"},
"total-time-needed": { "total-time-needed": {"en": "Total Appointment Time:", "ar": "وقت المواعيد الكلي:"},
"en": "Total Appointment Time:",
"ar": "وقت المواعيد الكلي:"
},
"info-eye": { "info-eye": {
"en": "This service allows you to view all the eye measurements, lenses, and eyeglasses that have been made in the Habib Medical Group.", "en": "This service allows you to view all the eye measurements, lenses, and eyeglasses that have been made in the Habib Medical Group.",
"ar": " خدمة قياسات النظر: هذه الخدمة تمكنك من الاطلاع على جميع قياسات النظر والعدسات والنظارات التي تمت في مجموعة الحبيب الطبية." "ar": " خدمة قياسات النظر: هذه الخدمة تمكنك من الاطلاع على جميع قياسات النظر والعدسات والنظارات التي تمت في مجموعة الحبيب الطبية."
@ -1434,43 +1432,39 @@ const Map localizedValues = {
"ar": "متابعة قراءاتي: هذه الخدمة تمكنك من تسجيل قراءات قياس السكر والضغط والوزن بشكل دوري ومن ثم الاطلاع عليها كمرجع وكذلك الاطلاع على الرسوم البيانية لمتابعة تطور الحالة." "ar": "متابعة قراءاتي: هذه الخدمة تمكنك من تسجيل قراءات قياس السكر والضغط والوزن بشكل دوري ومن ثم الاطلاع عليها كمرجع وكذلك الاطلاع على الرسوم البيانية لمتابعة تطور الحالة."
}, },
"info-health-data": { "info-health-data": {
"en": "This service is designed to allows you to synchronize the health data from your smart watches into your health record system in Habib Medical Group so that the doctors you are visiting can analyze your health & activity level.", "en":
"This service is designed to allows you to synchronize the health data from your smart watches into your health record system in Habib Medical Group so that the doctors you are visiting can analyze your health & activity level.",
"ar": "تم تصميم هذه الخدمة للسماح لك بمزامنة البيانات الصحية من ساعاتك الذكية الى نظام السجلات الصحية الخاص بك في مجموعة حبيب الطبية حتى يتمكن الأطباء الذين تزورهم من تحليل مستوى صحتك ونشاطك." "ar": "تم تصميم هذه الخدمة للسماح لك بمزامنة البيانات الصحية من ساعاتك الذكية الى نظام السجلات الصحية الخاص بك في مجموعة حبيب الطبية حتى يتمكن الأطباء الذين تزورهم من تحليل مستوى صحتك ونشاطك."
}, },
"info-ask-doc": { "info-ask-doc": {
"en": "This service allows you to ask the doctor you have visited during the last 14 days. When you receive a response from the doctor, you will be notified via the system to view the doctor's reply.", "en":
"This service allows you to ask the doctor you have visited during the last 14 days. When you receive a response from the doctor, you will be notified via the system to view the doctor's reply.",
"ar": "اسال طبيبك: هذه الخدمة تمكنك من توجيه استفسارات الى الطبيب الذي قمت بزيارته خلال اخر 14 يوم وكذلك عند تلقى الرد من الطبيب سوف يتم ابلاغك عن طريق النظام للاطلاع على رد الطبيب." "ar": "اسال طبيبك: هذه الخدمة تمكنك من توجيه استفسارات الى الطبيب الذي قمت بزيارته خلال اخر 14 يوم وكذلك عند تلقى الرد من الطبيب سوف يتم ابلاغك عن طريق النظام للاطلاع على رد الطبيب."
}, },
"info-auto-wifi": { "info-auto-wifi": {
"en": "This service allows you to connect to the Internet directly without the need for entering a user name or password.", "en": "This service allows you to connect to the Internet directly without the need for entering a user name or password.",
"ar": "الاتصال بالانترنت: هذه الخدمة تمكنك من الاتصال بالانترنت مباشرة دون الحاجة الى اسم مستخدم او كلمة مرور." "ar": "الاتصال بالانترنت: هذه الخدمة تمكنك من الاتصال بالانترنت مباشرة دون الحاجة الى اسم مستخدم او كلمة مرور."
}, },
"auto-wifi": { "auto-wifi": {"en": "Connect To Internet", "ar": "الإتصال بالإنترنت"},
"en": "Connect To Internet",
"ar": "الإتصال بالإنترنت"
},
"child-vaccine-info": { "child-vaccine-info": {
"en": "This service to remind you of the deadlines of the necessary vaccinations for your childs against diseases targeted by immunization according to the MOH vaccinations schedule by sending a reminding message and notifications of the vaccination date to the registered mobile phone.", "en":
"ar": "هذه الخدمة تم تصميمها لتذكيرك بالمواعيد النهائية للتحصينات اللازمة لطفلك ضد الأمراض المستهدفة بالتحصين وفقًا لجدول تطعيمات وزارة الصحة عن طريق إرسال رسالة تذكير وإشعارات عن مواعيد التطعيم على الجوال المسجل." "This service to remind you of the deadlines of the necessary vaccinations for your childs against diseases targeted by immunization according to the MOH vaccinations schedule by sending a reminding message and notifications of the vaccination date to the registered mobile phone.",
"ar":
"هذه الخدمة تم تصميمها لتذكيرك بالمواعيد النهائية للتحصينات اللازمة لطفلك ضد الأمراض المستهدفة بالتحصين وفقًا لجدول تطعيمات وزارة الصحة عن طريق إرسال رسالة تذكير وإشعارات عن مواعيد التطعيم على الجوال المسجل."
}, },
"h2o-info": { "h2o-info": {
"en": "This service is designed to help you to set drinking water goals and track the volume of water you are drinking on a daily basis. This service allows for schedule reminders and offers a basic statistical analysis of the amount of what you have consumed over the course of a day, week or month.", "en":
"ar": "تم تصميم هذه الخدمة لمساعدتك في تحديد وتتبع كميات المياه التي يتوجب شربها بشكل يومي. كما توفر هذه الخدمة تذكيرات الجدول الزمني وتقدم تحليلًا إحصائيًا لمقدار ما استهلكته خلال اليوم أو الأسبوع أو الشهر." "This service is designed to help you to set drinking water goals and track the volume of water you are drinking on a daily basis. This service allows for schedule reminders and offers a basic statistical analysis of the amount of what you have consumed over the course of a day, week or month.",
}, "ar":
"ask-doc-empty": { "تم تصميم هذه الخدمة لمساعدتك في تحديد وتتبع كميات المياه التي يتوجب شربها بشكل يومي. كما توفر هذه الخدمة تذكيرات الجدول الزمني وتقدم تحليلًا إحصائيًا لمقدار ما استهلكته خلال اليوم أو الأسبوع أو الشهر."
"en": "This service is available to doctors visited during the past 15 days",
"ar": "هذه الخدمة متاحة للاطباء الذين تمت زيارتهم خلال ال 15 يوم الماضية"
},
"online-clinics": {
"en": "Online Clinics: ",
"ar": "​العيادات المفتوحة: "
},
"offline-clinics": {
"en": "Offline Clinics: ",
"ar": "العيادات المغلقة: "
},
"clinic-schedule": {
"en": "Clinic Schedule",
"ar": "جدول العيادة"
}, },
"sys/dias": {"en": "SBP/DBP", "ar": "إنقباض/إنبساط"},
"arm": {"en": "Arm", "ar": "الذراع"},
"remove-measure": {"en": "Remove this measure", "ar": "إزالة هذا القياس؟"},
"select-arm": {"en": "Select the Arm", "ar": "إختر الذراع"},
"ask-doc-empty": {"en": "This service is available to doctors visited during the past 15 days", "ar": "هذه الخدمة متاحة للاطباء الذين تمت زيارتهم خلال ال 15 يوم الماضية"},
"online-clinics": {"en": "Online Clinics: ", "ar": "​العيادات المفتوحة: "},
"offline-clinics": {"en": "Offline Clinics: ", "ar": "العيادات المغلقة: "},
"clinic-schedule": {"en": "Clinic Schedule", "ar": "جدول العيادة"},
}; };

@ -122,16 +122,7 @@ class _NewCMCPageState extends State<NewCMCPage> with TickerProviderStateMixin {
height: MediaQuery.of(context).size.height * 0.8, height: MediaQuery.of(context).size.height * 0.8,
child: Column( child: Column(
children: [ children: [
if (widget.model.cmcAllOrderDetail.length == 0)
Container(
margin: EdgeInsets.only(
left: MediaQuery.of(context).size.width * 0.05,
right: MediaQuery.of(context).size.width * 0.05),
child: StepsWidget(
index: _currentIndex,
changeCurrentTab: changePageViewIndex,
),
),
Expanded( Expanded(
child: PageView( child: PageView(
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
@ -376,12 +367,15 @@ class _NewCMCPageState extends State<NewCMCPage> with TickerProviderStateMixin {
), ),
), ),
) )
: NewCMCStepOnePage( : Container(
changePageViewIndex: changePageViewIndex, color: Colors.red,
cMCInsertPresOrderRequestModel: child: NewCMCStepOnePage(
cMCInsertPresOrderRequestModel, changePageViewIndex: changePageViewIndex,
model: widget.model, cMCInsertPresOrderRequestModel:
), cMCInsertPresOrderRequestModel,
model: widget.model,
),
),
NewCMCStepTowPage( NewCMCStepTowPage(
longitude: _longitude, longitude: _longitude,
latitude: _latitude, latitude: _latitude,

@ -3,8 +3,10 @@ import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/Comprehens
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
@ -17,12 +19,7 @@ class NewCMCStepOnePage extends StatefulWidget {
final Function changePageViewIndex; final Function changePageViewIndex;
final CMCViewModel model; final CMCViewModel model;
const NewCMCStepOnePage( const NewCMCStepOnePage({Key key, this.cMCInsertPresOrderRequestModel, this.model, this.changePageViewIndex}) : super(key: key);
{Key key,
this.cMCInsertPresOrderRequestModel,
this.model,
this.changePageViewIndex})
: super(key: key);
@override @override
_NewCMCStepOnePageState createState() => _NewCMCStepOnePageState(); _NewCMCStepOnePageState createState() => _NewCMCStepOnePageState();
@ -44,175 +41,107 @@ class _NewCMCStepOnePageState extends State<NewCMCStepOnePage> {
body: SingleChildScrollView( body: SingleChildScrollView(
physics: ScrollPhysics(), physics: ScrollPhysics(),
child: Container( child: Container(
margin: EdgeInsets.all(12), margin: EdgeInsets.only(left: 12, right: 12),
child: Center( child: Center(
child: Column( child: Column(
children: [ children: [
FractionallySizedBox( ListView.separated(
widthFactor: 0.94, physics: NeverScrollableScrollPhysics(),
child: Column( shrinkWrap: true,
crossAxisAlignment: CrossAxisAlignment.start, itemBuilder: (context, index) {
children: [ return Row(
SizedBox( children: [
height: 20, Radio(
), value: widget.model.cmcAllServicesList[index].serviceID,
Texts( activeColor: Colors.red[800],
TranslationBase.of(context).selectService, onChanged: (newValue) async {
textAlign: TextAlign.center, PatientERCMCInsertServicesList patientERCMCInsertServicesList = new PatientERCMCInsertServicesList(
), price: widget.model.cmcAllServicesList[index].price,
Column( serviceID: widget.model.cmcAllServicesList[index].serviceID.toString(),
children: selectedServiceName: widget.model.cmcAllServicesList[index].description,
widget.model.cmcAllServicesList.map((service) { selectedServiceNameAR: widget.model.cmcAllServicesList[index].descriptionN,
return Container( recordID: 1,
margin: EdgeInsets.only(top: 15), totalPrice: widget.model.cmcAllServicesList[index].totalPrice,
decoration: BoxDecoration( vAT: widget.model.cmcAllServicesList[index].vAT);
border: setState(() {
Border.all(color: Colors.grey, width: 1), widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList = [patientERCMCInsertServicesList];
borderRadius: BorderRadius.circular(12), });
color: Theme.of(context).primaryColor), CMCGetItemsRequestModel cMCGetItemsRequestModel = new CMCGetItemsRequestModel(checkupType: newValue);
child: Column( await widget.model.getCheckupItems(cMCGetItemsRequestModel: cMCGetItemsRequestModel);
children: [ },
Row( groupValue: widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList.length > 0
children: [ ? int.parse(widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList[0].serviceID)
Radio( : 1),
value: service.serviceID, Expanded(
activeColor: Colors.red[800], child: Padding(
onChanged: (newValue) async { padding: const EdgeInsets.only(
PatientERCMCInsertServicesList left: 10,
patientERCMCInsertServicesList = right: 10,
new PatientERCMCInsertServicesList( top: 20,
price: service.price, bottom: 20,
serviceID: service.serviceID ),
.toString(), child: Text(
selectedServiceName: projectViewModel.isArabic ? widget.model.cmcAllServicesList[index].descriptionN : widget.model.cmcAllServicesList[index].description,
service.description, style: TextStyle(
selectedServiceNameAR: fontSize: 14,
service.descriptionN, fontWeight: FontWeight.w600,
recordID: 1, letterSpacing: -0.45,
totalPrice:
service.totalPrice,
vAT: service.vAT);
setState(() {
widget
.cMCInsertPresOrderRequestModel
.patientERCMCInsertServicesList = [
patientERCMCInsertServicesList
];
});
CMCGetItemsRequestModel
cMCGetItemsRequestModel =
new CMCGetItemsRequestModel(
checkupType: newValue);
await widget.model.getCheckupItems(
cMCGetItemsRequestModel:
cMCGetItemsRequestModel);
},
groupValue: widget
.cMCInsertPresOrderRequestModel
.patientERCMCInsertServicesList
.length >
0
? int.parse(widget
.cMCInsertPresOrderRequestModel
.patientERCMCInsertServicesList[
0]
.serviceID)
: 1),
Expanded(
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Texts(
projectViewModel.isArabic
? service.descriptionN
: service.description,
fontSize: 15,
),
),
),
],
), ),
], ),
), ),
); ),
}).toList(),
),
],
),
),
SizedBox(
height: 30,
),
Container(
color: Theme.of(context).primaryColor,
width: double.infinity,
child: Column(
children: [
Row(
children: [
Container(
margin: EdgeInsets.only(right: 10, left: 10),
child: Texts(
TranslationBase.of(context).coveredService,
fontWeight: FontWeight.bold,
))
], ],
), );
Column( },
crossAxisAlignment: CrossAxisAlignment.start, separatorBuilder: (context, index) {
children: widget.model.checkupItems.map((item) { return mDivider(Colors.grey);
return Center( },
child: FractionallySizedBox( itemCount: widget.model.cmcAllServicesList.length),
widthFactor: 1, Card(
child: Container( shape: cardRadius(12),
margin: EdgeInsets.only(top: 15), elevation: 4,
decoration: BoxDecoration( child: Container(
color: Theme.of(context).primaryColor), width: double.infinity,
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start, children: [
children: [ Padding(
SizedBox( padding: const EdgeInsets.only(left: 12,right: 12,top: 12),
height: 12, child: Text(
), TranslationBase.of(context).coveredService,
Container( style: TextStyle(
width: double.infinity, fontSize: 14,
padding: EdgeInsets.only( fontWeight: FontWeight.w600,
left: 15, bottom: 5, top: 5), letterSpacing: -0.45,
decoration: BoxDecoration( ),
border: BorderDirectional( ),
bottom: BorderSide( ),
style: BorderStyle.solid, ListView.separated(
width: 0.5, itemBuilder: (context, index) {
color: Colors.grey)), return Padding(
//borderRadius: , padding: const EdgeInsets.all(12.0),
color: child: Text(
Theme.of(context).primaryColor), widget.model.checkupItems[index].itemName,
child: Column( style: TextStyle(
crossAxisAlignment: fontSize: 12,
CrossAxisAlignment.start, fontWeight: FontWeight.w600,
children: [ letterSpacing: -0.45,
Container(
margin: EdgeInsets.only(
right: 10, left: 10),
child: Texts(item.itemName,
fontSize: 15,
fontWeight: FontWeight.bold),
),
],
),
),
SizedBox(
height: 12,
),
],
),
), ),
), ),
); );
}).toList()), },
], separatorBuilder: (context, index) {
return mDivider(Colors.grey);
},
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: widget.model.checkupItems.length,
),
],
),
), ),
) ),
mHeight(MediaQuery.of(context).size.height * 0.12),
], ],
), ),
), ),
@ -221,44 +150,30 @@ class _NewCMCStepOnePageState extends State<NewCMCStepOnePage> {
bottomSheet: Container( bottomSheet: Container(
height: MediaQuery.of(context).size.height * 0.10, height: MediaQuery.of(context).size.height * 0.10,
width: double.infinity, width: double.infinity,
color: CustomColors.appBackgroudGreyColor,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Container( Container(
width: MediaQuery.of(context).size.width * 0.9, width: MediaQuery.of(context).size.width * 0.9,
child: SecondaryButton( child: SecondaryButton(
label: TranslationBase.of(context).next, label: TranslationBase.of(context).next,
textColor: Theme.of(context).backgroundColor, textColor: Theme.of(context).backgroundColor,
color: Colors.grey[800], color: CustomColors.accentColor,
onTap: () async { onTap: () async {
if (widget.cMCInsertPresOrderRequestModel if (widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList.length != 0 || widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList == null) {
.patientERCMCInsertServicesList.length !=
0 ||
widget.cMCInsertPresOrderRequestModel
.patientERCMCInsertServicesList ==
null) {
int index = widget.model.cmcAllServicesList.length; int index = widget.model.cmcAllServicesList.length;
PatientERCMCInsertServicesList PatientERCMCInsertServicesList patientERCMCInsertServicesList = new PatientERCMCInsertServicesList(
patientERCMCInsertServicesList = price: widget.model.cmcAllServicesList[index - 1].price,
new PatientERCMCInsertServicesList( serviceID: widget.model.cmcAllServicesList[index - 1].serviceID.toString(),
price: widget selectedServiceName: widget.model.cmcAllServicesList[index - 1].description,
.model.cmcAllServicesList[index - 1].price, selectedServiceNameAR: widget.model.cmcAllServicesList[index - 1].descriptionN,
serviceID: widget recordID: 1,
.model.cmcAllServicesList[index - 1].serviceID totalPrice: widget.model.cmcAllServicesList[index - 1].totalPrice,
.toString(), vAT: widget.model.cmcAllServicesList[index - 1].vAT);
selectedServiceName: widget.model
.cmcAllServicesList[index - 1].description,
selectedServiceNameAR: widget.model
.cmcAllServicesList[index - 1].descriptionN,
recordID: 1,
totalPrice: widget
.model.cmcAllServicesList[index - 1].totalPrice,
vAT:
widget.model.cmcAllServicesList[index - 1].vAT);
widget.cMCInsertPresOrderRequestModel widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList = [patientERCMCInsertServicesList];
.patientERCMCInsertServicesList = [
patientERCMCInsertServicesList
];
await widget.model.getCustomerInfo(); await widget.model.getCustomerInfo();
if (widget.model.state == ViewState.ErrorLocal) { if (widget.model.state == ViewState.ErrorLocal) {
Utils.showErrorToast(); Utils.showErrorToast();

@ -3,6 +3,7 @@ import 'dart:ui';
import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart';
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
@ -42,93 +43,69 @@ class _CMCPageState extends State<CMCPage> with SingleTickerProviderStateMixin {
isShowAppBar: true, isShowAppBar: true,
description: TranslationBase.of(context).infoCMC, description: TranslationBase.of(context).infoCMC,
imagesInfo: [ imagesInfo: [
ImagesInfo( ImagesInfo(imageAr: 'https://hmgwebservices.com/Images/MobileApp/CMC/ar/0.png', imageEn: 'https://hmgwebservices.com/Images/MobileApp/CMC/en/0.png'),
imageAr: 'https://hmgwebservices.com/Images/MobileApp/CMC/ar/0.png',
imageEn: 'https://hmgwebservices.com/Images/MobileApp/CMC/en/0.png')
], ],
appBarTitle: TranslationBase.of(context).comprehensiveMedicalCheckup, appBarTitle: TranslationBase.of(context).comprehensiveMedicalCheckup,
body: Scaffold( showNewAppBar: true,
extendBodyBehindAppBar: true, showNewAppBarTitle: true,
appBar: PreferredSize( backgroundColor: CustomColors.appBackgroudGreyColor,
preferredSize: Size.fromHeight(65.0), body: Column(
child: Stack( children: <Widget>[
children: <Widget>[ Container(
Positioned( height: 60.0,
bottom: 1, width: double.infinity,
left: 0, child: Center(
right: 0, child: TabBar(
child: BackdropFilter( isScrollable: false,
filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), controller: _tabController,
child: Container( indicatorWeight: 3.0,
color: Theme.of(context).primaryColor.withOpacity(0.8), indicatorSize: TabBarIndicatorSize.tab,
height: 70.0, indicatorColor: CustomColors.accentColor,
), labelColor: Colors.black,
), labelPadding: EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0),
), unselectedLabelColor: Colors.grey[800],
Center( tabs: [
child: Container( Center(
height: 60.0, child: Text(
margin: EdgeInsets.only(top: 10.0), TranslationBase.of(context).comprehensiveMedicalCheckup,
width: MediaQuery.of(context).size.width * 0.9, textAlign: TextAlign.center,
decoration: BoxDecoration( style: TextStyle(
border: Border( fontSize: 13,
bottom: BorderSide( fontWeight: FontWeight.w600,
color: Theme.of(context).dividerColor, letterSpacing: -0.34,
width: 0.7),
), ),
color: Theme.of(context).primaryColor),
child: Center(
child: TabBar(
isScrollable: true,
controller: _tabController,
indicatorWeight: 5.0,
indicatorSize: TabBarIndicatorSize.tab,
indicatorColor: Colors.red[800],
labelColor: Theme.of(context).primaryColor,
labelPadding:
EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0),
unselectedLabelColor: Colors.grey[800],
tabs: [
Container(
width: MediaQuery.of(context).size.width * 0.37,
child: Center(
child: Texts(TranslationBase.of(context)
.comprehensiveMedicalCheckup),
),
),
Container(
width: MediaQuery.of(context).size.width * 0.37,
child: Center(
child:
Texts(TranslationBase.of(context).orderLog),
),
),
],
), ),
), ),
), Center(
), child: Text(
], TranslationBase.of(context).orderLog,
), textAlign: TextAlign.center,
), style: TextStyle(
body: Column( fontSize: 13,
children: <Widget>[ fontWeight: FontWeight.w600,
Expanded( letterSpacing: -0.34,
child: TabBarView( ),
physics: BouncingScrollPhysics(), ),
controller: _tabController,
children: <Widget>[
NewCMCPage(
model: model,
), ),
OrdersLogDetailsPage(
model: model,
)
], ],
), ),
) ),
], ),
), Expanded(
child: TabBarView(
physics: BouncingScrollPhysics(),
controller: _tabController,
children: <Widget>[
NewCMCPage(
model: model,
),
OrdersLogDetailsPage(
model: model,
)
],
),
)
],
), ),
), ),
); );

@ -22,26 +22,20 @@ class OrdersLogDetailsPage extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
void showConfirmMessage( void showConfirmMessage(CMCViewModel model, GetHHCAllPresOrdersResponseModel order) {
CMCViewModel model, GetHHCAllPresOrdersResponseModel order) {
showDialog( showDialog(
context: context, context: context,
child: ConfirmCancelOrderDialog( child: ConfirmCancelOrderDialog(
model: model, model: model,
onTap: () async { onTap: () async {
UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.iD, rejectionReason: "", presOrderStatus: 4, editedBy: 3);
UpdatePresOrderRequestModel(
presOrderID: order.iD,
rejectionReason: "",
presOrderStatus: 4, editedBy: 3);
await model.updateCmcPresOrder(updatePresOrderRequestModel); await model.updateCmcPresOrder(updatePresOrderRequestModel);
if(model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
Utils.showErrorToast(model.error); Utils.showErrorToast(model.error);
} else { } else {
AppToast.showSuccessToast(message:TranslationBase.of(context).processDoneSuccessfully ); AppToast.showSuccessToast(message: TranslationBase.of(context).processDoneSuccessfully);
await model.getCmcAllPresOrders(); await model.getCmcAllPresOrders();
} }
}, },
@ -49,205 +43,210 @@ class OrdersLogDetailsPage extends StatelessWidget {
} }
return AppScaffold( return AppScaffold(
isShowAppBar: false, isShowAppBar: false,
baseViewModel: model, baseViewModel: model,
body: SingleChildScrollView( body: SingleChildScrollView(
physics: ScrollPhysics(), physics: ScrollPhysics(),
child: Container( child: Container(
margin: EdgeInsets.all(12), margin: EdgeInsets.all(12),
child: Center( child: Center(
child: FractionallySizedBox( child: FractionallySizedBox(
widthFactor: 0.94, widthFactor: 0.94,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
SizedBox( Column(
height: 50, crossAxisAlignment: CrossAxisAlignment.start,
), children: model.cmcAllPresOrders.map((order) {
Column( return Container(
crossAxisAlignment: CrossAxisAlignment.start, width: double.infinity,
children: model.cmcAllPresOrders.map((order) { margin: EdgeInsets.only(top: 12),
return Container( clipBehavior: Clip.antiAlias,
width: double.infinity, decoration: BoxDecoration(border: Border.all(color: Colors.grey, width: 1), borderRadius: BorderRadius.circular(12), color: Colors.white),
margin: EdgeInsets.only(top: 15), child: Column(
decoration: BoxDecoration( crossAxisAlignment: CrossAxisAlignment.start,
border: children: [
Border.all(color: Colors.grey, width: 1), SizedBox(
borderRadius: BorderRadius.circular(12), height: 6,
color: Colors.white), ),
child: Column( Container(
crossAxisAlignment: CrossAxisAlignment.start, width: double.infinity,
children: [ padding: EdgeInsets.only(left: 15, bottom: 15, top: 8, right: 15),
SizedBox( decoration: BoxDecoration(
height: 12, border: Border(
), bottom: BorderSide(
Container( color: Colors.grey,
width: double.infinity, width: 1.0,
padding: EdgeInsets.only(
left: 15, bottom: 15, top: 15,right: 15),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Colors.grey,
width: 1.0,
),
), ),
// borderRadius: BorderRadius.circular(12), ),
color: Colors.white), // borderRadius: BorderRadius.circular(12),
child: Column( ),
crossAxisAlignment: CrossAxisAlignment.start, child: Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
Texts( children: [
TranslationBase Text(
.of(context) TranslationBase.of(context).requestID,
.requestID, style: TextStyle(
bold: false,
fontSize: 13, fontSize: 13,
fontWeight: FontWeight.w600,
letterSpacing: -0.45,
), ),
SizedBox( ),
height: 4, SizedBox(
height: 4,
),
Text(
order.iD.toString(),
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
letterSpacing: -0.45,
), ),
Texts( ),
order.iD.toString(), ],
fontSize: 22,
),
],
),
), ),
Container( ),
width: double.infinity, Container(
padding: EdgeInsets.only( width: double.infinity,
left: 15, bottom: 15, top: 15,right: 15), padding: EdgeInsets.only(left: 15, bottom: 15, top: 15, right: 15),
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border( border: Border(
bottom: BorderSide( bottom: BorderSide(
color: Colors.grey, color: Colors.grey,
width: 1.0, width: 1.0,
),
), ),
// borderRadius: BorderRadius.circular(12), ),
color: Colors.white), // borderRadius: BorderRadius.circular(12),
child: Column( ),
crossAxisAlignment: CrossAxisAlignment.start, child: Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
Texts( children: [
TranslationBase Text(
.of(context) TranslationBase.of(context).OrderStatus,
.OrderStatus, style: TextStyle(
bold: false,
fontSize: 13, fontSize: 13,
fontWeight: FontWeight.w600,
letterSpacing: -0.45,
), ),
SizedBox( ),
height: 4, SizedBox(
height: 4,
),
Text(
projectViewModel.isArabic ? order.descriptionN : order.description,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
letterSpacing: -0.45,
), ),
Texts( ),
],
projectViewModel.isArabic ? order
.descriptionN : order.description,
fontSize: 22,
),
],
),
), ),
Container( ),
width: double.infinity, Container(
padding: EdgeInsets.only( width: double.infinity,
left: 15, bottom: 15, top: 15,right: 15), padding: EdgeInsets.only(left: 15, bottom: 15, top: 15, right: 15),
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border( border: Border(
bottom: BorderSide( bottom: BorderSide(
color: Colors.grey, color: Colors.grey,
width: 1.0, width: 1.0,
),
), ),
// borderRadius: BorderRadius.circular(12), ),
color: Colors.white), // borderRadius: BorderRadius.circular(12),
child: Column( ),
crossAxisAlignment: CrossAxisAlignment.start, child: Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
Texts( children: [
TranslationBase.of(context).pickupDate, Text(
bold: false, TranslationBase.of(context).pickupDate,
style: TextStyle(
fontSize: 13, fontSize: 13,
fontWeight: FontWeight.w600,
letterSpacing: -0.45,
), ),
SizedBox( ),
height: 4, SizedBox(
height: 4,
),
Text(
DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(order.createdOn)),
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
letterSpacing: -0.45,
), ),
Texts( ),
DateUtil.getDayMonthYearDateFormatted( ],
DateUtil.convertStringToDate(order.createdOn)),
fontSize: 22,
),
],
),
), ),
Container( ),
width: double.infinity, Container(
padding: EdgeInsets.only( width: double.infinity,
left: 15, bottom: 15, top: 15,right: 15), clipBehavior: Clip.antiAlias,
decoration: BoxDecoration( padding: EdgeInsets.only(left: 15, bottom: 15, top: 15, right: 15),
border: Border( decoration: BoxDecoration(
bottom: BorderSide( border: Border(
color: Colors.grey, bottom: BorderSide(
width: 1.0, color: (order.status == 1 || order.status == 2) ? Colors.grey : Colors.transparent,
), width: (order.status == 1 || order.status == 2) ? 1.0 : 0,
), ),
// borderRadius: BorderRadius.circular(12), ),
color: Colors.white), // borderRadius: BorderRadius.circular(12),
child: Column( ),
crossAxisAlignment: child: Column(
CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Texts( Text(
TranslationBase.of(context).orderLocation, TranslationBase.of(context).orderLocation,
bold: false, style: TextStyle(
fontSize: 13, fontSize: 13,
fontWeight: FontWeight.w600,
letterSpacing: -0.45,
), ),
SizedBox( ),
height: 4, SizedBox(
), height: 4,
Texts( ),
!projectViewModel.isArabic?order. Text(
projectDescription.toString() : !projectViewModel.isArabic ? order.projectDescription.toString() : order.projectDescriptionN.toString(),
order style: TextStyle(
.projectDescriptionN fontSize: 13,
.toString(), fontWeight: FontWeight.w600,
fontSize: 22, letterSpacing: -0.45,
), ),
], ),
), ],
),
SizedBox(
height: 12,
), ),
if (order.status == 1 ||order.status == 2 ) ),
(order.status == 1 || order.status == 2)
? SizedBox(
height: 12,
)
: Container(),
if (order.status == 1 || order.status == 2)
Center( Center(
child: Container( child: Container(
width: MediaQuery width: MediaQuery.of(context).size.width * 0.85,
.of(context)
.size
.width *
0.85,
child: SecondaryButton( child: SecondaryButton(
label: TranslationBase.of(context).cancel.toUpperCase(), label: TranslationBase.of(context).cancel.toUpperCase(),
onTap: () { onTap: () {
showConfirmMessage(model, showConfirmMessage(model, order);
order); },
}
,
color: Colors.red[800], color: Colors.red[800],
disabled: false, disabled: false,
textColor: Theme textColor: Theme.of(context).backgroundColor),
.of(context)
.backgroundColor),
), ),
), ),
SizedBox( (order.status == 1 || order.status == 2)
height: 22, ? SizedBox(
), height: 12,
], )
), : SizedBox(
); height: 2,
),
],
),
);
}).toList()) }).toList())
], ],
), ),

@ -21,132 +21,115 @@ class LocationPage extends StatefulWidget {
final double longitude; final double longitude;
final dynamic model; final dynamic model;
const LocationPage({Key key, this.onPick, this.latitude, this.longitude, this.model}) const LocationPage({Key key, this.onPick, this.latitude, this.longitude, this.model}) : super(key: key);
: super(key: key);
@override @override
_LocationPageState createState() => _LocationPageState createState() => _LocationPageState();
_LocationPageState();
} }
class _LocationPageState class _LocationPageState extends State<LocationPage> {
extends State<LocationPage> {
double latitude = 0; double latitude = 0;
double longitude = 0; double longitude = 0;
bool showCurrentLocation = false; bool showCurrentLocation = false;
@override @override
void initState() { void initState() {
latitude = widget.latitude; latitude = widget.latitude;
longitude = widget.longitude; longitude = widget.longitude;
if(latitude == 0.0 && longitude == 0.0) { if (latitude == 0.0 && longitude == 0.0) {
showCurrentLocation = true; showCurrentLocation = true;
} }
super.initState(); super.initState();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<HomeHealthCareViewModel>( return BaseView<HomeHealthCareViewModel>(
onModelReady: (model) {}, onModelReady: (model) {},
builder: (_, model, widget) => AppScaffold( builder: (_, model, widget) => AppScaffold(
appBarTitle: TranslationBase.of(context).addAddress, appBarTitle: TranslationBase.of(context).addAddress,
isShowDecPage: false, isShowDecPage: false,
isShowAppBar: true, isShowAppBar: true,
baseViewModel: model, baseViewModel: model,
body: PlacePicker( showNewAppBarTitle: true,
apiKey: GOOGLE_API_KEY, showNewAppBar: true,
enableMyLocationButton: true, body: PlacePicker(
automaticallyImplyAppBarLeading: false, apiKey: GOOGLE_API_KEY,
autocompleteOnTrailingWhitespace: true, enableMyLocationButton: true,
selectInitialPosition: true, automaticallyImplyAppBarLeading: false,
autocompleteLanguage: projectViewModel.currentLanguage, autocompleteOnTrailingWhitespace: true,
enableMapTypeButton: true, selectInitialPosition: true,
searchForInitialValue: false, autocompleteLanguage: projectViewModel.currentLanguage,
onPlacePicked: (PickResult result) { enableMapTypeButton: true,
print(result.adrAddress); searchForInitialValue: false,
onPlacePicked: (PickResult result) {
}, print(result.adrAddress);
selectedPlaceWidgetBuilder: },
(_, selectedPlace, state, isSearchBarFocused) { selectedPlaceWidgetBuilder: (_, selectedPlace, state, isSearchBarFocused) {
print("state: $state, isSearchBarFocused: $isSearchBarFocused"); print("state: $state, isSearchBarFocused: $isSearchBarFocused");
return isSearchBarFocused return isSearchBarFocused
? Container() ? Container()
: FloatingCard( : FloatingCard(
bottomPosition: 0.0, bottomPosition: 0.0,
leftPosition: 0.0, leftPosition: 0.0,
rightPosition: 0.0, rightPosition: 0.0,
width: 500, width: 500,
borderRadius: BorderRadius.circular(12.0), borderRadius: BorderRadius.circular(12.0),
child: state == SearchingState.Searching child: state == SearchingState.Searching
? Center(child: CircularProgressIndicator()) ? Center(child: CircularProgressIndicator())
: Container( : Container(
margin: EdgeInsets.all(12), margin: EdgeInsets.all(12),
child: Column( child: Column(
children: [ children: [
SecondaryButton( SecondaryButton(
color: Colors.grey[800], color: Colors.grey[800],
textColor: Colors.white, textColor: Colors.white,
onTap: () async { onTap: () async {
AddNewAddressRequestModel AddNewAddressRequestModel addNewAddressRequestModel = new AddNewAddressRequestModel(
addNewAddressRequestModel = customer: Customer(addresses: [
new AddNewAddressRequestModel( Addresses(
customer: Customer(addresses: [ address1: selectedPlace.formattedAddress,
Addresses( address2: selectedPlace.formattedAddress,
address1: customerAttributes: "",
selectedPlace.formattedAddress, city: "",
address2: selectedPlace createdOnUtc: "",
.formattedAddress, id: 0,
customerAttributes: "", latLong: "$latitude,$longitude",
city: "", email: "")
createdOnUtc: "", ]),
id: 0, );
latLong: "$latitude,$longitude",
email: "")
]),
);
selectedPlace.addressComponents.forEach((e) {
if (e.types.contains("country")) {
addNewAddressRequestModel.customer
.addresses[0].country = e.longName;
}
if (e.types.contains("postal_code")) {
addNewAddressRequestModel.customer
.addresses[0].zipPostalCode =
e.longName;
}
if (e.types.contains("locality")) {
addNewAddressRequestModel.customer
.addresses[0].city =
e.longName;
}
});
selectedPlace.addressComponents.forEach((e) {
if (e.types.contains("country")) {
addNewAddressRequestModel.customer.addresses[0].country = e.longName;
}
if (e.types.contains("postal_code")) {
addNewAddressRequestModel.customer.addresses[0].zipPostalCode = e.longName;
}
if (e.types.contains("locality")) {
addNewAddressRequestModel.customer.addresses[0].city = e.longName;
}
});
await model.addAddressInfo( await model.addAddressInfo(addNewAddressRequestModel: addNewAddressRequestModel);
addNewAddressRequestModel: addNewAddressRequestModel); if (model.state == ViewState.ErrorLocal) {
if (model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error);
Utils.showErrorToast(model.error); } else {
} else { AppToast.showSuccessToast(message: "Address Added Successfully");
AppToast.showSuccessToast( }
message: "Address Added Successfully"); Navigator.of(context).pop(addNewAddressRequestModel);
} },
Navigator.of(context).pop(addNewAddressRequestModel); label: TranslationBase.of(context).addNewAddress,
}, ),
label: TranslationBase.of(context).addNewAddress, ],
), ),
], ),
), );
), },
); initialPosition: LatLng(latitude, longitude),
}, useCurrentLocation: showCurrentLocation,
initialPosition: LatLng(latitude, longitude), ),
useCurrentLocation: showCurrentLocation, ));
),
));
} }
} }

@ -5,43 +5,33 @@ import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; 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/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.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/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_maps_place_picker/google_maps_place_picker.dart'; import 'package:google_maps_place_picker/google_maps_place_picker.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
class NewHomeHealthCareStepOnePage extends StatefulWidget { class NewHomeHealthCareStepOnePage extends StatefulWidget {
final PatientERInsertPresOrderRequestModel final PatientERInsertPresOrderRequestModel patientERInsertPresOrderRequestModel;
patientERInsertPresOrderRequestModel;
final Function changePageViewIndex; final Function changePageViewIndex;
final HomeHealthCareViewModel model; final HomeHealthCareViewModel model;
const NewHomeHealthCareStepOnePage( const NewHomeHealthCareStepOnePage({Key key, this.patientERInsertPresOrderRequestModel, this.model, this.changePageViewIndex}) : super(key: key);
{Key key,
this.patientERInsertPresOrderRequestModel,
this.model,
this.changePageViewIndex})
: super(key: key);
@override @override
_NewHomeHealthCareStepOnePageState createState() => _NewHomeHealthCareStepOnePageState createState() => _NewHomeHealthCareStepOnePageState();
_NewHomeHealthCareStepOnePageState();
} }
class _NewHomeHealthCareStepOnePageState class _NewHomeHealthCareStepOnePageState extends State<NewHomeHealthCareStepOnePage> {
extends State<NewHomeHealthCareStepOnePage> {
PickResult _result; PickResult _result;
@override @override
void initState() { void initState() {
if (widget.patientERInsertPresOrderRequestModel if (widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList == null) widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList = [];
.patientERHHCInsertServicesList ==
null)
widget.patientERInsertPresOrderRequestModel
.patientERHHCInsertServicesList = [];
super.initState(); super.initState();
} }
@ -55,30 +45,25 @@ class _NewHomeHealthCareStepOnePageState
body: SingleChildScrollView( body: SingleChildScrollView(
physics: ScrollPhysics(), physics: ScrollPhysics(),
child: Container( child: Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(left: MediaQuery.of(context).size.width * 0.05, right: MediaQuery.of(context).size.width * 0.05),
left: MediaQuery.of(context).size.width * 0.05,
right: MediaQuery.of(context).size.width * 0.05),
child: Center( child: Center(
child: FractionallySizedBox( child: FractionallySizedBox(
widthFactor: 1, widthFactor: 1,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
SizedBox( // Texts(
height: 12, // TranslationBase.of(context).selectHomeHealthCareServices,
), // textAlign: TextAlign.center,
Texts( // ),
TranslationBase.of(context).selectHomeHealthCareServices,
textAlign: TextAlign.center,
),
Column( Column(
children: widget.model.hhcAllServicesList.map((service) { children: widget.model.hhcAllServicesList.map((service) {
return Container( return Container(
margin: EdgeInsets.only(top: 15), margin: EdgeInsets.only(top: 10),
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all(color: Colors.grey, width: 1), // border: Border.all(color: Colors.grey, width: 1),
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
color: Theme.of(context).primaryColor), ),
child: Column( child: Column(
children: [ children: [
Row( Row(
@ -86,21 +71,14 @@ class _NewHomeHealthCareStepOnePageState
Checkbox( Checkbox(
value: isServiceSelected(service.serviceID), value: isServiceSelected(service.serviceID),
activeColor: Colors.red[800], activeColor: Colors.red[800],
tristate: false,
onChanged: (bool newValue) { onChanged: (bool newValue) {
setState(() { setState(() {
if (!isServiceSelected( if (!isServiceSelected(service.serviceID))
service.serviceID)) widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.add(PatientERHHCInsertServicesList(
widget recordID: widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.length,
.patientERInsertPresOrderRequestModel serviceID: service.serviceID,
.patientERHHCInsertServicesList serviceName: service.description));
.add(PatientERHHCInsertServicesList(
recordID: widget
.patientERInsertPresOrderRequestModel
.patientERHHCInsertServicesList
.length,
serviceID: service.serviceID,
serviceName:
service.description));
else else
removeSelected(service.serviceID); removeSelected(service.serviceID);
// widget.patientERInsertPresOrderRequestModel // widget.patientERInsertPresOrderRequestModel
@ -109,22 +87,27 @@ class _NewHomeHealthCareStepOnePageState
}), }),
Expanded( Expanded(
child: Padding( child: Padding(
padding: const EdgeInsets.all(20.0), padding: const EdgeInsets.only(left: 0.0, right: 10),
child: Texts( child: Texts(
projectViewModel.isArabic projectViewModel.isArabic ? service.descriptionN : service.description.toLowerCase()?.capitalize(),
? service.descriptionN
: service.description,
fontSize: 15, fontSize: 15,
style: 'letterSpacing: -0.48',
fontWeight: FontWeight.bold,
), ),
), ),
), ),
], ],
), ),
Divider(
height: 1,
color: Colors.grey,
)
], ],
), ),
); );
}).toList(), }).toList(),
) ),
SizedBox(height: 70)
], ],
), ),
), ),
@ -132,44 +115,73 @@ class _NewHomeHealthCareStepOnePageState
), ),
), ),
bottomSheet: Container( bottomSheet: Container(
height: MediaQuery.of(context).size.height * 0.10, width: MediaQuery.of(context).size.width,
width: double.infinity, height: 70.0,
child: Column( margin: EdgeInsets.only(left: 15.0, right: 15.0, top: 10.0),
children: <Widget>[ child: Button(
Container( onTap: () async {
width: MediaQuery.of(context).size.width * 0.9, await widget.model.getCustomerInfo();
child: SecondaryButton( if (widget.model.state == ViewState.ErrorLocal) {
label: TranslationBase.of(context).next, Utils.showErrorToast();
disabled: this } else {
.widget Navigator.push(
.patientERInsertPresOrderRequestModel context,
.patientERHHCInsertServicesList FadePage(
.length == page: NewHomeHealthCareStepTowPage(
0 || patientERInsertPresOrderRequestModel: widget.patientERInsertPresOrderRequestModel,
widget.model.state == ViewState.BusyLocal, model: widget.model,
color: Colors.grey[800], ),
loading: widget.model.state == ViewState.BusyLocal, ),
onTap: () async { );
await widget.model.getCustomerInfo();
if (widget.model.state == ViewState.ErrorLocal) { // widget.changePageViewIndex(1);
Utils.showErrorToast(); }
} else { },
widget.changePageViewIndex(1); label: TranslationBase.of(context).next,
} backgroundColor: Colors.red[900],
}, disabled: this.widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.length == 0 || widget.model.state == ViewState.BusyLocal,
textColor: Theme.of(context).backgroundColor), loading: widget.model.state == ViewState.BusyLocal,
),
],
), ),
), ),
// Container(
// height: MediaQuery.of(context).size.height * 0.10,
// width: double.infinity,
// child: Column(
// children: <Widget>[
// Container(
// width: MediaQuery.of(context).size.width * 0.9,
// child: SecondaryButton(
// label: TranslationBase.of(context).next,
// disabled: this.widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.length == 0 || widget.model.state == ViewState.BusyLocal,
// color: Colors.grey[800],
// loading: widget.model.state == ViewState.BusyLocal,
// onTap: () async {
// await widget.model.getCustomerInfo();
// if (widget.model.state == ViewState.ErrorLocal) {
// Utils.showErrorToast();
// } else {
// Navigator.push(
// context,
// FadePage(
// page: NewHomeHealthCareStepTowPage(),
// ),
// );
// // widget.changePageViewIndex(1);
// }
// },
// textColor: Theme.of(context).backgroundColor),
// ),
// ],
// ),
// ),
); );
} }
isServiceSelected(int serviceId) { isServiceSelected(int serviceId) {
Iterable<PatientERHHCInsertServicesList> patientERHHCInsertServicesList = Iterable<PatientERHHCInsertServicesList> patientERHHCInsertServicesList =
widget widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.where((element) => serviceId == element.serviceID);
.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList
.where((element) => serviceId == element.serviceID);
if (patientERHHCInsertServicesList.length > 0) { if (patientERHHCInsertServicesList.length > 0) {
return true; return true;
} }
@ -178,15 +190,11 @@ class _NewHomeHealthCareStepOnePageState
removeSelected(int serviceId) { removeSelected(int serviceId) {
Iterable<PatientERHHCInsertServicesList> patientERHHCInsertServicesList = Iterable<PatientERHHCInsertServicesList> patientERHHCInsertServicesList =
widget widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.where((element) => serviceId == element.serviceID);
.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList
.where((element) => serviceId == element.serviceID);
if (patientERHHCInsertServicesList.length > 0) if (patientERHHCInsertServicesList.length > 0)
setState(() { setState(() {
widget widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.remove(patientERHHCInsertServicesList.first);
.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList
.remove(patientERHHCInsertServicesList.first);
}); });
} }
} }

@ -12,26 +12,21 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart';
class NewHomeHealthCareStepThreePage extends StatefulWidget { class NewHomeHealthCareStepThreePage extends StatefulWidget {
final PatientERInsertPresOrderRequestModel final PatientERInsertPresOrderRequestModel patientERInsertPresOrderRequestModel;
patientERInsertPresOrderRequestModel;
final Function changePageViewIndex; final Function changePageViewIndex;
final HomeHealthCareViewModel model; final HomeHealthCareViewModel model;
NewHomeHealthCareStepThreePage( NewHomeHealthCareStepThreePage({Key key, this.patientERInsertPresOrderRequestModel, this.changePageViewIndex, this.model});
{Key key,
this.patientERInsertPresOrderRequestModel,
this.changePageViewIndex,
this.model});
@override @override
_NewHomeHealthCareStepThreePageState createState() => _NewHomeHealthCareStepThreePageState createState() => _NewHomeHealthCareStepThreePageState();
_NewHomeHealthCareStepThreePageState();
} }
class _NewHomeHealthCareStepThreePageState class _NewHomeHealthCareStepThreePageState extends State<NewHomeHealthCareStepThreePage> {
extends State<NewHomeHealthCareStepThreePage> {
Completer<GoogleMapController> _controller = Completer(); Completer<GoogleMapController> _controller = Completer();
static CameraPosition _kGooglePlex = CameraPosition( static CameraPosition _kGooglePlex = CameraPosition(
@ -42,22 +37,17 @@ class _NewHomeHealthCareStepThreePageState
@override @override
void initState() { void initState() {
if (widget.patientERInsertPresOrderRequestModel.latitude != null) { if (widget.patientERInsertPresOrderRequestModel.latitude != null) {
markers.clear(); markers.clear();
markers.add( markers.add(
Marker( Marker(
markerId: MarkerId( markerId: MarkerId(
widget.patientERInsertPresOrderRequestModel.latitude.hashCode widget.patientERInsertPresOrderRequestModel.latitude.hashCode.toString(),
.toString(),
), ),
position: LatLng( position: LatLng(widget.patientERInsertPresOrderRequestModel.latitude, widget.patientERInsertPresOrderRequestModel.longitude)),
widget.patientERInsertPresOrderRequestModel.latitude,
widget.patientERInsertPresOrderRequestModel.longitude)),
); );
_kGooglePlex = CameraPosition( _kGooglePlex = CameraPosition(
target: LatLng(widget.patientERInsertPresOrderRequestModel.latitude, target: LatLng(widget.patientERInsertPresOrderRequestModel.latitude, widget.patientERInsertPresOrderRequestModel.longitude),
widget.patientERInsertPresOrderRequestModel.longitude),
zoom: 14.4746, zoom: 14.4746,
); );
} }
@ -71,6 +61,9 @@ class _NewHomeHealthCareStepThreePageState
return AppScaffold( return AppScaffold(
isShowDecPage: false, isShowDecPage: false,
baseViewModel: widget.model, baseViewModel: widget.model,
showNewAppBar: true,
showNewAppBarTitle: true,
appBarTitle: TranslationBase.of(context).homeHealthCare,
body: SingleChildScrollView( body: SingleChildScrollView(
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
child: Container( child: Container(
@ -79,19 +72,20 @@ class _NewHomeHealthCareStepThreePageState
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Texts(TranslationBase.of(context).orderDetails, fontWeight: FontWeight.bold,),
SizedBox(
height: 12,
),
Container( Container(
decoration: BoxDecoration( padding: EdgeInsets.all(20),
color: Colors.white, child: Texts(
borderRadius: BorderRadius.circular(12)), TranslationBase.of(context).RRTSummary,
fontWeight: FontWeight.bold,
fontSize: 22,
)),
Container(
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(12)),
padding: EdgeInsets.all(8), padding: EdgeInsets.all(8),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Texts(TranslationBase.of(context).orderLocation, fontWeight: FontWeight.bold), Texts(TranslationBase.of(context).selectedLocation, fontWeight: FontWeight.bold),
SizedBox( SizedBox(
height: 12, height: 12,
), ),
@ -112,29 +106,32 @@ class _NewHomeHealthCareStepThreePageState
SizedBox( SizedBox(
height: 12, height: 12,
), ),
Texts(TranslationBase.of(context).selectedService + " : ", fontWeight: FontWeight.bold), Texts(TranslationBase.of(context).selectedService),
...List.generate( ...List.generate(
widget.patientERInsertPresOrderRequestModel widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.length,
.patientERHHCInsertServicesList.length,
(index) => Container( (index) => Container(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Texts( // Texts(
TranslationBase.of(context).serviceName, // TranslationBase.of(context).serviceName,
fontSize: 12, // fontSize: 12,
), // ),
SizedBox( SizedBox(
height: 5, height: 5,
), ),
Texts( Row(
widget children: [
.patientERInsertPresOrderRequestModel Texts(
.patientERHHCInsertServicesList[index] (index + 1).toString() + '. ',
.serviceName, fontSize: 15,
fontSize: 15, ),
bold: true, Texts(
), widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList[index].serviceName,
fontSize: 15,
),
],
)
], ],
), ),
), ),
@ -158,15 +155,12 @@ class _NewHomeHealthCareStepThreePageState
width: MediaQuery.of(context).size.width * 0.9, width: MediaQuery.of(context).size.width * 0.9,
child: SecondaryButton( child: SecondaryButton(
label: TranslationBase.of(context).confirm, label: TranslationBase.of(context).confirm,
disabled: widget.patientERInsertPresOrderRequestModel disabled: widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.length == 0,
.patientERHHCInsertServicesList.length ==
0,
color: Colors.grey[800], color: Colors.grey[800],
onTap: () async { onTap: () async {
await widget.model.insertPresPresOrder( await widget.model.insertPresPresOrder(order: widget.patientERInsertPresOrderRequestModel);
order: widget.patientERInsertPresOrderRequestModel);
if (widget.model.state != ViewState.ErrorLocal) { if (widget.model.state != ViewState.ErrorLocal) {
widget.changePageViewIndex(0); Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: NewHomeHealthCarePage));
} }
}, },
textColor: Theme.of(context).backgroundColor), textColor: Theme.of(context).backgroundColor),

@ -1,9 +1,12 @@
import 'package:auto_size_text/auto_size_text.dart';
import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart';
import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart';
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/select_location_dialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/select_location_dialog.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
@ -14,41 +17,37 @@ import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:google_maps_place_picker/google_maps_place_picker.dart'; import 'package:google_maps_place_picker/google_maps_place_picker.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'dart:async';
import 'location_page.dart'; import 'location_page.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_three_page.dart';
class NewHomeHealthCareStepTowPage extends StatefulWidget { class NewHomeHealthCareStepTowPage extends StatefulWidget {
final Function(PickResult) onPick; final Function(PickResult) onPick;
final double latitude; final double latitude;
final double longitude; final double longitude;
final PatientERInsertPresOrderRequestModel final PatientERInsertPresOrderRequestModel patientERInsertPresOrderRequestModel;
patientERInsertPresOrderRequestModel;
final Function changePageViewIndex; final Function changePageViewIndex;
final HomeHealthCareViewModel model; final HomeHealthCareViewModel model;
const NewHomeHealthCareStepTowPage( const NewHomeHealthCareStepTowPage({Key key, this.onPick, this.latitude, this.longitude, this.patientERInsertPresOrderRequestModel, this.changePageViewIndex, this.model}) : super(key: key);
{Key key,
this.onPick,
this.latitude,
this.longitude,
this.patientERInsertPresOrderRequestModel,
this.changePageViewIndex,
this.model})
: super(key: key);
@override @override
_NewHomeHealthCareStepTowPageState createState() => _NewHomeHealthCareStepTowPageState createState() => _NewHomeHealthCareStepTowPageState();
_NewHomeHealthCareStepTowPageState();
} }
class _NewHomeHealthCareStepTowPageState class _NewHomeHealthCareStepTowPageState extends State<NewHomeHealthCareStepTowPage> {
extends State<NewHomeHealthCareStepTowPage> {
double latitude = 0; double latitude = 0;
double longitude = 0; double longitude = 0;
AddressInfo _selectedAddress; AddressInfo _selectedAddress;
bool showCurrentLocation = false; bool showCurrentLocation = false;
Completer<GoogleMapController> _controller = Completer();
static CameraPosition _kGooglePlex = CameraPosition(
target: LatLng(37.42796133580664, -122.085749655962),
zoom: 14.4746,
);
final Set<Marker> markers = new Set();
@override @override
void initState() { void initState() {
if (widget.patientERInsertPresOrderRequestModel.latitude == null) { if (widget.patientERInsertPresOrderRequestModel.latitude == null) {
@ -57,30 +56,38 @@ class _NewHomeHealthCareStepTowPageState
latitude = widget.patientERInsertPresOrderRequestModel.latitude; latitude = widget.patientERInsertPresOrderRequestModel.latitude;
longitude = widget.patientERInsertPresOrderRequestModel.longitude; longitude = widget.patientERInsertPresOrderRequestModel.longitude;
} }
markers.clear();
markers.add(
Marker(
markerId: MarkerId(
latitude.hashCode.toString(),
),
position: LatLng(latitude, longitude)),
);
_kGooglePlex = CameraPosition(
target: LatLng(latitude, longitude),
zoom: 14.4746,
);
super.initState(); super.initState();
} }
setLatitudeAndLongitude({bool isSetState = false, String latLong}) { setLatitudeAndLongitude({bool isSetState = false, String latLong}) {
if (latLong == null){ if (latLong == null) {
if(widget.model.addressesList.isEmpty) { if (widget.model.addressesList.isEmpty) {
setState(() { setState(() {
showCurrentLocation = true; showCurrentLocation = true;
}); });
} else { } else {
latLong = widget.model.addressesList[widget.model.addressesList latLong = widget.model.addressesList[widget.model.addressesList.length - 1].latLong;
.length - 1].latLong;
} }
} }
if(!showCurrentLocation) { if (!showCurrentLocation) {
List latLongArr = latLong.split(','); List latLongArr = latLong.split(',');
latitude = double.parse(latLongArr[0]); latitude = double.parse(latLongArr[0]);
longitude = double.parse(latLongArr[1]); longitude = double.parse(latLongArr[1]);
} }
} }
@override @override
@ -88,121 +95,211 @@ class _NewHomeHealthCareStepTowPageState
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return AppScaffold( return AppScaffold(
isShowDecPage: false, isShowDecPage: false,
showNewAppBarTitle: true,
showNewAppBar: true,
appBarTitle: TranslationBase.of(context).homeHealthCare,
body: Stack( body: Stack(
children: [ children: [
PlacePicker( Container(
apiKey: GOOGLE_API_KEY, margin: EdgeInsets.only(top: 120),
enableMyLocationButton: true, child: GoogleMap(
automaticallyImplyAppBarLeading: false, mapType: MapType.normal,
autocompleteOnTrailingWhitespace: true, markers: markers,
selectInitialPosition: true, initialCameraPosition: _kGooglePlex,
autocompleteLanguage: projectViewModel.currentLanguage, onMapCreated: (GoogleMapController controller) {
enableMapTypeButton: true, _controller.complete(controller);
searchForInitialValue: false, },
)
// PlacePicker(
// apiKey: GOOGLE_API_KEY,
// enableMyLocationButton: true,
// automaticallyImplyAppBarLeading: false,
// autocompleteOnTrailingWhitespace: false,
// selectInitialPosition: true,
// autocompleteLanguage: projectViewModel.currentLanguage,
// enableMapTypeButton: false,
// searchForInitialValue: true,
// // onPlacePicked: (PickResult result) {
// // print(result.adrAddress);
// // widget.changePageViewIndex(3);
// // },
// selectedPlaceWidgetBuilder: (_, selectedPlace, state, isSearchBarFocused) {
// print("state: $state, isSearchBarFocused: $isSearchBarFocused");
// return isSearchBarFocused
// ? Container()
// : FloatingCard(
// bottomPosition: 0.0,
// leftPosition: 0.0,
// rightPosition: 0.0,
// width: 500,
// borderRadius: BorderRadius.circular(12.0),
// child: Container(
// margin: EdgeInsets.all(12),
// child: Column(
// children: [
// // SecondaryButton(
// // color: Colors.grey[800],
// // textColor: Colors.white,
// // onTap: () {
// // Navigator.push(
// // context,
// // FadePage(
// // page: LocationPage(
// // latitude: latitude,
// // longitude: longitude,
// // ),
// // ),
// // );
// // },
// // label: TranslationBase.of(context).addNewAddress,
// // ),
// // SizedBox(
// // height: 10,
// // ),
// SecondaryButton(
// color: Colors.red[800],
// textColor: Colors.white,
// onTap: () {
// setState(() {
// widget.patientERInsertPresOrderRequestModel.latitude = selectedPlace.geometry.location.lat;
// widget.patientERInsertPresOrderRequestModel.longitude = selectedPlace.geometry.location.lng;
// });
// widget.changePageViewIndex(3);
// },
// label: TranslationBase.of(context).confirm,
// ),
// ],
// ),
// ),
// );
// },
// initialPosition: LatLng(latitude, longitude),
// useCurrentLocation: showCurrentLocation,
// )
onPlacePicked: (PickResult result) { ),
print(result.adrAddress); if (widget.model.addressesList.isNotEmpty)
widget.changePageViewIndex(3); Row(mainAxisAlignment: MainAxisAlignment.center, children: [
}, Container(
selectedPlaceWidgetBuilder: height: 60,
(_, selectedPlace, state, isSearchBarFocused) { width: MediaQuery.of(context).size.width * .9,
print("state: $state, isSearchBarFocused: $isSearchBarFocused"); margin: EdgeInsets.only(top: 10),
return isSearchBarFocused decoration: BoxDecoration(borderRadius: BorderRadius.circular(10), color: Colors.white),
? Container() child: DropdownButtonHideUnderline(
: FloatingCard( child: ButtonTheme(
bottomPosition: 0.0, alignedDropdown: true,
leftPosition: 0.0, child: DropdownButton<AddressInfo>(
rightPosition: 0.0, hint: Text(
width: 500, widget.model.addressesList[0].address1,
borderRadius: BorderRadius.circular(12.0), style: TextStyle(color: CustomColors.black, fontSize: 14),
child: state == SearchingState.Searching
? Center(child: CircularProgressIndicator())
: Container(
margin: EdgeInsets.all(12),
child: Column(
children: [
SecondaryButton(
color: Colors.grey[800],
textColor: Colors.white,
onTap: () {
Navigator.push(
context,
FadePage(
page:
LocationPage(
latitude: latitude,
longitude: longitude,
),
),
);
},
label: TranslationBase.of(context).addNewAddress,
), ),
SizedBox(height: 10,), iconEnabledColor: CustomColors.grey2,
SecondaryButton( style: TextStyle(color: CustomColors.black, fontSize: 14),
color: Colors.red[800], dropdownColor: CustomColors.white,
textColor: Colors.white, value: _selectedAddress,
onTap: () { items: widget.model.addressesList.map((AddressInfo value) {
setState(() { return DropdownMenuItem<AddressInfo>(
widget.patientERInsertPresOrderRequestModel value: value,
.latitude = child: new AutoSizeText(
selectedPlace.geometry.location.lat; value.address1,
widget.patientERInsertPresOrderRequestModel ),
.longitude = );
selectedPlace.geometry.location.lng; }).toList(),
}); onChanged: (r) {},
widget.changePageViewIndex(3); underline: Container(
}, height: 0,
label: TranslationBase.of(context).confirm,
), ),
], ),
), ),
), ),
); )
}, ]),
initialPosition: LatLng(latitude, longitude), Positioned(
useCurrentLocation: showCurrentLocation, top: 80,
), left: 20,
if(widget.model.addressesList.isNotEmpty) child: Row(
Container( children: [
child: InkWell( Icon(
onTap: () => Icons.add_circle_rounded,
confirmSelectLocationDialog(widget.model.addressesList), ),
child: Container( InkWell(
padding: EdgeInsets.all(10), child: Texts(
width: double.infinity, TranslationBase.of(context).addNewAddress,
// height: 65, fontWeight: FontWeight.bold,
decoration: BoxDecoration( ),
borderRadius: BorderRadius.circular(10), onTap: () {
color: Colors.white), Navigator.push(
child: Row( context,
mainAxisAlignment: FadePage(
MainAxisAlignment.spaceBetween, page: LocationPage(
children: [ latitude: latitude,
Expanded(child: Texts(getAddressName(), fontSize: 14,),), longitude: longitude,
Icon(Icons.arrow_drop_down) ),
], ),
);
},
),
],
))
// Container(
// child: InkWell(
// onTap: () => confirmSelectLocationDialog(widget.model.addressesList),
// child: Container(
// padding: EdgeInsets.all(10),
// width: double.infinity,
// // height: 65,
// decoration: BoxDecoration(borderRadius: BorderRadius.circular(10), color: Colors.white),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Expanded(
// child: Texts(
// getAddressName(),
// fontSize: 14,
// ),
// ),
// Icon(Icons.arrow_drop_down)
// ],
// ),
// ),
// ),
// height: 56,
// width: double.infinity,
// color: Theme.of(context).scaffoldBackgroundColor,
// )
],
),
bottomSheet: Container(
width: MediaQuery.of(context).size.width,
height: 70.0,
margin: EdgeInsets.only(left: 15.0, right: 15.0, top: 10.0),
child: Button(
onTap: () async {
Navigator.push(
context,
FadePage(
page: NewHomeHealthCareStepThreePage(
patientERInsertPresOrderRequestModel: widget.patientERInsertPresOrderRequestModel,
model: widget.model,
), ),
), ),
), );
height: 56, width: double.infinity, color: Theme },
.of(context) label: TranslationBase.of(context).continues,
.scaffoldBackgroundColor, backgroundColor: Colors.red[900],
),
)
],
), ),
); );
} }
void confirmSelectLocationDialog(List<AddressInfo> addresses) { void confirmSelectLocationDialog(List<AddressInfo> addresses) {
showDialog( showDialog(
context: context, context: context,
child: SelectLocationDialog( child: SelectLocationDialog(
addresses: addresses, addresses: addresses,
selectedAddress: _selectedAddress selectedAddress: _selectedAddress,
,
onValueSelected: (value) { onValueSelected: (value) {
setLatitudeAndLongitude(latLong: value.latLong); setLatitudeAndLongitude(latLong: value.latLong);
setState(() { setState(() {

@ -11,12 +11,12 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; 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/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:geolocator/geolocator.dart'; import 'package:geolocator/geolocator.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import '../StepsWidget.dart'; import '../StepsWidget.dart';
import 'new_Home_health_care_step_one_page.dart'; import 'new_Home_health_care_step_one_page.dart';
@ -28,15 +28,13 @@ class NewHomeHealthCarePage extends StatefulWidget {
_NewHomeHealthCarePageState createState() => _NewHomeHealthCarePageState(); _NewHomeHealthCarePageState createState() => _NewHomeHealthCarePageState();
} }
class _NewHomeHealthCarePageState extends State<NewHomeHealthCarePage> class _NewHomeHealthCarePageState extends State<NewHomeHealthCarePage> with TickerProviderStateMixin {
with TickerProviderStateMixin {
PageController _controller; PageController _controller;
int _currentIndex = 1; int _currentIndex = 1;
double _latitude; double _latitude;
double _longitude; double _longitude;
PatientERInsertPresOrderRequestModel patientERInsertPresOrderRequestModel = PatientERInsertPresOrderRequestModel patientERInsertPresOrderRequestModel = new PatientERInsertPresOrderRequestModel();
new PatientERInsertPresOrderRequestModel();
@override @override
void initState() { void initState() {
@ -64,32 +62,23 @@ class _NewHomeHealthCarePageState extends State<NewHomeHealthCarePage>
setState(() { setState(() {
_currentIndex = tab; _currentIndex = tab;
}); });
_controller.animateToPage(tab, _controller.animateToPage(tab, duration: Duration(milliseconds: 800), curve: Curves.easeOutQuart);
duration: Duration(milliseconds: 800), curve: Curves.easeOutQuart);
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
void showConfirmMessage(HomeHealthCareViewModel model, void showConfirmMessage(HomeHealthCareViewModel model, GetOrderDetailByOrderIDResponseModel order) {
GetOrderDetailByOrderIDResponseModel order) {
showDialog( showDialog(
context: context, context: context,
child: ConfirmCancelOrderDialog( child: ConfirmCancelOrderDialog(
model: model, model: model,
onTap: () async { onTap: () async {
UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.presOrderID, rejectionReason: "", presOrderStatus: 4, editedBy: 3);
UpdatePresOrderRequestModel(
presOrderID: order.presOrderID,
rejectionReason: "",
presOrderStatus: 4,
editedBy: 3);
await model.updateHHCPresOrder(updatePresOrderRequestModel); await model.updateHHCPresOrder(updatePresOrderRequestModel);
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
Utils.showErrorToast(model.error); Utils.showErrorToast(model.error);
} else { } else {
AppToast.showSuccessToast( AppToast.showSuccessToast(message: TranslationBase.of(context).processDoneSuccessfully);
message:
TranslationBase.of(context).processDoneSuccessfully);
await model.getHHCAllPresOrders(); await model.getHHCAllPresOrders();
// await model.getHHCAllServices(); // await model.getHHCAllServices();
} }
@ -106,15 +95,15 @@ class _NewHomeHealthCarePageState extends State<NewHomeHealthCarePage>
height: MediaQuery.of(context).size.height * 0.8, height: MediaQuery.of(context).size.height * 0.8,
child: Column( child: Column(
children: [ children: [
Container( // Container(
margin: EdgeInsets.only( // margin: EdgeInsets.only(
left: MediaQuery.of(context).size.width * 0.05, // left: MediaQuery.of(context).size.width * 0.05,
right: MediaQuery.of(context).size.width * 0.05), // right: MediaQuery.of(context).size.width * 0.05),
child: StepsWidget( // child: StepsWidget(
index: _currentIndex, // index: _currentIndex,
changeCurrentTab: _changeCurrentTab, // changeCurrentTab: _changeCurrentTab,
), // ),
), // ),
Expanded( Expanded(
child: PageView( child: PageView(
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
@ -130,248 +119,284 @@ class _NewHomeHealthCarePageState extends State<NewHomeHealthCarePage>
? FractionallySizedBox( ? FractionallySizedBox(
widthFactor: 0.9, widthFactor: 0.9,
child: SingleChildScrollView( child: SingleChildScrollView(
child: Container( child: Row(
width: double.infinity, children: [
margin: EdgeInsets.only(top: 15), Expanded(
decoration: BoxDecoration( flex: 3,
border: Border.all( child: ClipRRect(
color: Colors.grey, width: 1), borderRadius: const BorderRadius.all(Radius.circular(20.0)),
borderRadius: BorderRadius.circular(12),
color: Theme.of(context).primaryColor),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
SizedBox(
height: 12,
),
Container(
width: double.infinity,
padding: EdgeInsets.only(
left: 15,
bottom: 15,
top: 15,
right: 15),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Colors.grey,
width: 1.0,
),
),
// borderRadius: BorderRadius.circular(12),
color:
Theme.of(context).primaryColor),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Texts(
TranslationBase.of(context)
.requestID,
bold: false,
fontSize: 13,
),
SizedBox(
height: 4,
),
Texts(
widget.model.pendingOrder.iD
.toString(),
fontSize: 22,
),
],
),
),
Container(
width: double.infinity,
padding: EdgeInsets.only(
left: 15,
bottom: 15,
top: 15,
right: 15),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Colors.grey,
width: 1.0,
),
),
// borderRadius: BorderRadius.circular(12),
color:
Theme.of(context).primaryColor),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Texts(
TranslationBase.of(context)
.OrderStatus,
bold: false,
fontSize: 13,
),
SizedBox(
height: 4,
),
Texts(
projectViewModel.isArabic
? widget.model.pendingOrder
.descriptionN
: widget.model.pendingOrder
.description,
fontSize: 22,
),
],
),
),
Container(
width: double.infinity,
padding: EdgeInsets.only(
left: 15,
bottom: 15,
top: 15,
right: 15),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Colors.grey,
width: 1.0,
),
),
// borderRadius: BorderRadius.circular(12),
color:
Theme.of(context).primaryColor),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Texts(
TranslationBase.of(context)
.pickupDate,
bold: false,
fontSize: 13,
),
SizedBox(
height: 4,
),
Texts(
DateUtil
.getDayMonthYearDateFormatted(
DateUtil
.convertStringToDate(
widget
.model
.pendingOrder
.createdOn)),
fontSize: 22,
),
],
),
),
...List.generate(
widget.model.hhcAllOrderDetail.length,
(index) => Container(
width: double.infinity,
padding: EdgeInsets.only(
left: 15,
bottom: 15,
top: 15,
right: 15),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Colors.grey,
width: 1.0,
),
),
// borderRadius: BorderRadius.circular(12),
color: Theme.of(context)
.primaryColor),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Texts(
TranslationBase.of(context)
.serviceName,
bold: false,
fontSize: 13,
),
SizedBox(
height: 4,
),
Texts(
projectViewModel.isArabic
? widget
.model
.hhcAllOrderDetail[
index]
.descriptionN
: widget
.model
.hhcAllOrderDetail[
index]
.description,
fontSize: 22,
bold: true,
),
],
),
),
),
SizedBox(
height: 12,
),
Center(
child: Container( child: Container(
width: MediaQuery.of(context) padding: EdgeInsets.only(left: 10, right: 10, top: 10, bottom: 10),
.size margin: EdgeInsets.only(left: 10, right: 10, top: 7, bottom: 7),
.width * decoration: BoxDecoration(boxShadow: [
0.85, BoxShadow(color: Color(0xffcd9e1b), offset: Offset(-10, 0)),
child: SecondaryButton( ], borderRadius: const BorderRadius.all(Radius.circular(10.0)), color: Colors.white),
label: TranslationBase.of(context) child: Row(
.cancel children: [
.toUpperCase(), Expanded(
onTap: () { child: Column(
showConfirmMessage( mainAxisAlignment: MainAxisAlignment.start,
widget.model, children: [
widget.model Row(
.hhcAllOrderDetail[0]); crossAxisAlignment: CrossAxisAlignment.start,
}, children: [
color: Colors.red[800], Texts(
disabled: false, TranslationBase.of(context).OrderStatus +
textColor: Theme.of(context) ' ' +
.backgroundColor), (projectViewModel.isArabic ? widget.model.pendingOrder.descriptionN : widget.model.pendingOrder.description),
), bold: false,
), fontSize: 12,
SizedBox( color: Color(0xffcd9e1b),
height: 12, fontWeight: FontWeight.bold,
), ),
], ],
), ),
), Row(
), mainAxisAlignment: MainAxisAlignment.end,
) children: [
Texts(
DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.model.pendingOrder.createdOn)),
fontSize: 14,
)
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(
TranslationBase.of(context).requestID + ' ' + widget.model.pendingOrder.iD.toString(),
bold: false,
fontSize: 18,
),
Texts(
TranslationBase.of(context).serviceName,
fontSize: 12,
),
...List.generate(
widget.model.hhcAllOrderDetail.length,
(index) => Container(
child: Texts(
projectViewModel.isArabic
? widget.model.hhcAllOrderDetail[index].descriptionN
: widget.model.hhcAllOrderDetail[index].description.capitalize(),
fontSize: 14,
),
),
),
],
),
SecondaryButton(
onTap: () {
showConfirmMessage(widget.model, widget.model.hhcAllOrderDetail[0]);
},
label: TranslationBase.of(context).cancel,
color: Colors.red[900],
small: true,
)
],
// )
// ],
// )
// ],
),
],
))
],
))),
)
],
))
// Row(
// children: [
// Expanded(
// flex: 1,
// child: ClipRRect(
// borderRadius: const BorderRadius.all(Radius.circular(20.0)),
// child: Container(
// padding: EdgeInsets.only(left: 10, right: 10, top: 20, bottom: 20),
// margin: EdgeInsets.only(left: 20, right: 20, top: 7, bottom: 7),
// decoration: BoxDecoration(
// boxShadow: [
// BoxShadow(color: Colors.green, offset: Offset(-5, 0)),
// ],
// )))),
// Expanded(
// flex: 5,
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Container(
// width: double.infinity,
// padding: EdgeInsets.all(5),
// decoration: BoxDecoration(
// border: Border(
// bottom: BorderSide(
// color: Colors.grey,
// width: 1.0,
// ),
// ),
// // borderRadius: BorderRadius.circular(12),
// ),
// child: Row(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Texts(
// TranslationBase.of(context).OrderStatus,
// bold: false,
// fontSize: 12,
// ),
// SizedBox(
// height: 4,
// ),
// Texts(
// projectViewModel.isArabic ? widget.model.pendingOrder.descriptionN : widget.model.pendingOrder.description,
// fontSize: 12,
// ),
// ],
// ),
// ),
// Container(
// width: double.infinity,
// padding: EdgeInsets.only(left: 15, bottom: 15, top: 15, right: 15),
// decoration: BoxDecoration(
// border: Border(
// bottom: BorderSide(
// color: Colors.grey,
// width: 1.0,
// ),
// ),
// // borderRadius: BorderRadius.circular(12),
// ),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Texts(
// TranslationBase.of(context).requestID,
// bold: false,
// fontSize: 13,
// ),
// SizedBox(
// height: 4,
// ),
// Texts(
// widget.model.pendingOrder.iD.toString(),
// fontSize: 22,
// ),
// ],
// ),
// ),
// Container(
// width: double.infinity,
// padding: EdgeInsets.only(left: 15, bottom: 15, top: 15, right: 15),
// decoration: BoxDecoration(
// border: Border(
// bottom: BorderSide(
// color: Colors.grey,
// width: 1.0,
// ),
// ),
// // borderRadius: BorderRadius.circular(12),
// ),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Texts(
// TranslationBase.of(context).pickupDate,
// bold: false,
// fontSize: 13,
// ),
// SizedBox(
// height: 4,
// ),
// Texts(
// DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.model.pendingOrder.createdOn)),
// fontSize: 22,
// ),
// ],
// ),
// ),
// ...List.generate(
// widget.model.hhcAllOrderDetail.length,
// (index) => Container(
// width: double.infinity,
// padding: EdgeInsets.only(left: 15, bottom: 15, top: 15, right: 15),
// decoration: BoxDecoration(
// border: Border(
// bottom: BorderSide(
// color: Colors.grey,
// width: 1.0,
// ),
// ),
// // borderRadius: BorderRadius.circular(12),
// color: Theme.of(context).primaryColor),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Texts(
// TranslationBase.of(context).serviceName,
// bold: false,
// fontSize: 13,
// ),
// SizedBox(
// height: 4,
// ),
// Texts(
// projectViewModel.isArabic ? widget.model.hhcAllOrderDetail[index].descriptionN : widget.model.hhcAllOrderDetail[index].description,
// fontSize: 22,
// bold: true,
// ),
// ],
// ),
// ),
// ),
// SizedBox(
// height: 12,
// ),
// Center(
// child: Container(
// width: MediaQuery.of(context).size.width * 0.85,
// child: SecondaryButton(
// label: TranslationBase.of(context).cancel.toUpperCase(),
// onTap: () {
// showConfirmMessage(widget.model, widget.model.hhcAllOrderDetail[0]);
// },
// color: Colors.red[800],
// disabled: false,
// textColor: Theme.of(context).backgroundColor),
// ),
// ),
// SizedBox(
// height: 12,
// ),
// ],
// ),
// )
// ],
// ),
//),
)
: NewHomeHealthCareStepOnePage( : NewHomeHealthCareStepOnePage(
changePageViewIndex: _changeCurrentTab, changePageViewIndex: _changeCurrentTab,
patientERInsertPresOrderRequestModel: patientERInsertPresOrderRequestModel: patientERInsertPresOrderRequestModel,
patientERInsertPresOrderRequestModel,
model: widget.model, model: widget.model,
), ),
NewHomeHealthCareStepTowPage( // NewHomeHealthCareStepTowPage(
latitude: _latitude, // latitude: _latitude,
longitude: _longitude, // longitude: _longitude,
changePageViewIndex: _changeCurrentTab, // changePageViewIndex: _changeCurrentTab,
patientERInsertPresOrderRequestModel: // patientERInsertPresOrderRequestModel: patientERInsertPresOrderRequestModel,
patientERInsertPresOrderRequestModel, // model: widget.model,
model: widget.model, // ),
), // NewHomeHealthCareStepThreePage(
NewHomeHealthCareStepThreePage( // changePageViewIndex: _changeCurrentTab,
changePageViewIndex: _changeCurrentTab, // patientERInsertPresOrderRequestModel: patientERInsertPresOrderRequestModel,
patientERInsertPresOrderRequestModel: // model: widget.model,
patientERInsertPresOrderRequestModel, // )
model: widget.model,
)
], ],
), ),
), ),

@ -1,4 +1,6 @@
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -12,170 +14,87 @@ class StepsWidget extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); return showRow();
return !projectViewModel.isArabic? Stack( }
children: [
Container(
height: 50,
width: MediaQuery.of(context).size.width,
color: Colors.transparent,
child: Center(
child: Divider(
color: Colors.grey,
height: 0.75,
thickness: 0.75,
),
),
),
Positioned(
top: 10,
left: 0,
child: InkWell(
onTap: () => changeCurrentTab(0),
child: Container(
width: 35,
height: 35,
decoration: BoxDecoration(
border: index > 0 ? null:Border.all(color: Colors.black,width: 0.75),
shape: BoxShape.circle,
color: index == 0 ? Colors.grey[800] : index > 0 ?Colors.green: Colors.white,
),
child: Center(
child: Texts(
'1',
color: index == 0 ? Colors.white : index > 0 ?Colors.white: Colors.grey[800],
),
),
),
),
),
Positioned(
top: 10,
left: MediaQuery.of(context).size.width * 0.42,
child: InkWell(
onTap: () => index >= 2 ? changeCurrentTab(1) : null,
child: Container(
width: 35,
height: 35,
decoration: BoxDecoration(
border: index > 1 ? null:Border.all(color: Colors.black,width: 0.75),
shape: BoxShape.circle,
color: index == 1 ? Colors.grey[800] : index > 1 ?Colors.green: Colors.white,
),
child: Center(
child: Texts(
'2',
color: index == 1? Colors.white : index > 1 ?Colors.white: Colors.grey[800],
),
),
),
),
),
Positioned(
top: 10,
right: 0,
child: InkWell(
onTap: () => index == 2 ?changeCurrentTab(3) : null,
child: Container(
width: 35,
height: 35,
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(color: Colors.black,width: 0.75),
color: index == 2 ? Colors.grey[800] : Colors.white,
),
child: Center(
child: Texts(
'3',
color: index == 2 ? Colors.white : Colors.grey[800],
),
),
),
),
),
], Widget showRow() {
):Stack( return Container(
children: [ width: double.infinity,
Container( child: Row(
height: 50, children: [
width: MediaQuery.of(context).size.width, InkWell(
color: Colors.transparent,
child: Center(
child: Divider(
color: Colors.grey,
height: 0.75,
thickness: 0.75,
),
),
),
Positioned(
top: 10,
right: 0,
child: InkWell(
onTap: () => changeCurrentTab(0), onTap: () => changeCurrentTab(0),
child: Container( child: Container(
width: 35, width: 35,
height: 35, height: 35,
decoration: BoxDecoration( decoration: containerColorRadiusBorder(
border: index > 0 ? null:Border.all(color: Colors.black,width: 0.75), index == 0
shape: BoxShape.circle, ? CustomColors.accentColor
color: index == 0 ? Colors.grey[800] : index > 0 ?Colors.green: Colors.white, : index > 0
), ? Colors.green[700]
: Colors.white,
2000,
Colors.black),
child: Center( child: Center(
child: Texts( child: Text(
'1', "1",
color: index == 0 ? Colors.white : index > 0 ?Colors.white: Colors.grey[800], style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
),
), ),
), ),
), ),
), ),
), Expanded(child: mDivider(Colors.grey)),
Positioned( InkWell(
top: 10,
left: MediaQuery.of(context).size.width * 0.42,
child: InkWell(
onTap: () => index >= 2 ? changeCurrentTab(1) : null, onTap: () => index >= 2 ? changeCurrentTab(1) : null,
child: Container( child: Container(
width: 35, width: 35,
height: 35, height: 35,
decoration: BoxDecoration( decoration: containerColorRadiusBorder(
border: index > 1 ? null:Border.all(color: Colors.black,width: 0.75), index == 1
shape: BoxShape.circle, ? CustomColors.accentColor
color: index == 1 ? Colors.grey[800] : index > 1 ?Colors.green: Colors.white, : index > 1
), ? Colors.green[700]
: Colors.white,
2000,
Colors.black),
child: Center( child: Center(
child: Texts( child: Text(
'2', "2",
color: index == 1? Colors.white : index > 1 ?Colors.white: Colors.grey[800], style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
),
), ),
), ),
), ),
), ),
), Expanded(child: mDivider(Colors.grey)),
Positioned( InkWell(
top: 10, onTap: () => index == 2 ? changeCurrentTab(3) : null,
left: 0,
child: InkWell(
onTap: () => index == 2 ?changeCurrentTab(3) : null,
child: Container( child: Container(
width: 35, width: 35,
height: 35, height: 35,
decoration: BoxDecoration( decoration: containerColorRadiusBorder(
shape: BoxShape.circle, index == 2 ? CustomColors.accentColor : Colors.white,
border: Border.all(color: Colors.black,width: 0.75), 2000,
color: index == 2 ? Colors.grey[800] : Colors.white, Colors.black,
), ),
child: Center( child: Center(
child: Texts( child: Text(
'3', "3",
color: index == 2 ? Colors.white : Colors.grey[800], style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
),
), ),
), ),
), ),
), ),
), ],
], ),
); );
} }
} }

@ -17,8 +17,7 @@ class HomeHealthCarePage extends StatefulWidget {
_HomeHealthCarePageState createState() => _HomeHealthCarePageState(); _HomeHealthCarePageState createState() => _HomeHealthCarePageState();
} }
class _HomeHealthCarePageState extends State<HomeHealthCarePage> class _HomeHealthCarePageState extends State<HomeHealthCarePage> with SingleTickerProviderStateMixin {
with SingleTickerProviderStateMixin {
TabController _tabController; TabController _tabController;
@override @override
@ -43,75 +42,46 @@ class _HomeHealthCarePageState extends State<HomeHealthCarePage>
isShowAppBar: true, isShowAppBar: true,
description: TranslationBase.of(context).HHCNotAuthMsg, description: TranslationBase.of(context).HHCNotAuthMsg,
appBarTitle: TranslationBase.of(context).homeHealthCare, appBarTitle: TranslationBase.of(context).homeHealthCare,
imagesInfo: [ showNewAppBar: true,
ImagesInfo( showNewAppBarTitle: true,
imageAr: 'https://hmgwebservices.com/Images/MobileApp/HHC/ar/0.png', imagesInfo: [ImagesInfo(imageAr: 'https://hmgwebservices.com/Images/MobileApp/HHC/ar/0.png', imageEn: 'https://hmgwebservices.com/Images/MobileApp/HHC/en/0.png')],
imageEn: 'https://hmgwebservices.com/Images/MobileApp/HHC/en/0.png')
],
body: Scaffold( body: Scaffold(
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
appBar: PreferredSize( appBar: PreferredSize(
preferredSize: Size.fromHeight(65.0), preferredSize: Size.fromHeight(65.0),
child: Stack( child: Stack(
children: <Widget>[ children: <Widget>[
Positioned(
bottom: 1,
left: 0,
right: 0,
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10),
child: Container(
color: Theme.of(context)
.scaffoldBackgroundColor
.withOpacity(0.8),
height: 70.0,
),
),
),
Center( Center(
child: Container( child: Center(
height: 60.0, child: TabBar(
margin: EdgeInsets.only(top: 10.0), isScrollable: true,
width: MediaQuery.of(context).size.width * 0.9, controller: _tabController,
decoration: BoxDecoration( indicatorWeight: 5.0,
border: Border( indicatorSize: TabBarIndicatorSize.tab,
bottom: BorderSide( indicatorColor: Colors.red[800],
color: Theme.of(context).dividerColor, labelColor: Theme.of(context).primaryColor,
width: 0.7), labelPadding: EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0),
), unselectedLabelColor: Colors.grey[800],
color: Theme.of(context).primaryColor), tabs: [
child: Center( Container(
child: TabBar( width: MediaQuery.of(context).size.width * 0.37,
isScrollable: true, child: Center(
controller: _tabController, child: Texts(
indicatorWeight: 5.0, TranslationBase.of(context).homeHealthCare,
indicatorSize: TabBarIndicatorSize.tab, color: Colors.black,
indicatorColor: Colors.red[800],
labelColor: Theme.of(context).primaryColor,
labelPadding:
EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0),
unselectedLabelColor: Colors.grey[800],
tabs: [
Container(
width: MediaQuery.of(context).size.width * 0.37,
child: Center(
child: Texts(
TranslationBase.of(context).homeHealthCare,
color: Colors.black,
),
), ),
), ),
Container( ),
width: MediaQuery.of(context).size.width * 0.37, Container(
child: Center( width: MediaQuery.of(context).size.width * 0.37,
child: Texts( child: Center(
TranslationBase.of(context).orderLog, child: Texts(
color: Colors.black, TranslationBase.of(context).orderLog,
), color: Colors.black,
), ),
), ),
], ),
), ],
), ),
), ),
), ),

@ -2,6 +2,9 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/ContactUs/LiveChat/livechat_page.dart'; import 'package:diplomaticquarterapp/pages/ContactUs/LiveChat/livechat_page.dart';
import 'package:diplomaticquarterapp/pages/ContactUs/findus/findus_page.dart'; import 'package:diplomaticquarterapp/pages/ContactUs/findus/findus_page.dart';
import 'package:diplomaticquarterapp/pages/feedback/feedback_home_page.dart'; import 'package:diplomaticquarterapp/pages/feedback/feedback_home_page.dart';
import 'package:diplomaticquarterapp/pages/medical/my_trackers/Weight/WeightHomePage.dart';
import 'package:diplomaticquarterapp/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart';
import 'package:diplomaticquarterapp/pages/medical/my_trackers/blood_suger/blood_sugar_home_page.dart';
import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
@ -62,6 +65,15 @@ class CardCommonContact extends StatelessWidget {
} else if (type == 2) { } else if (type == 2) {
//LiveChatPage //LiveChatPage
Navigator.push(context, FadePage(page: LiveChatPage())); Navigator.push(context, FadePage(page: LiveChatPage()));
} else if (type == 3) {
//LiveChatPage
Navigator.push(context, FadePage(page: BloodSugarHomePage()));
} else if (type == 4) {
//LiveChatPage
Navigator.push(context, FadePage(page: BloodPressureHomePage()));
} else if (type == 5) {
//LiveChatPage
Navigator.push(context, FadePage(page: WeightHomePage()));
} }
} }
} }

@ -81,10 +81,11 @@ class _HomePageFragment2State extends State<HomePageFragment2> {
navigateTo(context, MedicalProfilePageNew()); navigateTo(context, MedicalProfilePageNew());
}, },
child: LoggedSliderView( child: LoggedSliderView(
projectViewModel, projectViewModel,
new SliderData(TranslationBase.of(context).fileno + ": " + projectViewModel.user.patientID.toString(), projectViewModel.user.firstName + ' ' + projectViewModel.user.lastName, new SliderData(TranslationBase.of(context).fileno + ": " + projectViewModel.user.patientID.toString(), projectViewModel.user.firstName + ' ' + projectViewModel.user.lastName,
"", bannerColor[0].darkColor, bannerColor[0].lightColor), "", bannerColor[0].darkColor, bannerColor[0].lightColor),
widget.model), widget.model,
),
), ),
), ),
) )

@ -41,7 +41,7 @@ import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import '../../locator.dart'; import '../../locator.dart';
import '../../routes.dart'; import '../../routes.dart';
@ -601,31 +601,33 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
), ),
), ),
drawer: SafeArea(child: AppDrawer()), drawer: SafeArea(child: AppDrawer()),
extendBody: true, extendBody: false,
body: WillPopScope( body: WillPopScope(
onWillPop: onWillPop, onWillPop: onWillPop,
child: PageView( child: Stack(children: [
physics: NeverScrollableScrollPhysics(), PageView(
controller: pageController, physics: NeverScrollableScrollPhysics(),
children: [ controller: pageController,
HomePage2( children: [
goToMyProfile: () { HomePage2(
changeCurrentTab(1); goToMyProfile: () {
}, changeCurrentTab(1);
onLoginClick: () { },
login(); onLoginClick: () {
}, login();
onMedicalFileClick: () { },
changeCurrentTab(1); onMedicalFileClick: () {
}, changeCurrentTab(1);
},
),
MedicalProfilePageNew(),
Search(),
MyFamily(isAppbarVisible: false),
ToDo(isShowAppBar: false),
], // Please do not remove the BookingOptions from this array
), ),
MedicalProfilePageNew(), RobotIcon()
Search(), ])),
MyFamily(isAppbarVisible: false),
ToDo(isShowAppBar: false),
], // Please do not remove the BookingOptions from this array
),
),
bottomNavigationBar: BottomNavBar( bottomNavigationBar: BottomNavBar(
changeIndex: changeCurrentTab, changeIndex: changeCurrentTab,
index: currentTab, index: currentTab,

@ -138,7 +138,7 @@ class LoggedSliderView extends StatelessWidget {
padding: const EdgeInsets.only(left: 20, right: 20), padding: const EdgeInsets.only(left: 20, right: 20),
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Expanded( Expanded( flex: 3,
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
SvgPicture.asset( SvgPicture.asset(
@ -155,7 +155,10 @@ class LoggedSliderView extends StatelessWidget {
], ],
), ),
), ),
Expanded( SizedBox(
width: 3,
),
Expanded( flex: 3,
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
SvgPicture.asset( SvgPicture.asset(
@ -168,7 +171,11 @@ class LoggedSliderView extends StatelessWidget {
], ],
), ),
), ),
SizedBox(
width: 3,
),
Expanded( Expanded(
flex: 3,
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
SvgPicture.asset( SvgPicture.asset(
@ -177,10 +184,11 @@ class LoggedSliderView extends StatelessWidget {
height: 12, height: 12,
), ),
mWidth(6), mWidth(6),
Texts('${TranslationBase.of(context).bloodType}: ${model.booldType}', color: Colors.white, fontSize: 10) Texts('${TranslationBase.of(context).bloodType1} ${model.booldType}', color: Colors.white, fontSize: 10)
], ],
), ),
), ),
mFlex(1),
], ],
), ),
), ),

@ -15,6 +15,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
class AddWeightPage extends StatefulWidget { class AddWeightPage extends StatefulWidget {
final WeightPressureViewModel model; final WeightPressureViewModel model;
@ -25,16 +26,7 @@ class AddWeightPage extends StatefulWidget {
final String measureTimeSelectedType; final String measureTimeSelectedType;
final int weightUnit; final int weightUnit;
AddWeightPage( AddWeightPage({Key key, this.model, this.isUpdate = false, this.dayWeightDate, this.lineItemNo, this.weightValue, this.measureTimeSelectedType, this.weightUnit}) : super(key: key);
{Key key,
this.model,
this.isUpdate = false,
this.dayWeightDate,
this.lineItemNo,
this.weightValue,
this.measureTimeSelectedType,
this.weightUnit})
: super(key: key);
@override @override
_AddWeightPageState createState() => _AddWeightPageState(); _AddWeightPageState createState() => _AddWeightPageState();
@ -62,8 +54,7 @@ class _AddWeightPageState extends State<AddWeightPage> {
measureTimeSelectedType = widget.measureTimeSelectedType; measureTimeSelectedType = widget.measureTimeSelectedType;
if (measureUnitEnList.contains(widget.measureTimeSelectedType)) if (measureUnitEnList.contains(widget.measureTimeSelectedType))
weightUnit = measureUnitEnList.indexOf(widget.measureTimeSelectedType); weightUnit = measureUnitEnList.indexOf(widget.measureTimeSelectedType);
else if (measureUnitArList.contains(widget.measureTimeSelectedType)) else if (measureUnitArList.contains(widget.measureTimeSelectedType)) weightUnit = measureUnitArList.indexOf(widget.measureTimeSelectedType);
weightUnit = measureUnitArList.indexOf(widget.measureTimeSelectedType);
_weightValueController.text = widget.weightValue; _weightValueController.text = widget.weightValue;
validateForm(); validateForm();
} }
@ -74,211 +65,199 @@ class _AddWeightPageState extends State<AddWeightPage> {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return AppScaffold( return AppScaffold(
isShowAppBar: true, isShowAppBar: true,
appBarTitle: widget.isUpdate appBarTitle: widget.isUpdate ? TranslationBase.of(context).update : TranslationBase.of(context).add,
? TranslationBase.of(context).update showNewAppBar: true,
: TranslationBase.of(context).add, showNewAppBarTitle: true,
appBarIcons: widget.isUpdate body: SingleChildScrollView(
? [ physics: BouncingScrollPhysics(),
IconButton( child: Container(
icon: Icon(Icons.delete), margin: EdgeInsets.all(15),
color: Colors.white, child: Column(
onPressed: () { children: [
ConfirmDialog dialog = new ConfirmDialog( SizedBox(
context: context, height: 15,
confirmMessage: 'Remove this measure', ),
okText: TranslationBase.of(context).ok, NewTextFields(
cancelText: TranslationBase.of(context).cancel, hintText: TranslationBase.of(context).weightAdd,
okFunction: () async { controller: _weightValueController,
ConfirmDialog.closeAlertDialog(context); keyboardType: TextInputType.number,
onChanged: (value) => validateForm(),
GifLoaderDialogUtils.showMyDialog(context); fontWeight: FontWeight.normal,
widget.model fontSize: 14,
.deleteWeightResult(lineItemNo: widget.lineItemNo) ),
.then((value) { SizedBox(
GifLoaderDialogUtils.hideDialog(context); height: 8,
if (widget.model.state == ViewState.ErrorLocal) ),
AppToast.showErrorToast( InkWell(
message: widget.model.error); onTap: () {
else confirmSelectMeasureTimeDialog(projectViewModel.isArabic ? measureUnitArList : measureUnitEnList);
Navigator.pop(context); },
}).catchError((e) { child: Container(
GifLoaderDialogUtils.hideDialog(context); padding: EdgeInsets.all(12),
AppToast.showErrorToast(message: widget.model.error); width: double.infinity,
}); height: 65,
}, decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white),
cancelFunction: () => {}); child: Row(
dialog.showAlertDialog(context); mainAxisAlignment: MainAxisAlignment.spaceBetween,
}, children: [
) Texts(measureTimeSelectedType ?? TranslationBase.of(context).other),
] Icon(
: null, Icons.arrow_drop_down,
body: SingleChildScrollView( color: Colors.grey,
physics: BouncingScrollPhysics(), )
child: Container( ],
margin: EdgeInsets.all(15), ),
child: Column(
children: [
SizedBox(
height: 15,
),
NewTextFields(
hintText: TranslationBase.of(context).weightAdd,
controller: _weightValueController,
keyboardType: TextInputType.number,
onChanged: (value) => validateForm(),
),
SizedBox(
height: 8,
),
InkWell(
onTap: () {
confirmSelectMeasureTimeDialog(projectViewModel.isArabic
? measureUnitArList
: measureUnitEnList);
},
child: Container(
padding: EdgeInsets.all(12),
width: double.infinity,
height: 65,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.white),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(measureTimeSelectedType ??
TranslationBase.of(context).other),
Icon(
Icons.arrow_drop_down,
color: Colors.grey,
)
],
), ),
), ),
), SizedBox(
SizedBox( height: 8,
height: 8, ),
), InkWell(
InkWell( onTap: () {
onTap: () { DatePicker.showDatePicker(
DatePicker.showDatePicker( context,
context, showTitleActions: true,
showTitleActions: true, minTime: DateTime(DateTime.now().year - 1, 1, 1),
minTime: DateTime(DateTime.now().year - 1, 1, 1), maxTime: DateTime.now(),
maxTime: DateTime.now(), onConfirm: (date) {
onConfirm: (date) { setState(() {
setState(() { dayWeightDate = date;
dayWeightDate = date; });
}); },
}, currentTime: dayWeightDate,
currentTime: dayWeightDate, locale: projectViewModel.localeType,
locale: projectViewModel.localeType, );
); },
}, child: Container(
child: Container( padding: EdgeInsets.all(12),
padding: EdgeInsets.all(12), width: double.infinity,
width: double.infinity, height: 65,
height: 65, decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white),
decoration: BoxDecoration( child: Row(
borderRadius: BorderRadius.circular(12), mainAxisAlignment: MainAxisAlignment.spaceBetween,
color: Colors.white), children: [
child: Row( Texts(TranslationBase.of(context).date),
mainAxisAlignment: MainAxisAlignment.spaceBetween, Texts(getDate()),
children: [ ],
Texts(TranslationBase.of(context).date), ),
Texts(getDate()),
],
), ),
), ),
), SizedBox(
SizedBox( height: 8,
height: 8, ),
), InkWell(
InkWell( onTap: () {
onTap: () { DatePicker.showTimePicker(
DatePicker.showTimePicker( context,
context, showTitleActions: true,
showTitleActions: true, onConfirm: (date) {
onConfirm: (date) { setState(() {
setState(() { timeWeightDate = date;
timeWeightDate = date; });
}); },
}, currentTime: timeWeightDate,
currentTime: timeWeightDate, locale: projectViewModel.localeType,
locale: projectViewModel.localeType, );
); },
}, child: Container(
child: Container( padding: EdgeInsets.all(12),
padding: EdgeInsets.all(12), width: double.infinity,
width: double.infinity, height: 65,
height: 65, decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white),
decoration: BoxDecoration( child: Row(
borderRadius: BorderRadius.circular(12), mainAxisAlignment: MainAxisAlignment.spaceBetween,
color: Colors.white), children: [Texts(TranslationBase.of(context).time), Texts(getTime())],
child: Row( ),
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(TranslationBase.of(context).time),
Texts(getTime())
],
), ),
), ),
), widget.isUpdate
], ? Container(
padding: EdgeInsets.all(10),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
InkWell(
child: Texts(
TranslationBase.of(context).delete,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
color: Colors.red[900],
),
onTap: () {
ConfirmDialog dialog = new ConfirmDialog(
context: context,
confirmMessage: TranslationBase.of(context).removeMeasure,
okText: TranslationBase.of(context).ok,
cancelText: TranslationBase.of(context).cancel,
okFunction: () async {
ConfirmDialog.closeAlertDialog(context);
GifLoaderDialogUtils.showMyDialog(context);
widget.model.deleteWeightResult(lineItemNo: widget.lineItemNo).then((value) {
GifLoaderDialogUtils.hideDialog(context);
if (widget.model.state == ViewState.ErrorLocal)
AppToast.showErrorToast(message: widget.model.error);
else
Navigator.pop(context);
}).catchError((e) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: widget.model.error);
});
},
cancelFunction: () => {});
dialog.showAlertDialog(context);
})
],
))
: Container()
],
),
), ),
), ),
), bottomSheet: Container(
bottomSheet: Container( width: MediaQuery.of(context).size.width,
color: Colors.transparent, height: 70.0,
width: double.infinity, margin: EdgeInsets.only(left: 15.0, right: 15.0, top: 10.0),
height: MediaQuery.of(context).size.width * 0.2, child: Button(
child: Padding( onTap: () async {
padding: const EdgeInsets.all(15.0), if (_weightValueController.text.isNotEmpty) {
child: SecondaryButton( if (widget.isUpdate) {
loading: widget.model.state == ViewState.BusyLocal, GifLoaderDialogUtils.showMyDialog(context);
label: TranslationBase.of(context).save.toUpperCase(), widget.model
textColor: Colors.white, .updateWeightResult(
color: isButtonDisabled ? Colors.grey[900] : Colors.grey, weightDate: '${dayWeightDate.year}-${dayWeightDate.month}-${dayWeightDate.day} ${timeWeightDate.hour}:${timeWeightDate.minute}:00',
onTap: () { weightMeasured: _weightValueController.text.toString(),
if (_weightValueController.text.isNotEmpty) { weightUnit: weightUnit,
if (widget.isUpdate) { lineItemNo: widget.lineItemNo)
GifLoaderDialogUtils.showMyDialog(context); .then((value) {
widget.model GifLoaderDialogUtils.hideDialog(context);
.updateWeightResult( if (widget.model.state == ViewState.Error)
weightDate: AppToast.showErrorToast(message: widget.model.error);
'${dayWeightDate.year}-${dayWeightDate.month}-${dayWeightDate.day} ${timeWeightDate.hour}:${timeWeightDate.minute}:00', else
weightMeasured: Navigator.pop(context);
_weightValueController.text.toString(), });
weightUnit: weightUnit, } else
lineItemNo: widget.lineItemNo) widget.model
.then((value) { .addWeightResult(
GifLoaderDialogUtils.hideDialog(context); weightDate: '${dayWeightDate.year}-${dayWeightDate.month}-${dayWeightDate.day} ${timeWeightDate.hour}:${timeWeightDate.minute}:00',
if (widget.model.state == ViewState.Error) weightMeasured: _weightValueController.text.toString(),
AppToast.showErrorToast(message: widget.model.error); weightUnit: weightUnit,
else )
Navigator.pop(context); .then((value) {
}); GifLoaderDialogUtils.hideDialog(context);
} else if (widget.model.state == ViewState.Error)
widget.model AppToast.showErrorToast(message: widget.model.error);
.addWeightResult( else
weightDate: Navigator.pop(context);
'${dayWeightDate.year}-${dayWeightDate.month}-${dayWeightDate.day} ${timeWeightDate.hour}:${timeWeightDate.minute}:00', });
weightMeasured: _weightValueController.text.toString(), }
weightUnit: weightUnit, },
) label: TranslationBase.of(context).save.toUpperCase(),
.then((value) { backgroundColor: Colors.red[900],
GifLoaderDialogUtils.hideDialog(context); disabled: isButtonDisabled,
if (widget.model.state == ViewState.Error) ),
AppToast.showErrorToast(message: widget.model.error); ));
else
Navigator.pop(context);
});
}
}),
),
),
);
} }
String getDate() { String getDate() {
@ -308,8 +287,7 @@ class _AddWeightPageState extends State<AddWeightPage> {
} }
void validateForm() { void validateForm() {
if (_weightValueController.text.length > 0 && if (_weightValueController.text.length > 0 && measureTimeSelectedType != null) {
measureTimeSelectedType != null) {
setState(() { setState(() {
isButtonDisabled = true; isButtonDisabled = true;
}); });

@ -42,6 +42,8 @@ class _WeightHomePageState extends State<WeightHomePage> with SingleTickerProvid
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
isShowAppBar: true, isShowAppBar: true,
isShowDecPage: false, isShowDecPage: false,
showNewAppBar: true,
showNewAppBarTitle: true,
appBarTitle: TranslationBase.of(context).weight, appBarTitle: TranslationBase.of(context).weight,
appBarIcons: [ appBarIcons: [
IconButton( IconButton(

@ -15,6 +15,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
class AddBloodPressurePage extends StatefulWidget { class AddBloodPressurePage extends StatefulWidget {
final DateTime bloodSugarDate; final DateTime bloodSugarDate;
@ -25,15 +26,7 @@ class AddBloodPressurePage extends StatefulWidget {
final String bloodDiastolicValue; final String bloodDiastolicValue;
final BloodPressureViewMode model; final BloodPressureViewMode model;
const AddBloodPressurePage( const AddBloodPressurePage({Key key, this.bloodSugarDate, this.measureTimeSelectedType, this.isUpdate = false, this.lineItemNo, this.model, this.bloodSystolicValue, this.bloodDiastolicValue})
{Key key,
this.bloodSugarDate,
this.measureTimeSelectedType,
this.isUpdate = false,
this.lineItemNo,
this.model,
this.bloodSystolicValue,
this.bloodDiastolicValue})
: super(key: key); : super(key: key);
@override @override
@ -42,8 +35,7 @@ class AddBloodPressurePage extends StatefulWidget {
class _AddBloodPressurePageState extends State<AddBloodPressurePage> { class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
TextEditingController _bloodSystolicValueController = TextEditingController(); TextEditingController _bloodSystolicValueController = TextEditingController();
TextEditingController _bloodDiastolicValueController = TextEditingController _bloodDiastolicValueController = TextEditingController();
TextEditingController();
DateTime bloodSugarDate = DateTime.now(); DateTime bloodSugarDate = DateTime.now();
DateTime timeSugarDate = DateTime.now(); DateTime timeSugarDate = DateTime.now();
int measuredArm = 1; int measuredArm = 1;
@ -67,8 +59,7 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
measureTimeSelectedType = widget.measureTimeSelectedType; measureTimeSelectedType = widget.measureTimeSelectedType;
if (measureTimeEnList.contains(widget.measureTimeSelectedType)) if (measureTimeEnList.contains(widget.measureTimeSelectedType))
measuredArm = measureTimeEnList.indexOf(widget.measureTimeSelectedType); measuredArm = measureTimeEnList.indexOf(widget.measureTimeSelectedType);
else if (measureTimeArList.contains(widget.measureTimeSelectedType)) else if (measureTimeArList.contains(widget.measureTimeSelectedType)) measuredArm = measureTimeArList.indexOf(widget.measureTimeSelectedType);
measuredArm = measureTimeArList.indexOf(widget.measureTimeSelectedType);
_bloodSystolicValueController.text = widget.bloodSystolicValue; _bloodSystolicValueController.text = widget.bloodSystolicValue;
_bloodDiastolicValueController.text = widget.bloodDiastolicValue; _bloodDiastolicValueController.text = widget.bloodDiastolicValue;
validateForm(); validateForm();
@ -80,221 +71,194 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return AppScaffold( return AppScaffold(
isShowAppBar: true, isShowAppBar: true,
appBarTitle: widget.isUpdate appBarTitle: widget.isUpdate ? TranslationBase.of(context).update : TranslationBase.of(context).add,
? TranslationBase.of(context).update showNewAppBar: true,
: TranslationBase.of(context).add, showNewAppBarTitle: true,
appBarIcons: widget.isUpdate body: SingleChildScrollView(
? [ physics: BouncingScrollPhysics(),
IconButton( child: Container(
icon: Icon(Icons.delete), margin: EdgeInsets.all(15),
color: Colors.white, child: Column(
onPressed: () { children: [
ConfirmDialog dialog = new ConfirmDialog( SizedBox(
context: context, height: 15,
confirmMessage: 'Remove this measure', ),
okText: TranslationBase.of(context).ok, NewTextFields(
cancelText: TranslationBase.of(context).cancel, hintText: TranslationBase.of(context).systolicAdd,
okFunction: () async { controller: _bloodSystolicValueController,
ConfirmDialog.closeAlertDialog(context); keyboardType: TextInputType.number,
maxLength: 3,
GifLoaderDialogUtils.showMyDialog(context); onChanged: (value) => validateForm(),
widget.model fontWeight: FontWeight.normal,
.deactivateDiabeticStatus( fontSize: 14,
lineItemNo: widget.lineItemNo) ),
.then((value) { SizedBox(
GifLoaderDialogUtils.hideDialog(context); height: 8,
if (widget.model.state == ViewState.ErrorLocal) ),
AppToast.showErrorToast( NewTextFields(
message: widget.model.error); hintText: TranslationBase.of(context).diastolicAdd,
else controller: _bloodDiastolicValueController,
Navigator.pop(context); keyboardType: TextInputType.number,
}).catchError((e) { maxLength: 3,
GifLoaderDialogUtils.hideDialog(context); onChanged: (value) => validateForm(),
AppToast.showErrorToast(message: widget.model.error); fontWeight: FontWeight.normal,
}); fontSize: 14,
}, ),
cancelFunction: () => {}); SizedBox(
dialog.showAlertDialog(context); height: 8,
}, ),
) InkWell(
] onTap: () {
: null, confirmSelectMeasureTimeDialog(projectViewModel.isArabic ? measureTimeArList : measureTimeEnList);
body: SingleChildScrollView( },
physics: BouncingScrollPhysics(), child: Container(
child: Container( padding: EdgeInsets.all(12),
margin: EdgeInsets.all(15), width: double.infinity,
child: Column( height: 65,
children: [ decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white),
SizedBox( child: Row(
height: 15, mainAxisAlignment: MainAxisAlignment.spaceBetween,
), children: [
NewTextFields( Texts(measureTimeSelectedType),
hintText: TranslationBase.of(context).systolicAdd, Icon(
controller: _bloodSystolicValueController, Icons.arrow_drop_down,
keyboardType: TextInputType.number, color: Colors.grey,
maxLength: 3, )
onChanged: (value) => validateForm(), ],
), ),
SizedBox(
height: 8,
),
NewTextFields(
hintText: TranslationBase.of(context).diastolicAdd,
controller: _bloodDiastolicValueController,
keyboardType: TextInputType.number,
maxLength: 3,
onChanged: (value) => validateForm(),
),
SizedBox(
height: 8,
),
InkWell(
onTap: () {
confirmSelectMeasureTimeDialog(projectViewModel.isArabic
? measureTimeArList
: measureTimeEnList);
},
child: Container(
padding: EdgeInsets.all(12),
width: double.infinity,
height: 65,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.white),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(measureTimeSelectedType),
Icon(
Icons.arrow_drop_down,
color: Colors.grey,
)
],
), ),
), ),
), SizedBox(
SizedBox( height: 8,
height: 8, ),
), InkWell(
InkWell( onTap: () {
onTap: () { DatePicker.showDatePicker(context, showTitleActions: true, minTime: DateTime(DateTime.now().year - 1, 1, 1), maxTime: DateTime.now(), onConfirm: (date) {
DatePicker.showDatePicker(context, setState(
showTitleActions: true, () {
minTime: DateTime(DateTime.now().year - 1, 1, 1), bloodSugarDate = date;
maxTime: DateTime.now(), onConfirm: (date) { },
setState( );
() { }, currentTime: bloodSugarDate, locale: projectViewModel.localeType);
bloodSugarDate = date;
},
);
}, },
currentTime: bloodSugarDate, child: Container(
locale: projectViewModel.localeType); padding: EdgeInsets.all(12),
}, width: double.infinity,
child: Container( height: 65,
padding: EdgeInsets.all(12), decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white),
width: double.infinity, child: Row(
height: 65, mainAxisAlignment: MainAxisAlignment.spaceBetween,
decoration: BoxDecoration( children: [
borderRadius: BorderRadius.circular(12), Texts(TranslationBase.of(context).date),
color: Colors.white), Texts(getDate()),
child: Row( ],
mainAxisAlignment: MainAxisAlignment.spaceBetween, ),
children: [
Texts(TranslationBase.of(context).date),
Texts(getDate()),
],
), ),
), ),
), SizedBox(
SizedBox( height: 8,
height: 8, ),
), InkWell(
InkWell( onTap: () {
onTap: () { DatePicker.showTimePicker(context, showTitleActions: true, onConfirm: (date) {
DatePicker.showTimePicker(context, showTitleActions: true, setState(
onConfirm: (date) { () {
setState( timeSugarDate = date;
() { },
timeSugarDate = date; );
}, }, currentTime: timeSugarDate, locale: projectViewModel.localeType);
);
}, },
currentTime: timeSugarDate, child: Container(
locale: projectViewModel.localeType); padding: EdgeInsets.all(12),
}, width: double.infinity,
child: Container( height: 65,
padding: EdgeInsets.all(12), decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white),
width: double.infinity, child: Row(
height: 65, mainAxisAlignment: MainAxisAlignment.spaceBetween,
decoration: BoxDecoration( children: [Texts(TranslationBase.of(context).time), Texts(getTime())],
borderRadius: BorderRadius.circular(12), ),
color: Colors.white),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(TranslationBase.of(context).time),
Texts(getTime())
],
), ),
), ),
), widget.isUpdate
], ? Container(
padding: EdgeInsets.all(10),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
InkWell(
child: Texts(
TranslationBase.of(context).delete,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
color: Colors.red[900],
),
onTap: () {
ConfirmDialog dialog = new ConfirmDialog(
context: context,
confirmMessage: TranslationBase.of(context).removeMeasure,
okText: TranslationBase.of(context).ok,
cancelText: TranslationBase.of(context).cancel,
okFunction: () async {
ConfirmDialog.closeAlertDialog(context);
GifLoaderDialogUtils.showMyDialog(context);
widget.model.deactivateDiabeticStatus(lineItemNo: widget.lineItemNo).then((value) {
GifLoaderDialogUtils.hideDialog(context);
if (widget.model.state == ViewState.ErrorLocal)
AppToast.showErrorToast(message: widget.model.error);
else
Navigator.pop(context);
}).catchError((e) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: widget.model.error);
});
},
cancelFunction: () => {});
dialog.showAlertDialog(context);
})
],
))
: Container()
],
),
), ),
), ),
), bottomSheet: Container(
bottomSheet: Container( width: MediaQuery.of(context).size.width,
color: Colors.transparent, height: 70.0,
width: double.infinity, margin: EdgeInsets.only(left: 15.0, right: 15.0, top: 10.0),
height: MediaQuery.of(context).size.height * 0.10, child: Button(
child: FractionallySizedBox( onTap: () async {
widthFactor: 0.9, if (_bloodSystolicValueController.text.isNotEmpty && _bloodDiastolicValueController.text.isNotEmpty) {
child: Column( GifLoaderDialogUtils.showMyDialog(context);
children: [
Container(
height: 50,
child: SecondaryButton(
loading: widget.model.state == ViewState.BusyLocal,
label: TranslationBase.of(context).save.toUpperCase(),
textColor: Colors.white,
color: isButtonDisabled ? Colors.grey[900] : Colors.grey,
onTap: () async {
if (_bloodSystolicValueController.text.isNotEmpty &&
_bloodDiastolicValueController.text.isNotEmpty) {
GifLoaderDialogUtils.showMyDialog(context);
widget.model widget.model
.addORUpdateDiabtecResult( .addORUpdateDiabtecResult(
isUpdate: widget.isUpdate, isUpdate: widget.isUpdate,
bloodPressureDate: bloodPressureDate: '${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00',
'${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00', diastolicPressure: _bloodDiastolicValueController.text.toString(),
diastolicPressure: systolicePressure: _bloodSystolicValueController.text.toString(),
_bloodDiastolicValueController.text.toString(), measuredArm: measuredArm,
systolicePressure: )
_bloodSystolicValueController.text.toString(), .then((value) {
measuredArm: measuredArm, GifLoaderDialogUtils.hideDialog(context);
) if (widget.model.state == ViewState.BusyLocal)
.then((value) { AppToast.showErrorToast(message: widget.model.error);
GifLoaderDialogUtils.hideDialog(context); else
if (widget.model.state == ViewState.BusyLocal) Navigator.pop(context);
AppToast.showErrorToast( ;
message: widget.model.error); }).catchError((e) {
else GifLoaderDialogUtils.hideDialog(context);
Navigator.pop(context); AppToast.showErrorToast(message: widget.model.error);
; });
}).catchError((e) { }
GifLoaderDialogUtils.hideDialog(context); },
AppToast.showErrorToast(message: widget.model.error); label: TranslationBase.of(context).save.toUpperCase(),
}); backgroundColor: Colors.red[900],
} disabled: isButtonDisabled,
}),
),
],
), ),
), ));
),
);
} }
String getDate() { String getDate() {
@ -310,7 +274,7 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
context: context, context: context,
child: RadioStringDialog( child: RadioStringDialog(
radioList: list, radioList: list,
title: 'Select the Arm', title: TranslationBase.of(context).selectArm,
selectedValue: measureTimeSelectedType, selectedValue: measureTimeSelectedType,
onValueSelected: (value) { onValueSelected: (value) {
setState(() { setState(() {
@ -324,11 +288,8 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
} }
void validateForm() { void validateForm() {
print("_bloodSystolicValueController " + print("_bloodSystolicValueController " + _bloodSystolicValueController.text.length.toString());
_bloodSystolicValueController.text.length.toString()); if (measureTimeSelectedType != 'Left Arm' && _bloodSystolicValueController.text.length > 0 && _bloodDiastolicValueController.text.length > 0) {
if (measureTimeSelectedType != 'Left Arm' &&
_bloodSystolicValueController.text.length > 0 &&
_bloodDiastolicValueController.text.length > 0) {
setState(() { setState(() {
isButtonDisabled = true; isButtonDisabled = true;
}); });

@ -14,14 +14,14 @@ import 'AddBloodPressurePage.dart';
import 'BloodPressureMonthly.dart'; import 'BloodPressureMonthly.dart';
import 'BloodPressureYeaPage.dart'; import 'BloodPressureYeaPage.dart';
import 'bloodPressureWeeklyPage.dart'; import 'bloodPressureWeeklyPage.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
class BloodPressureHomePage extends StatefulWidget { class BloodPressureHomePage extends StatefulWidget {
@override @override
_BloodPressureHomePageState createState() => _BloodPressureHomePageState(); _BloodPressureHomePageState createState() => _BloodPressureHomePageState();
} }
class _BloodPressureHomePageState extends State<BloodPressureHomePage> class _BloodPressureHomePageState extends State<BloodPressureHomePage> with SingleTickerProviderStateMixin {
with SingleTickerProviderStateMixin {
TabController _tabController; TabController _tabController;
@override @override
@ -41,78 +41,92 @@ class _BloodPressureHomePageState extends State<BloodPressureHomePage>
return BaseView<BloodPressureViewMode>( return BaseView<BloodPressureViewMode>(
onModelReady: (model) => model.getBloodPressure(), onModelReady: (model) => model.getBloodPressure(),
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
isShowAppBar: true, isShowAppBar: true,
appBarTitle: TranslationBase.of(context).bloodPressure, appBarTitle: TranslationBase.of(context).bloodPressure,
baseViewModel: model, showNewAppBar: true,
appBarIcons: [IconButton( showNewAppBarTitle: true,
icon: Icon(Icons.email), baseViewModel: model,
color: Colors.white, body: Scaffold(
onPressed: () { extendBodyBehindAppBar: true,
showDialog( appBar: TabBarWidget(
context: context, tabController: _tabController,
child: ConfirmSendEmailDialog( ),
email: model.user.emailAddress, body: Column(
onTapSendEmail: () async{ children: <Widget>[
GifLoaderDialogUtils.showMyDialog(context); Expanded(
model.sendReportByEmail().then((value) { child: TabBarView(
GifLoaderDialogUtils.hideDialog(context); physics: BouncingScrollPhysics(),
if(model.state == ViewState.ErrorLocal){ controller: _tabController,
AppToast.showErrorToast(message: model.error); children: <Widget>[
}else{ BloodPressureWeeklyPage(
AppToast.showSuccessToast(message:TranslationBase.of(context).emailSentSuccessfully, ); model: model,
} ),
}).catchError((e){ BloodPressureMonthlyPage(
GifLoaderDialogUtils.hideDialog(context); model: model,
AppToast.showErrorToast(message: model.error); ),
}); BloodPressureYearPage(
}, model: model,
), )
); ],
}, ),
),], )
body: Scaffold( ],
extendBodyBehindAppBar: true, ),
appBar: TabBarWidget(tabController: _tabController,), floatingActionButton: InkWell(
body: Column( onTap: () {
children: <Widget>[ Navigator.push(
Expanded( context,
child: TabBarView( FadePage(
physics: BouncingScrollPhysics(), page: AddBloodPressurePage(
controller: _tabController,
children: <Widget>[
BloodPressureWeeklyPage(
model: model,
),
BloodPressureMonthlyPage(
model: model,
),
BloodPressureYearPage(
model: model, model: model,
) )));
], },
), child: Container(
) width: 55,
], height: 55,
), decoration: BoxDecoration(shape: BoxShape.circle, color: Theme.of(context).primaryColor),
floatingActionButton: InkWell( child: Center(
onTap: () { child: Icon(
Navigator.push(context, FadePage(page: AddBloodPressurePage(model: model,))); Icons.add,
}, color: Colors.white,
child: Container( ),
width: 55,
height: 55,
decoration: BoxDecoration(
shape: BoxShape.circle, color: Theme.of(context).primaryColor),
child: Center(
child: Icon(
Icons.add,
color: Colors.white,
), ),
), ),
), ),
), bottomSheet: Container(
), width: MediaQuery.of(context).size.width,
), height: 70.0,
margin: EdgeInsets.only(left: 15.0, right: 15.0, top: 10.0),
child: Button(
onTap: () {
showDialog(
context: context,
child: ConfirmSendEmailDialog(
email: model.user.emailAddress,
onTapSendEmail: () async {
GifLoaderDialogUtils.showMyDialog(context);
model.sendReportByEmail().then((value) {
GifLoaderDialogUtils.hideDialog(context);
if (model.state == ViewState.ErrorLocal) {
AppToast.showErrorToast(message: model.error);
} else {
AppToast.showSuccessToast(
message: TranslationBase.of(context).emailSentSuccessfully,
);
}
}).catchError((e) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: model.error);
});
},
),
);
},
label: TranslationBase.of(context).sendEmail,
backgroundColor: Colors.red[900],
),
),
)),
); );
} }
} }

@ -16,7 +16,6 @@ class BloodPressureMonthlyPage extends StatelessWidget {
const BloodPressureMonthlyPage({Key key, this.model}) : super(key: key); const BloodPressureMonthlyPage({Key key, this.model}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
@ -24,36 +23,43 @@ class BloodPressureMonthlyPage extends StatelessWidget {
return AppScaffold( return AppScaffold(
body: ListView( body: ListView(
children: [ children: [
Container( Container(
margin: EdgeInsets.only(top: 12, left: 8, right: 8), margin: EdgeInsets.only(top: 12, left: 8, right: 8),
color: Colors.white, color: Colors.white,
child: MonthCurvedChartBloodPressure( child: MonthCurvedChartBloodPressure(
horizontalInterval: 20.0, horizontalInterval: 20.0,
title: TranslationBase.of(context).bloodPressure, title: TranslationBase.of(context).bloodPressure,
timeSeries1: model.weighMonthTimeSeriesDataTop.isEmpty?[TimeSeriesSales3(0,0.0)]:model.weighMonthTimeSeriesDataTop, timeSeries1: model.weighMonthTimeSeriesDataTop.isEmpty ? [TimeSeriesSales3(0, 0.0)] : model.weighMonthTimeSeriesDataTop,
timeSeries2: model.weighMonthTimeSeriesDataLow.isEmpty?[TimeSeriesSales3(0,0.0)]:model.weighMonthTimeSeriesDataLow, timeSeries2: model.weighMonthTimeSeriesDataLow.isEmpty ? [TimeSeriesSales3(0, 0.0)] : model.weighMonthTimeSeriesDataLow,
indexes: model.weightWeekTimeSeriesDataLow.length ~/ 5.5, indexes: model.weightWeekTimeSeriesDataLow.length ~/ 5.5,
),
), ),
),
SizedBox( SizedBox(
height: 12, height: 12,
), ),
Padding( // Padding(
padding: const EdgeInsets.all(8.0), // padding: const EdgeInsets.all(8.0),
child: Texts(TranslationBase.of(context).details), // child: Texts(TranslationBase.of(context).details),
), // ),
Container( Container(
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
color: Colors.transparent, color: Colors.transparent,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
model.weighMonthTimeSeriesDataTop.isEmpty? Container(child: Center(child: Texts(TranslationBase.of(context).noDataAvailable),),):Table( model.weighMonthTimeSeriesDataTop.isEmpty
border: TableBorder.symmetric( ? Container(
inside: BorderSide(width: 2.0, color: Colors.grey[300]), child: Center(
), child: Texts(TranslationBase.of(context).noDataAvailable),
children: fullData(context,projectViewModel,model), ),
), )
: Table(
border: TableBorder.symmetric(
inside: BorderSide(width: 2.0, color: Colors.grey[300]),
),
children: fullData(context, projectViewModel, model),
),
SizedBox(height: 80)
], ],
), ),
) )
@ -62,8 +68,7 @@ class BloodPressureMonthlyPage extends StatelessWidget {
); );
} }
List<TableRow> fullData(BuildContext context, List<TableRow> fullData(BuildContext context, ProjectViewModel projectViewModel, BloodPressureViewMode model) {
ProjectViewModel projectViewModel, BloodPressureViewMode model) {
List<TableRow> tableRow = []; List<TableRow> tableRow = [];
tableRow.add( tableRow.add(
TableRow( TableRow(
@ -78,7 +83,7 @@ class BloodPressureMonthlyPage extends StatelessWidget {
), ),
child: Center( child: Center(
child: Texts( child: Texts(
'Date', TranslationBase.of(context).date,
color: Colors.white, color: Colors.white,
fontSize: 15, fontSize: 15,
), ),
@ -93,7 +98,7 @@ class BloodPressureMonthlyPage extends StatelessWidget {
), ),
child: Center( child: Center(
child: Texts( child: Texts(
'Time', TranslationBase.of(context).time,
color: Colors.white, color: Colors.white,
fontSize: 15, fontSize: 15,
), ),
@ -107,7 +112,7 @@ class BloodPressureMonthlyPage extends StatelessWidget {
), ),
child: Center( child: Center(
child: Texts( child: Texts(
'Arm', TranslationBase.of(context).arm,
color: Colors.white, color: Colors.white,
fontSize: 15, fontSize: 15,
), ),
@ -124,7 +129,7 @@ class BloodPressureMonthlyPage extends StatelessWidget {
), ),
child: Center( child: Center(
child: Texts( child: Texts(
'SBP/DBP', TranslationBase.of(context).sysdias,
color: Colors.white, color: Colors.white,
fontSize: 15, fontSize: 15,
), ),
@ -143,8 +148,8 @@ class BloodPressureMonthlyPage extends StatelessWidget {
color: Colors.white, color: Colors.white,
child: Center( child: Center(
child: Texts( child: Texts(
'${projectViewModel.isArabic? DateUtil.getMonthDayYearDateFormattedAr(diabtec.bloodPressureDate):DateUtil.getMonthDayYearDateFormatted(diabtec.bloodPressureDate)}', '${projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(diabtec.bloodPressureDate) : DateUtil.getMonthDayYearDateFormatted(diabtec.bloodPressureDate)}',
fontSize: 15, fontSize: 12,
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
), ),
@ -155,7 +160,7 @@ class BloodPressureMonthlyPage extends StatelessWidget {
child: Center( child: Center(
child: Texts( child: Texts(
'${diabtec.bloodPressureDate.hour}:${diabtec.bloodPressureDate.minute}', '${diabtec.bloodPressureDate.hour}:${diabtec.bloodPressureDate.minute}',
fontSize: 15, fontSize: 12,
), ),
), ),
height: 40), height: 40),
@ -164,7 +169,7 @@ class BloodPressureMonthlyPage extends StatelessWidget {
child: Center( child: Center(
child: Texts( child: Texts(
diabtec.measuredArmDesc, diabtec.measuredArmDesc,
fontSize: 15, fontSize: 12,
), ),
), ),
height: 40), height: 40),
@ -174,7 +179,7 @@ class BloodPressureMonthlyPage extends StatelessWidget {
child: Texts( child: Texts(
'${diabtec.systolicePressure}/${diabtec.diastolicPressure}', '${diabtec.systolicePressure}/${diabtec.diastolicPressure}',
color: Colors.red, color: Colors.red,
fontSize: 15, fontSize: 12,
), ),
), ),
height: 40), height: 40),

@ -19,38 +19,45 @@ class BloodPressureYearPage extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return AppScaffold( return AppScaffold(
body:ListView( body: ListView(
children: [ children: [
Container( Container(
margin: EdgeInsets.only(top: 12, left: 8, right: 8), margin: EdgeInsets.only(top: 12, left: 8, right: 8),
color: Colors.white, color: Colors.white,
child: CurvedChartBloodPressure( child: CurvedChartBloodPressure(
horizontalInterval: 3.0,// model.weightWeekTimeSeriesDataLow.length==1 ?1 :20.0, horizontalInterval: 3.0, // model.weightWeekTimeSeriesDataLow.length==1 ?1 :20.0,
title: TranslationBase.of(context).bloodPressure, title: TranslationBase.of(context).bloodPressure,
timeSeries1: model.weightYearTimeSeriesDataTop.isEmpty?[TimeSeriesSales2(DateTime.now(),0.0)]:model.weightYearTimeSeriesDataTop, timeSeries1: model.weightYearTimeSeriesDataTop.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : model.weightYearTimeSeriesDataTop,
timeSeries2: model.weightYearTimeSeriesDataLow.isEmpty?[TimeSeriesSales2(DateTime.now(),0.0)]:model.weightYearTimeSeriesDataLow, timeSeries2: model.weightYearTimeSeriesDataLow.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : model.weightYearTimeSeriesDataLow,
indexes: model.weightWeekTimeSeriesDataLow.length ~/ 5.5, indexes: model.weightWeekTimeSeriesDataLow.length ~/ 5.5,
), ),
), ),
SizedBox( SizedBox(
height: 12, height: 12,
), ),
Padding( // Padding(
padding: const EdgeInsets.all(8.0), // padding: const EdgeInsets.all(8.0),
child: Texts(TranslationBase.of(context).details), // child: Texts(TranslationBase.of(context).details),
), // ),
Container( Container(
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
color: Colors.transparent, color: Colors.transparent,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
model.weightYearTimeSeriesDataTop.isEmpty? Container(child: Center(child: Texts(TranslationBase.of(context).noDataAvailable),),):Table( model.weightYearTimeSeriesDataTop.isEmpty
border: TableBorder.symmetric( ? Container(
inside: BorderSide(width: 2.0, color: Colors.grey[300]), child: Center(
), child: Texts(TranslationBase.of(context).noDataAvailable),
children: fullData(context, projectViewModel, model), ),
), )
: Table(
border: TableBorder.symmetric(
inside: BorderSide(width: 2.0, color: Colors.grey[300]),
),
children: fullData(context, projectViewModel, model),
),
SizedBox(height: 80)
], ],
), ),
) )
@ -59,10 +66,7 @@ class BloodPressureYearPage extends StatelessWidget {
); );
} }
List<TableRow> fullData( List<TableRow> fullData(BuildContext context, ProjectViewModel projectViewModel, BloodPressureViewMode bloodSugarViewMode) {
BuildContext context,
ProjectViewModel projectViewModel,
BloodPressureViewMode bloodSugarViewMode) {
List<TableRow> tableRow = []; List<TableRow> tableRow = [];
tableRow.add( tableRow.add(
TableRow( TableRow(
@ -72,12 +76,8 @@ class BloodPressureYearPage extends StatelessWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topLeft: projectViewModel.isArabic topLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0),
? Radius.circular(0.0) topRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0),
: Radius.circular(10.0),
topRight: projectViewModel.isArabic
? Radius.circular(10.0)
: Radius.circular(0.0),
), ),
), ),
child: Center( child: Center(
@ -123,12 +123,8 @@ class BloodPressureYearPage extends StatelessWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topLeft: projectViewModel.isArabic topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0),
? Radius.circular(10.0) topRight: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0),
: Radius.circular(0.0),
topRight: projectViewModel.isArabic
? Radius.circular(0.0)
: Radius.circular(10.0),
), ),
), ),
child: Center( child: Center(

@ -22,38 +22,45 @@ class BloodPressureWeeklyPage extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return AppScaffold( return AppScaffold(
body: ListView( body: ListView(
children: [ children: [
Container( Container(
margin: EdgeInsets.only(top: 12, left: 8, right: 8), margin: EdgeInsets.only(top: 12, left: 8, right: 8),
color: Colors.white, color: Colors.white,
child: CurvedChartBloodPressure( child: CurvedChartBloodPressure(
horizontalInterval:3.0, horizontalInterval: 3.0,
title: TranslationBase.of(context).bloodPressure, title: TranslationBase.of(context).bloodPressure,
timeSeries1: model.weightWeekTimeSeriesDataTop.isEmpty?[TimeSeriesSales2(DateTime.now(),0.0)]:model.weightWeekTimeSeriesDataTop, timeSeries1: model.weightWeekTimeSeriesDataTop.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : model.weightWeekTimeSeriesDataTop,
timeSeries2: model.weightWeekTimeSeriesDataLow.isEmpty?[TimeSeriesSales2(DateTime.now(),0.0)]:model.weightWeekTimeSeriesDataLow, timeSeries2: model.weightWeekTimeSeriesDataLow.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : model.weightWeekTimeSeriesDataLow,
indexes: model.weightWeekTimeSeriesDataLow.length ~/ 5.5, indexes: model.weightWeekTimeSeriesDataLow.length ~/ 5.5,
), ),
), ),
SizedBox( SizedBox(
height: 12, height: 12,
), ),
Padding( // Padding(
padding: const EdgeInsets.all(8.0), // padding: const EdgeInsets.all(8.0),
child: Texts(TranslationBase.of(context).details), // child: Texts(TranslationBase.of(context).details),
), // ),
Container( Container(
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
color: Colors.transparent, color: Colors.transparent,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
model.weightWeekTimeSeriesDataTop.isEmpty? Container(child: Center(child: Texts(TranslationBase.of(context).noDataAvailable),),): Table( model.weightWeekTimeSeriesDataTop.isEmpty
border: TableBorder.symmetric( ? Container(
inside: BorderSide(width: 2.0, color: Colors.grey[300]), child: Center(
), child: Texts(TranslationBase.of(context).noDataAvailable),
children: fullData(context, projectViewModel, model), ),
), )
: Table(
border: TableBorder.symmetric(
inside: BorderSide(width: 2.0, color: Colors.grey[300]),
),
children: fullData(context, projectViewModel, model),
),
SizedBox(height: 80)
], ],
), ),
) )
@ -62,10 +69,7 @@ class BloodPressureWeeklyPage extends StatelessWidget {
); );
} }
List<TableRow> fullData( List<TableRow> fullData(BuildContext context, ProjectViewModel projectViewModel, BloodPressureViewMode bloodSugarViewMode) {
BuildContext context,
ProjectViewModel projectViewModel,
BloodPressureViewMode bloodSugarViewMode) {
List<TableRow> tableRow = []; List<TableRow> tableRow = [];
tableRow.add( tableRow.add(
TableRow( TableRow(
@ -75,12 +79,8 @@ class BloodPressureWeeklyPage extends StatelessWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topLeft: projectViewModel.isArabic topLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0),
? Radius.circular(0.0) topRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0),
: Radius.circular(10.0),
topRight: projectViewModel.isArabic
? Radius.circular(10.0)
: Radius.circular(0.0),
), ),
), ),
child: Center( child: Center(
@ -140,12 +140,8 @@ class BloodPressureWeeklyPage extends StatelessWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topLeft: projectViewModel.isArabic topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0),
? Radius.circular(10.0) topRight: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0),
: Radius.circular(0.0),
topRight: projectViewModel.isArabic
? Radius.circular(0.0)
: Radius.circular(10.0),
), ),
), ),
child: Center( child: Center(

@ -6,6 +6,7 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.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/button.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/RadioStringDialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/RadioStringDialog.dart';
@ -25,15 +26,7 @@ class AddBloodSugarPage extends StatefulWidget {
final int lineItemNo; final int lineItemNo;
final BloodSugarViewMode bloodSugarViewMode; final BloodSugarViewMode bloodSugarViewMode;
AddBloodSugarPage( AddBloodSugarPage({Key key, this.bloodSugarDate, this.measureUnitSelectedType, this.isUpdate = false, this.measuredTime, this.bloodSugarValue, this.lineItemNo, this.bloodSugarViewMode})
{Key key,
this.bloodSugarDate,
this.measureUnitSelectedType,
this.isUpdate = false,
this.measuredTime,
this.bloodSugarValue,
this.lineItemNo,
this.bloodSugarViewMode})
: super(key: key); : super(key: key);
@override @override
@ -83,8 +76,7 @@ class _AddBloodSugarPageState extends State<AddBloodSugarPage> {
measureUnitSelectedType = widget.measureUnitSelectedType; measureUnitSelectedType = widget.measureUnitSelectedType;
if (measureTimeEnList.contains(widget.measuredTime)) if (measureTimeEnList.contains(widget.measuredTime))
measuredTime = measureTimeEnList.indexOf(widget.measuredTime); measuredTime = measureTimeEnList.indexOf(widget.measuredTime);
else if (measureTimeArList.contains(widget.measuredTime)) else if (measureTimeArList.contains(widget.measuredTime)) measuredTime = measureTimeArList.indexOf(widget.measuredTime);
measuredTime = measureTimeArList.indexOf(widget.measuredTime);
_bloodSugarValueController.text = widget.bloodSugarValue; _bloodSugarValueController.text = widget.bloodSugarValue;
validateForm(); validateForm();
} }
@ -94,246 +86,222 @@ class _AddBloodSugarPageState extends State<AddBloodSugarPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return AppScaffold( return AppScaffold(
isShowAppBar: true, isShowAppBar: true,
appBarTitle: widget.isUpdate showNewAppBar: true,
? TranslationBase.of(context).update showNewAppBarTitle: true,
: TranslationBase.of(context).add, appBarTitle: widget.isUpdate ? TranslationBase.of(context).update : TranslationBase.of(context).add,
appBarIcons: widget.isUpdate // appBarIcons: widget.isUpdate
? [ // ? [
IconButton( // IconButton(
icon: Icon(Icons.delete), // icon: Icon(Icons.delete),
color: Colors.white, // color: Colors.white,
onPressed: () { // onPressed: () {
ConfirmDialog dialog = new ConfirmDialog(
context: context,
confirmMessage: 'Remove this measure',
okText: TranslationBase.of(context).ok,
cancelText: TranslationBase.of(context).cancel,
okFunction: () async {
ConfirmDialog.closeAlertDialog(context);
GifLoaderDialogUtils.showMyDialog(context); // },
widget.bloodSugarViewMode // )
.deactivateDiabeticStatus( // ]
lineItemNo: widget.lineItemNo) // : null,
.then((value) { body: SingleChildScrollView(
GifLoaderDialogUtils.hideDialog(context); physics: BouncingScrollPhysics(),
if (widget.bloodSugarViewMode.state == child: Container(
ViewState.ErrorLocal) margin: EdgeInsets.all(15),
AppToast.showErrorToast( child: Column(
message: widget.bloodSugarViewMode.error); children: [
else SizedBox(
Navigator.pop(context); height: 15,
}).catchError((e) { ),
GifLoaderDialogUtils.hideDialog(context); NewTextFields(
AppToast.showErrorToast( hintText: TranslationBase.of(context).sugarAdd,
message: widget.bloodSugarViewMode.error); controller: _bloodSugarValueController,
}); keyboardType: TextInputType.number,
}, onChanged: (value) => validateForm(),
cancelFunction: () => {}); fontWeight: FontWeight.normal,
dialog.showAlertDialog(context); fontSize: 14,
}, ),
) SizedBox(
] height: 8,
: null, ),
body: SingleChildScrollView( InkWell(
physics: BouncingScrollPhysics(), onTap: () {
child: Container( confirmSelectMeasureUnitDialog();
margin: EdgeInsets.all(15), },
child: Column( child: Container(
children: [ padding: EdgeInsets.all(12),
SizedBox( width: double.infinity,
height: 15, height: 65,
), decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white),
NewTextFields( child: Row(
hintText: TranslationBase.of(context).sugarAdd, mainAxisAlignment: MainAxisAlignment.spaceBetween,
controller: _bloodSugarValueController, children: [
keyboardType: TextInputType.number, Texts(measureUnitSelectedType),
onChanged: (value) => validateForm(), Icon(
), Icons.arrow_drop_down,
SizedBox( color: Colors.grey,
height: 8, )
), ],
InkWell( ),
onTap: () {
confirmSelectMeasureUnitDialog();
},
child: Container(
padding: EdgeInsets.all(12),
width: double.infinity,
height: 65,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.white),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(measureUnitSelectedType),
Icon(
Icons.arrow_drop_down,
color: Colors.grey,
)
],
), ),
), ),
), SizedBox(
SizedBox( height: 8,
height: 8, ),
), InkWell(
InkWell( onTap: () {
onTap: () { DatePicker.showDatePicker(context, showTitleActions: true, minTime: DateTime(DateTime.now().year - 1, 1, 1), maxTime: DateTime.now(), onConfirm: (date) {
DatePicker.showDatePicker(context, setState(() {
showTitleActions: true, bloodSugarDate = date;
minTime: DateTime(DateTime.now().year - 1, 1, 1), });
maxTime: DateTime.now(), onConfirm: (date) { }, currentTime: bloodSugarDate, locale: projectViewModel.localeType);
setState(() { },
bloodSugarDate = date; child: Container(
}); padding: EdgeInsets.all(12),
}, width: double.infinity,
currentTime: bloodSugarDate, height: 65,
locale: projectViewModel.localeType); decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white),
}, child: Row(
child: Container( mainAxisAlignment: MainAxisAlignment.spaceBetween,
padding: EdgeInsets.all(12), children: [
width: double.infinity, Texts(TranslationBase.of(context).date),
height: 65, Texts(getDate()),
decoration: BoxDecoration( ],
borderRadius: BorderRadius.circular(12), ),
color: Colors.white),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(TranslationBase.of(context).date),
Texts(getDate()),
],
), ),
), ),
), SizedBox(
SizedBox( height: 8,
height: 8, ),
), InkWell(
InkWell( onTap: () {
onTap: () { DatePicker.showTimePicker(context, showTitleActions: true, onConfirm: (date) {
DatePicker.showTimePicker(context, showTitleActions: true, setState(() {
onConfirm: (date) { timeSugarDate = date;
setState(() { });
timeSugarDate = date; }, currentTime: timeSugarDate, locale: projectViewModel.localeType);
}); },
}, child: Container(
currentTime: timeSugarDate, padding: EdgeInsets.all(12),
locale: projectViewModel.localeType); width: double.infinity,
}, height: 65,
child: Container( decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white),
padding: EdgeInsets.all(12), child: Row(
width: double.infinity, mainAxisAlignment: MainAxisAlignment.spaceBetween,
height: 65, children: [Texts(TranslationBase.of(context).time), Texts(getTime())],
decoration: BoxDecoration( ),
borderRadius: BorderRadius.circular(12),
color: Colors.white),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(TranslationBase.of(context).time),
Texts(getTime())
],
), ),
), ),
), SizedBox(
SizedBox( height: 8,
height: 8, ),
), InkWell(
InkWell( onTap: () {
onTap: () { confirmSelectMeasureTimeDialog(projectViewModel.isArabic ? measureTimeArList : measureTimeEnList);
confirmSelectMeasureTimeDialog(projectViewModel.isArabic },
? measureTimeArList child: Container(
: measureTimeEnList); padding: EdgeInsets.all(12),
}, width: double.infinity,
child: Container( height: 65,
padding: EdgeInsets.all(12), decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white),
width: double.infinity, child: Row(
height: 65, mainAxisAlignment: MainAxisAlignment.spaceBetween,
decoration: BoxDecoration( children: [
borderRadius: BorderRadius.circular(12), Texts(measureTimeSelectedType ?? TranslationBase.of(context).other),
color: Colors.white), Icon(
child: Row( Icons.arrow_drop_down,
mainAxisAlignment: MainAxisAlignment.spaceBetween, color: Colors.grey,
children: [ )
Texts(measureTimeSelectedType ?? ],
TranslationBase.of(context).other), ),
Icon(
Icons.arrow_drop_down,
color: Colors.grey,
)
],
), ),
), ),
), widget.isUpdate
], ? Container(
padding: EdgeInsets.all(10),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
InkWell(
child: Texts(
TranslationBase.of(context).delete,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold,
color: Colors.red[900],
),
onTap: () {
ConfirmDialog dialog = new ConfirmDialog(
context: context,
confirmMessage: TranslationBase.of(context).removeMeasure,
okText: TranslationBase.of(context).ok,
cancelText: TranslationBase.of(context).cancel,
okFunction: () async {
ConfirmDialog.closeAlertDialog(context);
GifLoaderDialogUtils.showMyDialog(context);
widget.bloodSugarViewMode.deactivateDiabeticStatus(lineItemNo: widget.lineItemNo).then((value) {
GifLoaderDialogUtils.hideDialog(context);
if (widget.bloodSugarViewMode.state == ViewState.ErrorLocal)
AppToast.showErrorToast(message: widget.bloodSugarViewMode.error);
else
Navigator.pop(context);
}).catchError((e) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: widget.bloodSugarViewMode.error);
});
},
cancelFunction: () => {});
dialog.showAlertDialog(context);
},
)
],
))
: Container()
],
),
), ),
), ),
), bottomSheet: Container(
bottomSheet: Container( width: MediaQuery.of(context).size.width,
color: Colors.transparent, height: 70.0,
width: double.infinity, margin: EdgeInsets.only(left: 15.0, right: 15.0, top: 10.0),
height: MediaQuery.of(context).size.height * 0.10, child: Button(
child: Column( onTap: () async {
children: [ if (_bloodSugarValueController.text.isNotEmpty) {
FractionallySizedBox( if (widget.isUpdate) {
widthFactor: 0.9, GifLoaderDialogUtils.showMyDialog(context);
child: SecondaryButton( await widget.bloodSugarViewMode.updateDiabtecResult(
label: TranslationBase.of(context).save.toUpperCase(), month: bloodSugarDate,
textColor: Colors.white, hour: timeSugarDate,
color: isButtonDisabled ? Colors.grey[900] : Colors.grey, diabtecUnit: measureUnitSelectedType,
onTap: () async { measuredTime: measuredTime,
if (_bloodSugarValueController.text.isNotEmpty) { lineItemNo: widget.lineItemNo,
if (widget.isUpdate) { bloodSugerResult: _bloodSugarValueController.text.toString());
GifLoaderDialogUtils.showMyDialog(context);
await widget.bloodSugarViewMode
.updateDiabtecResult(
month: bloodSugarDate,
hour: timeSugarDate,
diabtecUnit: measureUnitSelectedType,
measuredTime: measuredTime,
lineItemNo: widget.lineItemNo,
bloodSugerResult:
_bloodSugarValueController.text.toString());
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
if (widget.bloodSugarViewMode.state == if (widget.bloodSugarViewMode.state == ViewState.ErrorLocal)
ViewState.ErrorLocal) AppToast.showErrorToast(message: widget.bloodSugarViewMode.error);
AppToast.showErrorToast( else
message: widget.bloodSugarViewMode.error); Navigator.pop(context);
else } else {
Navigator.pop(context); GifLoaderDialogUtils.showMyDialog(context);
await widget.bloodSugarViewMode.addDiabtecResult(
} else { diabtecUnit: measureUnitSelectedType,
GifLoaderDialogUtils.showMyDialog(context); measuredTime: measuredTime,
await widget.bloodSugarViewMode bloodSugerResult: _bloodSugarValueController.text.toString(),
.addDiabtecResult( bloodSugerDateChart: '${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00',
diabtecUnit: measureUnitSelectedType, );
measuredTime: measuredTime,
bloodSugerResult:
_bloodSugarValueController.text.toString(),
bloodSugerDateChart:
'${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00',
);
GifLoaderDialogUtils.hideDialog(context);
if (widget.bloodSugarViewMode.state == ViewState.Error)
AppToast.showErrorToast(
message: widget.bloodSugarViewMode.error);
else
Navigator.pop(context);
}
} GifLoaderDialogUtils.hideDialog(context);
}), if (widget.bloodSugarViewMode.state == ViewState.Error)
), AppToast.showErrorToast(message: widget.bloodSugarViewMode.error);
], else
), Navigator.pop(context);
), }
); }
},
label: TranslationBase.of(context).save.toUpperCase(),
backgroundColor: Colors.red[900],
disabled: isButtonDisabled,
),
));
} }
String getDate() { String getDate() {

@ -21,10 +21,7 @@ class BloodMonthlyPage extends StatelessWidget {
final List<TimeSeriesSales3> timeSeriesData; final List<TimeSeriesSales3> timeSeriesData;
final BloodSugarViewMode bloodSugarViewMode; final BloodSugarViewMode bloodSugarViewMode;
const BloodMonthlyPage({Key key, this.diabtecPatientResult, this.timeSeriesData, this.bloodSugarViewMode}) : super(key: key);
const BloodMonthlyPage(
{Key key, this.diabtecPatientResult, this.timeSeriesData, this.bloodSugarViewMode})
: super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -39,9 +36,7 @@ class BloodMonthlyPage extends StatelessWidget {
color: Colors.white, color: Colors.white,
child: MonthLineChartCurved( child: MonthLineChartCurved(
title: '${TranslationBase.of(context).bloodSugar}', title: '${TranslationBase.of(context).bloodSugar}',
timeSeries: timeSeriesData.isEmpty timeSeries: timeSeriesData.isEmpty ? [TimeSeriesSales3(0, 0.0)] : timeSeriesData,
? [TimeSeriesSales3(0, 0.0)]
: timeSeriesData,
indexes: timeSeriesData.length ~/ 5.5, indexes: timeSeriesData.length ~/ 5.5,
)), )),
SizedBox( SizedBox(
@ -60,17 +55,16 @@ class BloodMonthlyPage extends StatelessWidget {
timeSeriesData.isEmpty timeSeriesData.isEmpty
? Container( ? Container(
child: Center( child: Center(
child: Texts( child: Texts(TranslationBase.of(context).noDataAvailable),
TranslationBase.of(context).noDataAvailable),
), ),
) )
: Table( : Table(
border: TableBorder.symmetric( border: TableBorder.symmetric(
inside: inside: BorderSide(width: 2.0, color: Colors.grey[300]),
BorderSide(width: 2.0, color: Colors.grey[300]),
), ),
children: fullData(context, projectViewModel), children: fullData(context, projectViewModel),
), ),
SizedBox(height: 80)
], ],
), ),
) )
@ -79,8 +73,7 @@ class BloodMonthlyPage extends StatelessWidget {
); );
} }
List<TableRow> fullData( List<TableRow> fullData(BuildContext context, ProjectViewModel projectViewModel) {
BuildContext context, ProjectViewModel projectViewModel) {
List<TableRow> tableRow = []; List<TableRow> tableRow = [];
tableRow.add( tableRow.add(
TableRow( TableRow(
@ -90,12 +83,8 @@ class BloodMonthlyPage extends StatelessWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topLeft: projectViewModel.isArabic topLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0),
? Radius.circular(0.0) topRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0),
: Radius.circular(10.0),
topRight: projectViewModel.isArabic
? Radius.circular(10.0)
: Radius.circular(0.0),
), ),
), ),
child: Center( child: Center(
@ -141,12 +130,8 @@ class BloodMonthlyPage extends StatelessWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topLeft: projectViewModel.isArabic topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0),
? Radius.circular(10.0) topRight: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0),
: Radius.circular(0.0),
topRight: projectViewModel.isArabic
? Radius.circular(0.0)
: Radius.circular(10.0),
), ),
), ),
child: Center( child: Center(

@ -27,46 +27,47 @@ class BloodYearPage extends StatelessWidget {
return AppScaffold( return AppScaffold(
// baseViewModel: bloodSugarViewMode, // baseViewModel: bloodSugarViewMode,
body: ListView( body: ListView(
children: [ children: [
Container( Container(
margin: EdgeInsets.only(top: 12, left: 8, right: 8), margin: EdgeInsets.only(top: 12, left: 8, right: 8),
width: double.maxFinite, width: double.maxFinite,
color: Colors.white, color: Colors.white,
child: LineChartCurved( child: LineChartCurved(
title: '${TranslationBase.of(context).bloodSugar}', title: '${TranslationBase.of(context).bloodSugar}',
timeSeries: timeSeriesData.isEmpty?[TimeSeriesSales2(DateTime.now(),0.0)]:timeSeriesData, timeSeries: timeSeriesData.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : timeSeriesData,
indexes: timeSeriesData.length ~/ 5.5 ?? 0, indexes: timeSeriesData.length ~/ 5.5 ?? 0,
)), )),
SizedBox( SizedBox(
height: 12, height: 12,
), ),
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Texts(TranslationBase.of(context).details), child: Texts(TranslationBase.of(context).details),
), ),
Container( Container(
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
color: Colors.transparent, color: Colors.transparent,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
timeSeriesData.isEmpty timeSeriesData.isEmpty
? Container( ? Container(
child: Center( child: Center(
child: Texts(TranslationBase.of(context).noDataAvailable), child: Texts(TranslationBase.of(context).noDataAvailable),
), ),
) )
:Table( : Table(
border: TableBorder.symmetric( border: TableBorder.symmetric(
inside: BorderSide(width: 2.0, color: Colors.grey[300]), inside: BorderSide(width: 2.0, color: Colors.grey[300]),
), ),
children: fullData(context, projectViewModel), children: fullData(context, projectViewModel),
), ),
], SizedBox(height: 80)
),
)
], ],
), ),
)
],
),
); );
} }

@ -13,6 +13,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:charts_flutter/flutter.dart' as charts; import 'package:charts_flutter/flutter.dart' as charts;
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
@ -26,8 +27,7 @@ class BloodSugarHomePage extends StatefulWidget {
_BloodSugarHomePageState createState() => _BloodSugarHomePageState(); _BloodSugarHomePageState createState() => _BloodSugarHomePageState();
} }
class _BloodSugarHomePageState extends State<BloodSugarHomePage> class _BloodSugarHomePageState extends State<BloodSugarHomePage> with SingleTickerProviderStateMixin {
with SingleTickerProviderStateMixin {
TabController _tabController; TabController _tabController;
@override @override
@ -47,38 +47,17 @@ class _BloodSugarHomePageState extends State<BloodSugarHomePage>
return BaseView<BloodSugarViewMode>( return BaseView<BloodSugarViewMode>(
onModelReady: (model) => model.getBloodSugar(), onModelReady: (model) => model.getBloodSugar(),
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
appBarIcons: [IconButton( showNewAppBar: true,
icon: Icon(Icons.email), isShowDecPage: true,
color: Colors.white, showNewAppBarTitle: true,
onPressed: () { baseViewModel: model,
showDialog(
context: context,
child: ConfirmSendEmailDialog(
email: model.user.emailAddress,
onTapSendEmail: () async{
GifLoaderDialogUtils.showMyDialog(context);
model.sendReportByEmail().then((value) {
GifLoaderDialogUtils.hideDialog(context);
if(model.state == ViewState.ErrorLocal){
AppToast.showErrorToast(message: model.error);
}else{
AppToast.showSuccessToast(message:TranslationBase.of(context).emailSentSuccessfully, );
}
}).catchError((e){
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: model.error);
});
},
),
);
},
),],
isShowAppBar: true,
appBarTitle: TranslationBase.of(context).bloodSugar, appBarTitle: TranslationBase.of(context).bloodSugar,
// baseViewModel: model, // baseViewModel: model,
body: Scaffold( body: Scaffold(
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
appBar: TabBarWidget(tabController: _tabController,), appBar: TabBarWidget(
tabController: _tabController,
),
body: Column( body: Column(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
@ -93,7 +72,8 @@ class _BloodSugarHomePageState extends State<BloodSugarHomePage>
), ),
BloodMonthlyPage( BloodMonthlyPage(
timeSeriesData: model.monthTimeSeriesData, timeSeriesData: model.monthTimeSeriesData,
diabtecPatientResult: model.monthDiabtecPatientResult, bloodSugarViewMode: model, diabtecPatientResult: model.monthDiabtecPatientResult,
bloodSugarViewMode: model,
), ),
BloodYearPage( BloodYearPage(
timeSeriesData: model.yearTimeSeriesData, timeSeriesData: model.yearTimeSeriesData,
@ -107,13 +87,17 @@ class _BloodSugarHomePageState extends State<BloodSugarHomePage>
), ),
floatingActionButton: InkWell( floatingActionButton: InkWell(
onTap: () { onTap: () {
Navigator.push(context, FadePage(page: AddBloodSugarPage(bloodSugarViewMode: model,))); Navigator.push(
context,
FadePage(
page: AddBloodSugarPage(
bloodSugarViewMode: model,
)));
}, },
child: Container( child: Container(
width: 55, width: 55,
height: 55, height: 55,
decoration: BoxDecoration( decoration: BoxDecoration(shape: BoxShape.circle, color: Theme.of(context).primaryColor),
shape: BoxShape.circle, color:Theme.of(context).primaryColor),
child: Center( child: Center(
child: Icon( child: Icon(
Icons.add, Icons.add,
@ -122,6 +106,39 @@ class _BloodSugarHomePageState extends State<BloodSugarHomePage>
), ),
), ),
), ),
bottomSheet: Container(
width: MediaQuery.of(context).size.width,
height: 70.0,
margin: EdgeInsets.only(left: 15.0, right: 15.0, top: 10.0),
child: Button(
onTap: () {
showDialog(
context: context,
child: ConfirmSendEmailDialog(
email: model.user.emailAddress,
onTapSendEmail: () async {
GifLoaderDialogUtils.showMyDialog(context);
model.sendReportByEmail().then((value) {
GifLoaderDialogUtils.hideDialog(context);
if (model.state == ViewState.ErrorLocal) {
AppToast.showErrorToast(message: model.error);
} else {
AppToast.showSuccessToast(
message: TranslationBase.of(context).emailSentSuccessfully,
);
}
}).catchError((e) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: model.error);
});
},
),
);
},
label: TranslationBase.of(context).sendEmail,
backgroundColor: Colors.red[900],
),
),
), ),
), ),
); );

@ -20,66 +20,61 @@ class BloodSugarWeeklyPage extends StatelessWidget {
final BloodSugarViewMode bloodSugarViewMode; final BloodSugarViewMode bloodSugarViewMode;
final List<TimeSeriesSales2> timeSeriesData; final List<TimeSeriesSales2> timeSeriesData;
BloodSugarWeeklyPage( BloodSugarWeeklyPage({Key key, this.diabtecPatientResult, this.bloodSugarViewMode, this.timeSeriesData}) : super(key: key);
{Key key,
this.diabtecPatientResult,
this.bloodSugarViewMode,
this.timeSeriesData})
: super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return AppScaffold( return AppScaffold(
// baseViewModel: bloodSugarViewMode, // baseViewModel: bloodSugarViewMode,
body: ListView( body: ListView(
children: [ children: [
Container( Container(
margin: EdgeInsets.only(top: 12, left: 8, right: 8), margin: EdgeInsets.only(top: 12, left: 8, right: 8),
color: Colors.white, color: Colors.white,
child: LineChartCurved( child: LineChartCurved(
title: '${TranslationBase.of(context).bloodSugar}', title: '${TranslationBase.of(context).bloodSugar}',
timeSeries: timeSeriesData.isEmpty?[TimeSeriesSales2(DateTime.now(),0.0)]:timeSeriesData, timeSeries: timeSeriesData.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : timeSeriesData,
indexes: timeSeriesData.length ~/ 5.5, indexes: timeSeriesData.length ~/ 5.5,
), ),
), ),
SizedBox( SizedBox(
height: 12, height: 12,
), ),
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Texts(TranslationBase.of(context).details), child: Texts(TranslationBase.of(context).details),
), ),
Container( Container(
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
color: Colors.transparent, color: Colors.transparent,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
timeSeriesData.isEmpty timeSeriesData.isEmpty
? Container( ? Container(
child: Center( child: Center(
child: Texts(TranslationBase.of(context).noDataAvailable), child: Texts(TranslationBase.of(context).noDataAvailable),
), ),
) )
:Table( : Table(
border: TableBorder.symmetric( border: TableBorder.symmetric(
inside: BorderSide(width: 2.0, color: Colors.grey[300]), inside: BorderSide(width: 2.0, color: Colors.grey[300]),
), ),
children: fullData(context, projectViewModel, bloodSugarViewMode), children: fullData(context, projectViewModel, bloodSugarViewMode),
), ),
], SizedBox(
), height: 80,
) )
], ],
), ),
)
],
),
); );
} }
List<TableRow> fullData( List<TableRow> fullData(BuildContext context, ProjectViewModel projectViewModel, BloodSugarViewMode bloodSugarViewMode) {
BuildContext context,
ProjectViewModel projectViewModel,
BloodSugarViewMode bloodSugarViewMode) {
List<TableRow> tableRow = []; List<TableRow> tableRow = [];
tableRow.add( tableRow.add(
TableRow( TableRow(
@ -89,12 +84,8 @@ class BloodSugarWeeklyPage extends StatelessWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topLeft: projectViewModel.isArabic topLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0),
? Radius.circular(0.0) topRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0),
: Radius.circular(10.0),
topRight: projectViewModel.isArabic
? Radius.circular(10.0)
: Radius.circular(0.0),
), ),
), ),
child: Center( child: Center(
@ -154,12 +145,8 @@ class BloodSugarWeeklyPage extends StatelessWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topLeft: projectViewModel.isArabic topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0),
? Radius.circular(10.0) topRight: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0),
: Radius.circular(0.0),
topRight: projectViewModel.isArabic
? Radius.circular(0.0)
: Radius.circular(10.0),
), ),
), ),
child: Center( child: Center(
@ -186,7 +173,7 @@ class BloodSugarWeeklyPage extends StatelessWidget {
color: Colors.white, color: Colors.white,
child: Center( child: Center(
child: Texts( child: Texts(
'${projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(diabtec.dateChart):DateUtil.getMonthDayYearDateFormatted(diabtec.dateChart)} ', '${projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(diabtec.dateChart) : DateUtil.getMonthDayYearDateFormatted(diabtec.dateChart)} ',
textAlign: TextAlign.center, textAlign: TextAlign.center,
fontSize: 12, fontSize: 12,
), ),

@ -5,7 +5,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/pages/ContactUs/widgets/card_common_contat.dart';
import 'Weight/WeightHomePage.dart'; import 'Weight/WeightHomePage.dart';
import 'blood_pressure/BloodPressureHomePage.dart'; import 'blood_pressure/BloodPressureHomePage.dart';
import 'blood_suger/blood_sugar_home_page.dart'; import 'blood_suger/blood_sugar_home_page.dart';
@ -15,110 +15,136 @@ class MyTrackers extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AppScaffold( return AppScaffold(
appBarTitle: TranslationBase.of(context).myTracker, appBarTitle: TranslationBase.of(context).myTracker,
isShowAppBar: true, showNewAppBar: true,
isShowDecPage: true, isShowDecPage: true,
showNewAppBarTitle: true,
backgroundColor: Color(0xffF8F8F8),
description: TranslationBase.of(context).infoTrackers, description: TranslationBase.of(context).infoTrackers,
imagesInfo: [ imagesInfo: [
ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-trackers/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-trackers/ar/0.png') ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-trackers/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-trackers/ar/0.png')
], ],
body: SingleChildScrollView( body: SingleChildScrollView(
child: Container( child: Container(
padding: EdgeInsets.all(12), child: GridView(
margin: EdgeInsets.all(12), gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, crossAxisSpacing: 13, mainAxisSpacing: 9),
child: Column( physics: NeverScrollableScrollPhysics(),
crossAxisAlignment: CrossAxisAlignment.start, padding: EdgeInsets.all(21),
children: [ shrinkWrap: true,
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Expanded( CardCommonContact(
child: InkWell( image: 'assets/tracker/blood-suger.png',
onTap: () => Navigator.push(context, FadePage(page: BloodSugarHomePage())), text: TranslationBase.of(context).bloodSugar,
child: Container( subText: "",
margin: EdgeInsets.all(5), type: 3,
width: MediaQuery.of(context).size.width * 0.35,
height: MediaQuery.of(context).size.width * 0.35,
decoration: BoxDecoration(shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(8), color: Colors.white),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
'assets/tracker/blood-suger.png',
width: 60.0,
),
SizedBox(
height: 15,
),
Texts(TranslationBase.of(context).bloodSugar),
],
),
),
),
),
Expanded(
child: InkWell(
onTap: () => Navigator.push(context, FadePage(page: BloodPressureHomePage())),
child: Container(
margin: EdgeInsets.all(5),
width: MediaQuery.of(context).size.width * 0.35,
height: MediaQuery.of(context).size.width * 0.35,
decoration: BoxDecoration(shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(8), color: Colors.white),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
'assets/tracker/blood-pressure.png',
width: 60.0,
),
SizedBox(
height: 15,
),
Texts(TranslationBase.of(context).bloodPressure),
],
),
),
),
),
],
), ),
Row( CardCommonContact(
//mainAxisAlignment: MainAxisAlignment.spaceAround, image: 'assets/tracker/blood-pressure.png',
children: [ text: TranslationBase.of(context).bloodPressure,
Expanded( subText: "",
child: InkWell( type: 4,
onTap: () => Navigator.push(context, FadePage(page: WeightHomePage())),
child: Container(
margin: EdgeInsets.all(5),
width: MediaQuery.of(context).size.width * 0.35,
height: MediaQuery.of(context).size.width * 0.35,
decoration: BoxDecoration(shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(8), color: Colors.white),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
'assets/tracker/weight.png',
width: 60.0,
),
SizedBox(
height: 15,
),
Texts(TranslationBase.of(context).weight),
],
),
),
),
),
Expanded(
child: Container(),
),
],
), ),
], CardCommonContact(
), image: 'assets/tracker/weight.png',
), text: TranslationBase.of(context).weight,
subText: "",
type: 5,
)
])
// Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Expanded(
// child: InkWell(
// onTap: () => Navigator.push(context, FadePage(page: BloodSugarHomePage())),
// child: Container(
// margin: EdgeInsets.all(5),
// width: MediaQuery.of(context).size.width * 0.35,
// height: MediaQuery.of(context).size.width * 0.35,
// decoration: BoxDecoration(shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(8), color: Colors.white),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.center,
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Image.asset(
// 'assets/tracker/blood-suger.png',
// width: 60.0,
// ),
// SizedBox(
// height: 15,
// ),
// Texts(TranslationBase.of(context).bloodSugar),
// ],
// ),
// ),
// ),
// ),
// Expanded(
// child: InkWell(
// onTap: () => Navigator.push(context, FadePage(page: BloodPressureHomePage())),
// child: Container(
// margin: EdgeInsets.all(5),
// width: MediaQuery.of(context).size.width * 0.35,
// height: MediaQuery.of(context).size.width * 0.35,
// decoration: BoxDecoration(shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(8), color: Colors.white),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.center,
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Image.asset(
// 'assets/tracker/blood-pressure.png',
// width: 60.0,
// ),
// SizedBox(
// height: 15,
// ),
// Texts(TranslationBase.of(context).bloodPressure),
// ],
// ),
// ),
// ),
// ),
// ],
// ),
// Row(
// //mainAxisAlignment: MainAxisAlignment.spaceAround,
// children: [
// Expanded(
// child: InkWell(
// onTap: () => Navigator.push(context, FadePage(page: WeightHomePage())),
// child: Container(
// margin: EdgeInsets.all(5),
// width: MediaQuery.of(context).size.width * 0.35,
// height: MediaQuery.of(context).size.width * 0.35,
// decoration: BoxDecoration(shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(8), color: Colors.white),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.center,
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Image.asset(
// 'assets/tracker/weight.png',
// width: 60.0,
// ),
// SizedBox(
// height: 15,
// ),
// Texts(TranslationBase.of(context).weight),
// ],
// ),
// ),
// ),
// ),
// Expanded(
// child: Container(),
// ),
// ],
// ),
// ],
// ),
),
), ),
); );
} }

@ -20,6 +20,8 @@ class TranslationBase {
String get dashboardScreenToolbarTitle => localizedValues['dashboardScreenToolbarTitle'][locale.languageCode]; String get dashboardScreenToolbarTitle => localizedValues['dashboardScreenToolbarTitle'][locale.languageCode];
String get bloodType1 => localizedValues['bloodType'][locale.languageCode];
String get settings => localizedValues['settings'][locale.languageCode]; String get settings => localizedValues['settings'][locale.languageCode];
String get language => localizedValues['language'][locale.languageCode]; String get language => localizedValues['language'][locale.languageCode];
@ -93,18 +95,25 @@ class TranslationBase {
String get patientShare => localizedValues['patientShare'][locale.languageCode]; String get patientShare => localizedValues['patientShare'][locale.languageCode];
String get neverWait => localizedValues['neverWait'][locale.languageCode]; String get neverWait => localizedValues['neverWait'][locale.languageCode];
String get patientShareWithTax => localizedValues['patientShareWithTax'][locale.languageCode]; String get patientShareWithTax => localizedValues['patientShareWithTax'][locale.languageCode];
String get reminderTitle => localizedValues['reminderTitle'][locale.languageCode]; String get reminderTitle => localizedValues['reminderTitle'][locale.languageCode];
String get confirmAppo => localizedValues['confirmAppo'][locale.languageCode]; String get confirmAppo => localizedValues['confirmAppo'][locale.languageCode];
String get appointmentCalendar => localizedValues['appointmentCalendar'][locale.languageCode]; String get appointmentCalendar => localizedValues['appointmentCalendar'][locale.languageCode];
String get appointmentSuccess => localizedValues['appointmentSuccess'][locale.languageCode]; String get appointmentSuccess => localizedValues['appointmentSuccess'][locale.languageCode];
String get confirm => localizedValues['confirm'][locale.languageCode]; String get confirm => localizedValues['confirm'][locale.languageCode];
String get pressAgain => localizedValues['pressAgain'][locale.languageCode]; String get pressAgain => localizedValues['pressAgain'][locale.languageCode];
String get confirmLiveCare => localizedValues['confirmLiveCare'][locale.languageCode]; String get confirmLiveCare => localizedValues['confirmLiveCare'][locale.languageCode];
String get doctorFilter => localizedValues['doctorFilter'][locale.languageCode]; String get doctorFilter => localizedValues['doctorFilter'][locale.languageCode];
String get waitingForDoctor => localizedValues['waitingForDoctor'][locale.languageCode]; String get waitingForDoctor => localizedValues['waitingForDoctor'][locale.languageCode];
String get confirmLater => localizedValues['confirmLater'][locale.languageCode]; String get confirmLater => localizedValues['confirmLater'][locale.languageCode];
@ -724,11 +733,13 @@ class TranslationBase {
String get sentRequest => localizedValues['sent-requests'][locale.languageCode]; String get sentRequest => localizedValues['sent-requests'][locale.languageCode];
String get km => localizedValues['km'][locale.languageCode]; String get km => localizedValues['km'][locale.languageCode];
String get km_ => localizedValues['km_'][locale.languageCode]; String get km_ => localizedValues['km_'][locale.languageCode];
String get patientHealthSummaryReport =>
localizedValues['PatientHealthSummaryReport'][locale.languageCode]; String get patientHealthSummaryReport => localizedValues['PatientHealthSummaryReport'][locale.languageCode];
String get toViewTheTermsAndConditions =>
localizedValues['ToViewTheTermsAndConditions'][locale.languageCode]; String get toViewTheTermsAndConditions => localizedValues['ToViewTheTermsAndConditions'][locale.languageCode];
String get clickHere => localizedValues['ClickHere'][locale.languageCode]; String get clickHere => localizedValues['ClickHere'][locale.languageCode];
String get iAgreeToTheTermsAndConditions => localizedValues['IAgreeToTheTermsAndConditions'][locale.languageCode]; String get iAgreeToTheTermsAndConditions => localizedValues['IAgreeToTheTermsAndConditions'][locale.languageCode];
@ -802,7 +813,9 @@ class TranslationBase {
String get country => localizedValues['country'][locale.languageCode]; String get country => localizedValues['country'][locale.languageCode];
String get ok => localizedValues['Ok'][locale.languageCode]; String get ok => localizedValues['Ok'][locale.languageCode];
String get averageWaitingTime => localizedValues['averageWaitingTime'][locale.languageCode]; String get averageWaitingTime => localizedValues['averageWaitingTime'][locale.languageCode];
String get waterConsumedInWeek => localizedValues['WaterConsumedInWeek'][locale.languageCode]; String get waterConsumedInWeek => localizedValues['WaterConsumedInWeek'][locale.languageCode];
String get waterConsumedInMonth => localizedValues['WaterConsumedInMonth'][locale.languageCode]; String get waterConsumedInMonth => localizedValues['WaterConsumedInMonth'][locale.languageCode];
@ -1069,14 +1082,14 @@ class TranslationBase {
String get consumed => localizedValues['consumed'][locale.languageCode]; String get consumed => localizedValues['consumed'][locale.languageCode];
String get transferred => localizedValues['transferred'][locale.languageCode]; String get transferred => localizedValues['transferred'][locale.languageCode];
String get checkBeneficiary =>
localizedValues['checkBeneficiary'][locale.languageCode]; String get checkBeneficiary => localizedValues['checkBeneficiary'][locale.languageCode];
String get beneficiaryName =>
localizedValues['beneficiaryName'][locale.languageCode]; String get beneficiaryName => localizedValues['beneficiaryName'][locale.languageCode];
String get accountActivation =>
localizedValues['accountActivation'][locale.languageCode]; String get accountActivation => localizedValues['accountActivation'][locale.languageCode];
String get nonRecommended =>
localizedValues['nonRecommended'][locale.languageCode]; String get nonRecommended => localizedValues['nonRecommended'][locale.languageCode];
String get lakumTransfer => localizedValues['lakumTransfer'][locale.languageCode]; String get lakumTransfer => localizedValues['lakumTransfer'][locale.languageCode];
@ -2094,7 +2107,9 @@ class TranslationBase {
String get upComingPayOption => localizedValues["upcoming-pay-options"][locale.languageCode]; String get upComingPayOption => localizedValues["upcoming-pay-options"][locale.languageCode];
String get pleaseAcceptTerms => localizedValues["please-accept-terms"][locale.languageCode]; String get pleaseAcceptTerms => localizedValues["please-accept-terms"][locale.languageCode];
String get pleaseSelectAllQuestionToContinue => localizedValues["pleaseSelectAllQuestionToContinue"][locale.languageCode]; String get pleaseSelectAllQuestionToContinue => localizedValues["pleaseSelectAllQuestionToContinue"][locale.languageCode];
String get type => localizedValues["type"][locale.languageCode]; String get type => localizedValues["type"][locale.languageCode];
String get eReferralInfo => localizedValues["info-ereferral"][locale.languageCode]; String get eReferralInfo => localizedValues["info-ereferral"][locale.languageCode];
@ -2132,44 +2147,62 @@ class TranslationBase {
String get noThankyou => localizedValues["no-thankyou"][locale.languageCode]; String get noThankyou => localizedValues["no-thankyou"][locale.languageCode];
String get visitClinic => localizedValues["visit-clinic"][locale.languageCode]; String get visitClinic => localizedValues["visit-clinic"][locale.languageCode];
String get generateCovidCertificate => localizedValues["generate-covid-certificate"][locale.languageCode]; String get generateCovidCertificate => localizedValues["generate-covid-certificate"][locale.languageCode];
String get isReportOutsideKsa => localizedValues["is-report-outside-ksa"][locale.languageCode]; String get isReportOutsideKsa => localizedValues["is-report-outside-ksa"][locale.languageCode];
String get passportNumber => localizedValues["passport-number"][locale.languageCode]; String get passportNumber => localizedValues["passport-number"][locale.languageCode];
String get enterPassportNumber => localizedValues["enter-passport-number"][locale.languageCode]; String get enterPassportNumber => localizedValues["enter-passport-number"][locale.languageCode];
String get validPassportNumber => localizedValues["valid-passport-number"][locale.languageCode]; String get validPassportNumber => localizedValues["valid-passport-number"][locale.languageCode];
String get continuePlan => localizedValues["continue-plan"][locale.languageCode]; String get continuePlan => localizedValues["continue-plan"][locale.languageCode];
String get dentalProcedureList => localizedValues["dental-procedure-list"][locale.languageCode]; String get dentalProcedureList => localizedValues["dental-procedure-list"][locale.languageCode];
String get aboutApp => localizedValues["about-app"][locale.languageCode]; String get aboutApp => localizedValues["about-app"][locale.languageCode];
String get aboutPointsLength => localizedValues["about-points"]['length'][locale.languageCode]; String get aboutPointsLength => localizedValues["about-points"]['length'][locale.languageCode];
String get timeNeeded => localizedValues["time-needed"][locale.languageCode]; String get timeNeeded => localizedValues["time-needed"][locale.languageCode];
String get totalTimeNeeded =>
localizedValues["total-time-needed"][locale.languageCode]; String get totalTimeNeeded => localizedValues["total-time-needed"][locale.languageCode];
String get infoEye =>
localizedValues["info-eye"][locale.languageCode]; String get infoEye => localizedValues["info-eye"][locale.languageCode];
String get infoVaccines =>
localizedValues["info-vaccines"][locale.languageCode]; String get infoVaccines => localizedValues["info-vaccines"][locale.languageCode];
String get infoTrackers =>
localizedValues["info-trackers"][locale.languageCode]; String get infoTrackers => localizedValues["info-trackers"][locale.languageCode];
String get infoHealthData =>
localizedValues["info-health-data"][locale.languageCode]; String get infoHealthData => localizedValues["info-health-data"][locale.languageCode];
String get infoAskDoc =>
localizedValues["info-ask-doc"][locale.languageCode]; String get infoAskDoc => localizedValues["info-ask-doc"][locale.languageCode];
String get infoAutoWifi =>
localizedValues["info-auto-wifi"][locale.languageCode]; String get infoAutoWifi => localizedValues["info-auto-wifi"][locale.languageCode];
String get autoWifi =>
localizedValues["auto-wifi"][locale.languageCode]; String get autoWifi => localizedValues["auto-wifi"][locale.languageCode];
String get childVaccineInfo =>
localizedValues["child-vaccine-info"][locale.languageCode]; String get childVaccineInfo => localizedValues["child-vaccine-info"][locale.languageCode];
String get h2oInfo =>
localizedValues["h2o-info"][locale.languageCode]; String get h2oInfo => localizedValues["h2o-info"][locale.languageCode];
String get askDocEmpty =>
localizedValues["ask-doc-empty"][locale.languageCode]; String get sysdias => localizedValues["sys/dias"][locale.languageCode];
String get onlineClinics =>
localizedValues["online-clinics"][locale.languageCode]; String get arm => localizedValues["arm"][locale.languageCode];
String get offlineClinics =>
localizedValues["offline-clinics"][locale.languageCode]; String get removeMeasure => localizedValues["remove-measure"][locale.languageCode];
String get clinicSchedule =>
localizedValues["clinic-schedule"][locale.languageCode]; String get selectArm => localizedValues["select-arm"][locale.languageCode];
String get askDocEmpty => localizedValues["ask-doc-empty"][locale.languageCode];
String get onlineClinics => localizedValues["online-clinics"][locale.languageCode];
String get offlineClinics => localizedValues["offline-clinics"][locale.languageCode];
String get clinicSchedule => localizedValues["clinic-schedule"][locale.languageCode];
} }
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> { class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

@ -941,6 +941,12 @@ String labelFrom({@required String className}) {
return result; return result;
} }
extension StringExtension on String {
String capitalize() {
return this.splitMapJoin(RegExp(r'\w+'), onMatch: (m) => '${m.group(0)}'.substring(0, 1).toUpperCase() + '${m.group(0)}'.substring(1).toLowerCase(), onNonMatch: (n) => ' ');
}
}
/* /*
userBoard.asMap().map((i, element) => MapEntry(i, Stack( userBoard.asMap().map((i, element) => MapEntry(i, Stack(
GestureDetector(onTap: () { GestureDetector(onTap: () {

@ -10,12 +10,7 @@ class RadioStringDialog extends StatefulWidget {
final String title; final String title;
String selectedValue; String selectedValue;
RadioStringDialog( RadioStringDialog({Key key, this.radioList, this.onValueSelected, this.selectedValue, this.title});
{Key key,
this.radioList,
this.onValueSelected,
this.selectedValue,
this.title});
@override @override
_RadioStringDialogState createState() => _RadioStringDialogState(); _RadioStringDialogState createState() => _RadioStringDialogState();
@ -40,9 +35,7 @@ class _RadioStringDialogState extends State<RadioStringDialog> {
))), ))),
children: [ children: [
Container( Container(
height: widget.radioList.length > 3 height: widget.radioList.length > 3 ? MediaQuery.of(context).size.height * 0.6 : null,
? MediaQuery.of(context).size.height * 0.6
: null,
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
children: [ children: [
@ -52,9 +45,9 @@ class _RadioStringDialogState extends State<RadioStringDialog> {
(index) => Column( (index) => Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
SizedBox( // SizedBox(
height: 2, // height: 2,
), // ),
Row( Row(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
@ -62,12 +55,14 @@ class _RadioStringDialogState extends State<RadioStringDialog> {
child: InkWell( child: InkWell(
onTap: () { onTap: () {
setState(() { setState(() {
widget.selectedValue = widget.selectedValue = widget.radioList[index];
widget.radioList[index];
}); });
}, },
child: ListTile( child: ListTile(
title: Text(widget.radioList[index]), title: Texts(
widget.radioList[index],
fontSize: 14,
),
leading: Radio( leading: Radio(
value: widget.radioList[index], value: widget.radioList[index],
groupValue: widget.selectedValue, groupValue: widget.selectedValue,
@ -83,66 +78,61 @@ class _RadioStringDialogState extends State<RadioStringDialog> {
) )
], ],
), ),
SizedBox(
height: 5.0,
),
], ],
), ),
), ),
SizedBox( SizedBox(
height: 5.0, height: 5.0,
), ),
Row( ],
children: <Widget>[ ),
Expanded( ),
flex: 1, ),
child: InkWell( Row(
onTap: () { children: <Widget>[
Navigator.pop(context); Expanded(
}, flex: 1,
child: Padding( child: InkWell(
padding: const EdgeInsets.all(8.0), onTap: () {
child: Container( Navigator.pop(context);
child: Center( },
child: Texts( child: Padding(
TranslationBase.of(context) padding: const EdgeInsets.all(8.0),
.cancel child: Container(
.toUpperCase(), child: Center(
color: Colors.red, child: Texts(
), TranslationBase.of(context).cancel.toUpperCase(),
), color: Colors.red,
),
),
), ),
), ),
Container( ),
width: 1, ),
height: 30, ),
color: Colors.grey[500], ),
), Container(
Expanded( width: 1,
flex: 1, height: 30,
child: InkWell( color: Colors.grey[500],
onTap: () { ),
widget.onValueSelected(widget.selectedValue); Expanded(
Navigator.pop(context); flex: 1,
}, child: InkWell(
child: Padding( onTap: () {
padding: const EdgeInsets.all(8.0), widget.onValueSelected(widget.selectedValue);
child: Center( Navigator.pop(context);
child: Texts( },
TranslationBase.of(context).ok, child: Padding(
fontWeight: FontWeight.w400, padding: const EdgeInsets.all(8.0),
), child: Center(
), child: Texts(
), TranslationBase.of(context).ok,
), fontWeight: FontWeight.w400,
), ),
], ),
) ),
], ),
), ),
), ],
) )
], ],
); );

@ -163,7 +163,7 @@ class _AppDrawerState extends State<AppDrawer> {
} else { } else {
projectProvider.changeLanguage('ar'); projectProvider.changeLanguage('ar');
} }
var themeNotifier = Provider.of<ThemeNotifier>(context, listen: false); var themeNotifier = Provider.of<ThemeNotifier>(context, listen: true);
themeNotifier.setTheme(defaultTheme(fontName: projectProvider.isArabic ? 'Cairo' : 'Poppins')); themeNotifier.setTheme(defaultTheme(fontName: projectProvider.isArabic ? 'Cairo' : 'Poppins'));
}, },
), ),

@ -113,12 +113,13 @@ class _FloatingSearchButton extends State<FloatingSearchButton> with TickerProvi
void initState() { void initState() {
controller = AnimationController(vsync: this, duration: Duration(seconds: 1)); controller = AnimationController(vsync: this, duration: Duration(seconds: 1));
offset = Tween<Offset>(begin: Offset(0.0, 1.0), end: Offset(0.0, 0.0)).animate(controller); offset = Tween<Offset>(begin: Offset(0.0, 1.0), end: Offset(0.0, 0.0)).animate(controller);
if (IS_VOICE_COMMAND_CLOSED == true) { if (IS_VOICE_COMMAND_CLOSED == true) {
controller.reverse(from: -1); controller.reverse(from: -1);
} else { } else {
if (mounted) { if (mounted) {
//Future.delayed(const Duration(seconds: 2), () { //Future.delayed(const Duration(seconds: 2), () {
_currentLocaleId = TranslationBase.of(AppGlobal.context).locale.languageCode;
setState(() { setState(() {
if (IS_TEXT_COMPLETED) { if (IS_TEXT_COMPLETED) {
isAnimationEnable = false; isAnimationEnable = false;
@ -222,13 +223,14 @@ class _FloatingSearchButton extends State<FloatingSearchButton> with TickerProvi
} }
startVoiceSearch() async { startVoiceSearch() async {
_currentLocaleId = TranslationBase.of(AppGlobal.context).locale.languageCode;
bool available = await speech.initialize(onStatus: statusListener, onError: errorListener); bool available = await speech.initialize(onStatus: statusListener, onError: errorListener);
_currentLocaleId = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
if (available) { if (available) {
speech.listen( speech.listen(
onResult: resultListener, onResult: resultListener,
// listenMode: ListenMode.confirmation, //listenMode: ListenMode.confirmation,
localeId: _currentLocaleId == 'en' ? 'en-US' : 'ar-SA', localeId: _currentLocaleId == 'en' ? 'en_US' : 'ar_SA',
); );
} else { } else {
print("The user has denied the use of speech recognition."); print("The user has denied the use of speech recognition.");

Loading…
Cancel
Save