child Vaccines

merge-update-with-lab-changes
Amjad amireh 5 years ago
parent 42554ffa67
commit 8a6511404f

@ -1,7 +1,11 @@
import 'package:device_calendar/device_calendar.dart'; import 'package:device_calendar/device_calendar.dart';
import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart';
import 'package:diplomaticquarterapp/core/model/childvaccines/add_newchild_model.dart';
import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/add_new_child_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/child_vaccines_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/child_vaccines_view_model.dart';
import 'package:diplomaticquarterapp/pages/ChildVaccines/add_newchild_page.dart'; import 'package:diplomaticquarterapp/pages/ChildVaccines/add_newchild_page.dart';
import 'package:diplomaticquarterapp/pages/ChildVaccines/child_page.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/medical/active_medications/DayCheckBoxDialog.dart'; import 'package:diplomaticquarterapp/pages/medical/active_medications/DayCheckBoxDialog.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart';
@ -14,7 +18,6 @@ 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:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'new_text_Field.dart'; import 'new_text_Field.dart';
enum Gender { Male, Female, NON } enum Gender { Male, Female, NON }
@ -24,6 +27,7 @@ class AddNewChildPage extends StatefulWidget {
final int frequency; final int frequency;
final int days; final int days;
final String itemDescription; final String itemDescription;
String dateAdd;
List<DateTime> _scheduleList = List(); List<DateTime> _scheduleList = List();
List<DayOfWeek> daysOfWeek = [ List<DayOfWeek> daysOfWeek = [
@ -42,8 +46,9 @@ 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}) : super(key: key);
AddNewChildPage({Key key, this.frequency, this.days, this.itemDescription}) { AddNewChildPage({Key key, this.frequency, this.days, this.itemDescription}) {
startDay = DateTime.now(); startDay = DateTime.now();
endDay = DateTime.now();//endDay = DateTime.now().add(Duration(days: days)); endDay =
int hour = 24;//(24 / frequency).round(); DateTime.now(); //endDay = DateTime.now().add(Duration(days: days));
int hour = 24; //(24 / frequency).round();
int durations = 24 ~/ hour; int durations = 24 ~/ hour;
for (int count = 0; count < durations; count++) { for (int count = 0; count < durations; count++) {
_scheduleList.add(DateTime(DateTime.now().year, DateTime.now().month, _scheduleList.add(DateTime(DateTime.now().year, DateTime.now().month,
@ -71,11 +76,13 @@ class _AddNewChildPageState extends State<AddNewChildPage> {
Gender gender = Gender.Male; Gender gender = Gender.Male;
//ChildVaccinesViewModel addvancedModel = ChildVaccinesViewModel(); //ChildVaccinesViewModel addvancedModel = ChildVaccinesViewModel();
List_BabyInformationModel addvancedModel = List_BabyInformationModel(); List_BabyInformationModel addvancedModel = List_BabyInformationModel();
CreateNewBaby newChild=CreateNewBaby();
List_UserInformationModel informationModel =List_UserInformationModel();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<AddNewChildViewModel>(
return AppScaffold( builder: (_,model,w)=> AppScaffold(
isShowAppBar: true, isShowAppBar: true,
appBarTitle: "Vaccintion", appBarTitle: "Vaccintion",
body: SingleChildScrollView( body: SingleChildScrollView(
@ -115,9 +122,9 @@ class _AddNewChildPageState extends State<AddNewChildPage> {
Text( Text(
"Gender:", "Gender:",
textAlign: TextAlign.end, textAlign: TextAlign.end,
), ),
],), ],
),
Container( Container(
height: MediaQuery.of(context).size.height * 0.12, height: MediaQuery.of(context).size.height * 0.12,
width: double.infinity, width: double.infinity,
@ -125,29 +132,22 @@ class _AddNewChildPageState extends State<AddNewChildPage> {
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Container( Container(
height: MediaQuery.of(context).size.height * 0.12, height: MediaQuery.of(context).size.height * 0.12,
width: 170, width: 170,
child: SecondaryButton( child: SecondaryButton(
textColor:
textColor:checkedValue == 1 checkedValue == 1 ? Colors.white : Colors.black,
? Colors.white color: checkedValue == 1 ? Colors.red : Colors.white,
: Colors.black,
color: checkedValue == 1
? Colors.red
: Colors.white,
label: "Male", label: "Male",
// //
onTap: () { onTap: () {
// bloodDetails.city=_selectedHospital.toString(); // bloodDetails.city=_selectedHospital.toString();
setState(() { setState(() {
checkedValue=1; checkedValue = 1;
print("checkedValue="+checkedValue.toString()); print("checkedValue=" + checkedValue.toString());
}); });
// bloodDetails. // bloodDetails.
@ -158,18 +158,15 @@ class _AddNewChildPageState extends State<AddNewChildPage> {
height: MediaQuery.of(context).size.height * 0.12, height: MediaQuery.of(context).size.height * 0.12,
width: 170, width: 170,
child: SecondaryButton( child: SecondaryButton(
textColor:checkedValue == 2 textColor:
? Colors.white checkedValue == 2 ? Colors.white : Colors.black,
: Colors.black, color: checkedValue == 2 ? Colors.red : Colors.white,
color: checkedValue == 2
? Colors.red
: Colors.white,
label: "Female", label: "Female",
// //
onTap: () { onTap: () {
setState(() { setState(() {
checkedValue=2; checkedValue = 2;
print("checkedValue="+checkedValue.toString()); print("checkedValue=" + checkedValue.toString());
}); });
// bloodDetails.city=_selectedHospital.toString(); // bloodDetails.city=_selectedHospital.toString();
@ -177,7 +174,8 @@ class _AddNewChildPageState extends State<AddNewChildPage> {
}, },
), ),
) )
],) , ],
),
), ),
//========== //==========
SizedBox( SizedBox(
@ -189,17 +187,17 @@ class _AddNewChildPageState extends State<AddNewChildPage> {
Text( Text(
"Date Of Birth::", "Date Of Birth::",
textAlign: TextAlign.end, textAlign: TextAlign.end,
), ),
],), ],
),
InkWell( InkWell(
onTap: () { onTap: () {
DatePicker.showDatePicker(context, DatePicker.showDatePicker(
context,
showTitleActions: true, showTitleActions: true,
// minTime: DateTime( // minTime: DateTime(
// DateTime.now().year, DateTime.now().month - 1, 1), // DateTime.now().year, DateTime.now().month - 1, 1),
minTime: DateTime( minTime: DateTime(1, 1, 1),
1, 1, 1),
maxTime: DateTime.now(), maxTime: DateTime.now(),
onConfirm: (date) { onConfirm: (date) {
setState(() { setState(() {
@ -220,7 +218,7 @@ class _AddNewChildPageState extends State<AddNewChildPage> {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Texts( //getStartDay() Texts(//getStartDay()
// DateUtil.yearMonthDay(DateTime.now()) // DateUtil.yearMonthDay(DateTime.now())
getStartDay() getStartDay()
), ),
@ -236,7 +234,6 @@ class _AddNewChildPageState extends State<AddNewChildPage> {
height: 12, height: 12,
), ),
//========= //=========
], ],
), ),
), ),
@ -259,30 +256,56 @@ class _AddNewChildPageState extends State<AddNewChildPage> {
// //
onTap: () { onTap: () {
addvancedModel.babyName=_firstTextController.text + " "+_secondTextController.text; newChild.babyName =
addvancedModel.gender=checkedValue; _firstTextController.text + " " + _secondTextController.text;
addvancedModel.dOB=DateUtil.convertStringToDate(getStartDay()) ; newChild.gender = checkedValue.toString();
addvancedModel.alertBy=2; newChild.strDOB=getStartDay() ;
addvancedModel.alertBy=addvancedModel.babyID; newChild.createdBy=informationModel.createdBy ;
addvancedModel.genderDescription=checkedValue==1?"Male":"Female"; newChild.editedBy=informationModel.createdBy;
addvancedModel.patientID=addvancedModel.patientID; newChild.tempValue=true;
addvancedModel.userID=addvancedModel.userID; newChild.userID=addvancedModel.userID;
newChild.isLogin=true;
newChild.alertBy=addvancedModel.alertBy;
model.getNewBabyOrders(newChild: newChild);
//DateTime.now();//DateUtil.convertStringToDate(getStartDay());
// addvancedModel.alertBy = 2;
// addvancedModel.alertBy = addvancedModel.babyID;
// addvancedModel.genderDescription =
// checkedValue == 1 ? "Male" : "Female";
// addvancedModel.patientID = addvancedModel.patientID;
// addvancedModel.userID = addvancedModel.userID;
// // advanceModel.fileNumber = _fileTextController.text; // // advanceModel.fileNumber = _fileTextController.text;
// // advanceModel.hospitalsModel = _selectedHospital; // // advanceModel.hospitalsModel = _selectedHospital;
// // advanceModel.note = _notesTextController.text; // // advanceModel.note = _notesTextController.text;
// // advanceModel.email = email ?? model.user.emailAddress; // // advanceModel.email = email ?? model.user.emailAddress;
// // advanceModel.amount = amount; // // advanceModel.amount = amount;
// // bloodDetails.city=_selectedHospital.toString(); // // bloodDetails.city=_selectedHospital.toString();
AppToast.showSuccessToast( AppToast.showSuccessToast(message: "Record Added");
message: "Email updated"); //============
Navigator.push(
context,
FadePage(
page: ChildPage(),
//ChildPage(babyInformationModelList:model.BabyInformationModelList)
// HospitalsPage(
// findusHospitalModelList: model.FindusHospitalModelList,
// )
),
);
//==============
// bloodDetails. // bloodDetails.
}, },
), ),
),
), ),
); );
} }
String getStartDay() { String getStartDay() {
return "${DateUtil.getMonth(widget.startDay.month)} ${widget.startDay.day}, ${widget.startDay.year}"; return "${DateUtil.getMonth(widget.startDay.month)} ${widget.startDay.day}, ${widget.startDay.year}";
} }

Loading…
Cancel
Save