Child Vaccine 3

merge-requests/452/merge
Mirza.Shafique 4 years ago
parent 4f7666cfd8
commit 1a6802ce24

@ -1116,7 +1116,7 @@ const Map localizedValues = {
"childName": {"en": "'CHILD NAME'", "ar": "إسم الطفل"},
"recordDeleted": {"en": "'Record Deleted'", "ar": "تم حذف السجل"},
"msg_email_address_up_to_date": {
"en": " Please ensure that the email address is up-to-date and proceed to view the schedule.",
"en": "Please ensure that the email address is up-to-date and proceed to view the schedule.",
"ar": " يرجى التأكد من تحديث عنوان البريد الإلكتروني والمتابعة لعرض الجدول"
},
"add-new-child": {"en": "ADD NEW CHILD", "ar": "إضافة طفل جديد"},

@ -15,6 +15,7 @@ import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/parking_page.da
import 'package:diplomaticquarterapp/pages/Blood/blood_donation.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/Search.dart';
import 'package:diplomaticquarterapp/pages/ChildVaccines/child_vaccines_page.dart';
import 'package:diplomaticquarterapp/pages/ChildVaccines/new/child_initial_page.dart';
import 'package:diplomaticquarterapp/pages/ChildVaccines/new/child_vaccine_page.dart';
import 'package:diplomaticquarterapp/pages/ContactUs/findus/findus_page.dart';
import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-drivethru-location.dart';
@ -278,7 +279,7 @@ class _AllHabibMedicalServiceState extends State<AllHabibMedicalService> {
ServicesContainer(
onTap: () => Navigator.push(
context,
FadePage(page: ChildVaccinePage()),
FadePage(page: ChildInitialPage()),
),
imageLocation: 'assets/images/new-design/children_vaccines_icon.png',
title: TranslationBase.of(context).childVaccine,

@ -7,6 +7,7 @@ import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/add_new_chil
import 'package:diplomaticquarterapp/pages/Blood/new_text_Field.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/medical/active_medications/DayCheckBoxDialog.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
@ -27,15 +28,7 @@ class AddNewChildPage extends StatefulWidget {
String dateAdd;
List<DateTime> _scheduleList = List();
List<DayOfWeek> daysOfWeek = [
DayOfWeek.Monday,
DayOfWeek.Tuesday,
DayOfWeek.Wednesday,
DayOfWeek.Thursday,
DayOfWeek.Friday,
DayOfWeek.Saturday,
DayOfWeek.Sunday
];
List<DayOfWeek> daysOfWeek = [DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Friday, DayOfWeek.Saturday, DayOfWeek.Sunday];
DateTime startDay;
DateTime endDay;
@ -43,13 +36,11 @@ class AddNewChildPage extends StatefulWidget {
//AddNewChildPage({Key key, this.frequency, this.days, this.itemDescription}) : super(key: key);
AddNewChildPage({Key key, this.frequency, this.days, this.itemDescription}) {
startDay = DateTime.now();
endDay =
DateTime.now(); //endDay = DateTime.now().add(Duration(days: days));
endDay = DateTime.now(); //endDay = DateTime.now().add(Duration(days: days));
int hour = 24; //(24 / frequency).round();
int durations = 24 ~/ hour;
for (int count = 0; count < durations; count++) {
_scheduleList.add(DateTime(DateTime.now().year, DateTime.now().month,
DateTime.now().day, (hour * count)));
_scheduleList.add(DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day, (hour * count)));
}
}
@ -81,197 +72,210 @@ class _AddNewChildPageState extends State<AddNewChildPage> {
@override
Widget build(BuildContext context) {
var size = MediaQuery.of(context).size;
return BaseView<AddNewChildViewModel>(
builder: (_, model, w) => AppScaffold(
isShowAppBar: true,
appBarTitle: TranslationBase.of(context).vaccination,
body: SingleChildScrollView(
physics: ScrollPhysics(),
child: Container(
margin: EdgeInsets.all(12),
child: Column(
// crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
height: 20,
),
Texts(
TranslationBase.of(context).vaccinationAddChildMsg,
//+model.user.firstName,
textAlign: TextAlign.center,
),
SizedBox(
height: 12,
),
NewTextFields(
hintText: TranslationBase.of(context).firstName,
controller: _firstTextController,
),
SizedBox(
height: 12,
),
NewTextFields(
hintText: TranslationBase.of(context).middleName,
controller: _secondTextController,
),
SizedBox(
height: 12,
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
TranslationBase.of(context).gender,
textAlign: TextAlign.end,
),
],
),
Container(
width: double.infinity,
height: size.height * 0.12,
showNewAppBar: true,
body: Container(
child: Column(
children: [
Expanded(
child: Padding(
padding: EdgeInsets.all(12),
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.center,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Expanded(
child: Container(
color: Colors.white,
child: SecondaryButton(
textColor:
checkedValue == 1 ? Colors.white : Colors.black,
color: checkedValue == 1 ? Colors.red : Colors.white,
label: TranslationBase.of(context).male,
onTap: () {
setState(() {
checkedValue = 1;
print("checkedValue=" + checkedValue.toString());
});
Text(
TranslationBase.of(context).vaccinationAddChildMsg,
//+model.user.firstName,
style: TextStyle(
fontSize: 16,
letterSpacing: -0.64,
fontWeight: FontWeight.w600,
),
),
SizedBox(
height: 12,
),
inputWidget(TranslationBase.of(context).firstName, "", _firstTextController),
SizedBox(
height: 12,
),
inputWidget(TranslationBase.of(context).middleName, "", _secondTextController),
// bloodDetails.
},
),
SizedBox(
height: 12,
),
Text(
TranslationBase.of(context).selectGender,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
letterSpacing: -0.48,
),
),
Expanded(
child: Container(
color: Colors.white,
child: SecondaryButton(
textColor:
checkedValue == 2 ? Colors.white : Colors.black,
color: checkedValue == 2 ? Colors.red : Colors.white,
label: TranslationBase.of(context).female,
//
onTap: () {
Row(
children: [
Expanded(
child: Row(
children: [
Radio(
value: checkedValue,
groupValue: 1,
onChanged: (v) {
setState(() {
checkedValue = 1;
});
}),
Text(
TranslationBase.of(context).male,
style: TextStyle(
fontSize: 12,
letterSpacing: -0.48,
fontWeight: FontWeight.w600,
),
)
],
),
),
Expanded(
child: Row(
children: [
Radio(
value: checkedValue,
groupValue: 2,
onChanged: (v) {
setState(() {
checkedValue = 2;
});
}),
Text(
TranslationBase.of(context).female,
style: TextStyle(
fontSize: 12,
letterSpacing: -0.48,
fontWeight: FontWeight.w600,
),
)
],
),
),
],
),
//==========
SizedBox(
height: 6,
),
InkWell(
onTap: () {
DatePicker.showDatePicker(
context,
showTitleActions: true,
// minTime: DateTime(
// DateTime.now().year, DateTime.now().month - 1, 1),
minTime: DateTime(1, 1, 1),
maxTime: DateTime.now(),
onConfirm: (date) {
setState(() {
checkedValue = 2;
print("checkedValue=" + checkedValue.toString());
widget.startDay = date;
});
// bloodDetails.city=_selectedHospital.toString();
// bloodDetails.
},
currentTime: widget.startDay,
// locale: projectViewModel.localeType
);
},
child: Container(
width: double.infinity,
padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
color: Colors.white,
border: Border.all(
color: Color(0xffefefef),
width: 1,
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
TranslationBase.of(context).dob,
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.w600,
color: Color(0xff2B353E),
letterSpacing: -0.44,
),
),
Text(
//getStartDay()
// DateUtil.yearMonthDay(DateTime.now())
getStartDay(),
style: TextStyle(
fontSize: 14,
height: 21 / 14,
fontWeight: FontWeight.w400,
color: Color(0xff575757),
letterSpacing: -0.56,
),
),
],
),
Icon(
Icons.calendar_today,
color: Color(0xff575757),
size: 18,
)
],
),
),
)
),
SizedBox(
height: 12,
),
//=========
],
),
),
//==========
SizedBox(
height: 6,
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
TranslationBase.of(context).dob,
textAlign: TextAlign.end,
),
],
),
InkWell(
onTap: () {
DatePicker.showDatePicker(
context,
showTitleActions: true,
// minTime: DateTime(
// DateTime.now().year, DateTime.now().month - 1, 1),
minTime: DateTime(1, 1, 1),
maxTime: DateTime.now(),
onConfirm: (date) {
setState(() {
widget.startDay = date;
});
},
currentTime: widget.startDay,
// locale: projectViewModel.localeType
);
},
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(//getStartDay()
// DateUtil.yearMonthDay(DateTime.now())
getStartDay()),
Icon(
Icons.calendar_today,
color: Colors.black,
)
],
),
),
),
SizedBox(
height: 12,
),
Container(
height: MediaQuery.of(context).size.height * 0.12,
width: double.infinity,
padding: EdgeInsets.all(15),
child: SecondaryButton(
textColor: Colors.white,
color: checkedValue == false
? Colors.white24
: Color.fromRGBO(
63,
72,
74,
1,
),
label: TranslationBase.of(context).add,
//
onTap: () async {
newChild.babyName = _firstTextController.text +
" " +
_secondTextController.text;
newChild.gender = checkedValue.toString();
newChild.strDOB = getStartDay();
newChild.tempValue = true;
newChild.isLogin = true;
),
Container(
width: double.infinity,
padding: EdgeInsets.all(16),
color: Colors.white,
child: SecondaryButton(
textColor: Colors.white,
color: checkedValue == false ? Colors.white24 : CustomColors.accentColor,
label: TranslationBase.of(context).add,
//
onTap: () async {
newChild.babyName = _firstTextController.text + " " + _secondTextController.text;
newChild.gender = checkedValue.toString();
newChild.strDOB = getStartDay();
newChild.tempValue = true;
newChild.isLogin = true;
await model.createNewBabyOrders(newChild: newChild);
if (model.isAdded) {
AppToast.showSuccessToast(message: TranslationBase.of(context).childAddedSuccessfully);
Navigator.pop(context, model.isAdded);
} else {
//TODO handling error
}
},
),
await model.createNewBabyOrders(newChild: newChild);
if (model.isAdded) {
AppToast.showSuccessToast(message: TranslationBase.of(context).childAddedSuccessfully);
Navigator.pop(context, model.isAdded);
} else {
//TODO handling error
}
},
),
//=========
],
),
),
],
),
),
// bottomSheet:
@ -313,4 +317,77 @@ class _AddNewChildPageState extends State<AddNewChildPage> {
),
);
}
Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller,
{VoidCallback suffixTap, bool isEnable = true, bool hasSelection = false, int lines, bool isInputTypeNum = false}) {
return Container(
padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
color: Colors.white,
border: Border.all(
color: Color(0xffefefef),
width: 1,
),
),
child: InkWell(
onTap: hasSelection ? () {} : null,
child: Row(
children: [
Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
_labelText,
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.w600,
color: Color(0xff2B353E),
letterSpacing: -0.44,
),
),
TextField(
enabled: isEnable,
scrollPadding: EdgeInsets.zero,
keyboardType: isInputTypeNum ? TextInputType.number : TextInputType.text,
controller: _controller,
maxLines: lines,
onChanged: (value) => {setState(() {})},
style: TextStyle(
fontSize: 14,
height: 21 / 14,
fontWeight: FontWeight.w400,
color: Color(0xff2B353E),
letterSpacing: -0.44,
),
decoration: InputDecoration(
isDense: true,
hintText: _hintText,
hintStyle: TextStyle(
fontSize: 14,
height: 21 / 14,
fontWeight: FontWeight.w400,
color: Color(0xff575757),
letterSpacing: -0.56,
),
suffixIconConstraints: BoxConstraints(minWidth: 50),
suffixIcon: suffixTap == null ? null : IconButton(icon: Icon(Icons.mic, color: Color(0xff2E303A)), onPressed: suffixTap),
contentPadding: EdgeInsets.zero,
border: InputBorder.none,
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
),
),
],
),
),
if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined),
],
),
),
);
}
}

@ -0,0 +1,149 @@
import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart';
import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/user_information_view_model.dart';
import 'package:diplomaticquarterapp/pages/ChildVaccines/child_page.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/input/text_field.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'child_vaccine_page.dart';
class ChildInitialPage extends StatefulWidget {
@override
_ChildVaccinesPageState createState() => _ChildVaccinesPageState();
}
class _ChildVaccinesPageState extends State<ChildInitialPage> with SingleTickerProviderStateMixin {
TextEditingController titleController = TextEditingController();
var checkedValue = false;
String addEmail = "";
@override
Widget build(BuildContext context) {
return BaseView<UserInformationViewModel>(
onModelReady: (model) => model.getUserInformationRequestOrders(),
builder: (_, model, w) => AppScaffold(
isShowAppBar: true,
isShowDecPage: true,
showNewAppBarTitle: true,
showNewAppBar: true,
description: TranslationBase.of(context).childVaccineInfo,
imagesInfo: [
ImagesInfo(
imageEn: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/child-vaccines/en/0.png',
imageAr: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/child-vaccines/ar/0.png'),
ImagesInfo(
imageEn: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/child-vaccines/en/1.png',
imageAr: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/child-vaccines/ar/1.png')
],
appBarTitle: TranslationBase.of(context).vaccination,
body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Padding(
padding: const EdgeInsets.all(12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
TranslationBase.of(context).welcomeBack,
style: TextStyle(
fontSize: 16,
letterSpacing: -0.64,
fontWeight: FontWeight.w600,
),
),
SizedBox(
height: 16,
),
Text(
TranslationBase.of(context).msg_email_address_up_to_date,
style: TextStyle(
fontSize: 16,
letterSpacing: -0.64,
fontWeight: FontWeight.w600,
),
),
SizedBox(
height: 20,
),
TextFields(
fillColor: Colors.red,
hintText: model.user != null ? model.user.emailAddress : "",
controller: titleController,
fontSize: 14,
hintColor: Colors.black,
fontWeight: FontWeight.w600,
suffixIcon: checkedValue ? Icons.check_box : Icons.check_box_outline_blank,
onSuffixTap: () {
setState(() {
checkedValue = !checkedValue;
});
},
onChanged: (text) {
addEmail = text;
model.user.emailAddress == addEmail ? checkedValue = false : checkedValue = true;
},
validator: (value) {
if (value == null) {
return model.user.emailAddress;
} else {
return model.user.emailAddress;
}
},
),
],
),
),
mFlex(1),
Container(
width: double.infinity,
color: Colors.white,
padding: EdgeInsets.all(16),
child: Column(
children: [
if (checkedValue)
SecondaryButton(
textColor: Colors.white,
color: checkedValue == false ? Colors.white24 : CustomColors.green,
label: TranslationBase.of(context).updateEmail,
//
onTap: () {
model.user.emailAddress = addEmail.toString();
AppToast.showSuccessToast(message: TranslationBase.of(context).updateEmailMsg);
// bloodDetails.city=_selectedHospital.toString();
// bloodDetails.
},
),
if (checkedValue) mHeight(16),
SecondaryButton(
textColor: Colors.white,
color: CustomColors.accentColor,
label: TranslationBase.of(context).viewListChildren,
//
onTap: () => Navigator.push(
context,
FadePage(
page: ChildVaccinePage(),
),
),
),
],
),
),
],
),
),
);
}
}

@ -56,7 +56,7 @@ class _ChildPageState extends State<ChildVaccinePage> with SingleTickerProviderS
);
},
child: Container(
margin: EdgeInsets.only(left: 16, right: 16),
margin: EdgeInsets.only(left: 16, right: 16,top: index==0?16:0,bottom: index==model.babyInformationModelList.length-1?16:0),
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: BorderRadius.all(Radius.circular(12)),

@ -14,6 +14,7 @@ import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/parking_page.da
import 'package:diplomaticquarterapp/pages/Blood/blood_donation.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/Search.dart';
import 'package:diplomaticquarterapp/pages/ChildVaccines/child_vaccines_page.dart';
import 'package:diplomaticquarterapp/pages/ChildVaccines/new/child_initial_page.dart';
import 'package:diplomaticquarterapp/pages/ChildVaccines/new/child_vaccine_page.dart';
import 'package:diplomaticquarterapp/pages/ContactUs/contact_us_page.dart';
import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-drivethru-location.dart';
@ -103,7 +104,7 @@ class ServicesView extends StatelessWidget {
} else if (index == 14) {
Navigator.push(
context,
FadePage(page: ChildVaccinePage()),
FadePage(page: ChildInitialPage()),
);
} else if (index == 15) {
Navigator.pop(context);

Loading…
Cancel
Save