Merge branch 'mirza_home_page' into development_new_design_2.0

merge-update-with-lab-changes
Mirza.Shafique 4 years ago
commit 4f7666cfd8

@ -1,6 +1,7 @@
import 'package:diplomaticquarterapp/core/model/childvaccines/delete_baby_model.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/delete_baby_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/base/base_view.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/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';
@ -10,6 +11,7 @@ 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:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import '../add_newchild_page.dart'; import '../add_newchild_page.dart';
import '../vaccinationtable_page.dart'; import '../vaccinationtable_page.dart';
@ -31,274 +33,175 @@ class _ChildPageState extends State<ChildVaccinePage> with SingleTickerProviderS
var checkedValue = true; var checkedValue = true;
return BaseView<ChildVaccinesViewModel>( return BaseView<ChildVaccinesViewModel>(
onModelReady: (model) => model.getNewUserOrders(), onModelReady: (model) => model.getNewUserOrders(),
builder: (_, model, widget) => AppScaffold( builder: (_, model, widget) => AppScaffold(
isShowAppBar: true, isShowAppBar: true,
appBarTitle: TranslationBase.of(context).vaccination, appBarTitle: TranslationBase.of(context).vaccination,
baseViewModel: model, baseViewModel: model,
showNewAppBarTitle: true, showNewAppBarTitle: true,
showNewAppBar: true, showNewAppBar: true,
body: Column( body: Column(
children: [ children: [
Expanded( Expanded(
child: ListView.separated( child: ListView.separated(
itemBuilder: (context, index) { itemBuilder: (context, index) {
return InkWell( Color selectedColor = model.babyInformationModelList[index].gender == 1 ? Color(0xFF5A282E) : Colors.white;
onTap: () { return InkWell(
Navigator.push( onTap: () {
context, Navigator.push(
FadePage( context,
page: VaccinationTablePage(model.babyInformationModelList[index]), FadePage(
), page: VaccinationTablePage(model.babyInformationModelList[index]),
); ),
}, );
child: Container( },
margin: EdgeInsets.only(left: 0, right: 0, bottom: 20), child: Container(
decoration: BoxDecoration( margin: EdgeInsets.only(left: 16, right: 16),
shape: BoxShape.rectangle, decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(12)), shape: BoxShape.rectangle,
color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(12)),
gradient: LinearGradient( color: Colors.white,
colors: model.babyInformationModelList[index].gender == 1 gradient: LinearGradient(
? [ colors: model.babyInformationModelList[index].gender == 1
Color(0xFFFDA4B0), ? [
Color(0xFFFBC8CC), Color(0xFFFDA4B0),
] Color(0xFFFBC8CC),
: [ ]
Color(0xFF6EA8FF), : [
Color(0xFF7AB8FD), Color(0xFF6EA8FF),
], Color(0xFF7AB8FD),
begin: Alignment.centerLeft, ],
end: Alignment.centerRight, begin: Alignment.centerLeft,
), end: Alignment.centerRight,
), ),
padding: EdgeInsets.all(12), ),
//double.infinity, padding: EdgeInsets.all(12),
//double.infinity,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Expanded(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Texts(model.babyInformationModelList[index].babyName.trim()), Text(
Row(children: [ model.babyInformationModelList[index].babyName.trim(),
IconButton( style: TextStyle(
icon: Image.asset(model.babyInformationModelList[index].gender == 1 ? 'assets/images/new-design/male.png' : 'assets/images/new-design/female.png'), fontSize: 14,
tooltip: '', letterSpacing: -0.46,
onPressed: () { fontWeight: FontWeight.bold,
setState(() { color: selectedColor,
// _volume += 10;
// launch("tel://" +model.FindusHospitalModelList[index].phoneNumber);
});
},
), ),
Texts(model.babyInformationModelList[index].genderDescription), ),
IconButton( Text(
icon: Icon( model.babyInformationModelList[index].gender == 1 ? TranslationBase.of(context).female : TranslationBase.of(context).male,
Icons.remove_red_eye, style: TextStyle(
color: Colors.red, fontSize: 11,
), color: selectedColor,
tooltip: '',
onPressed: () {
Navigator.push(
context,
FadePage(
page: VaccinationTablePage(model.babyInformationModelList[index]),
),
);
},
)
]),
Row(children: [
Texts(TranslationBase.of(context).dob),
]),
Row(children: [
IconButton(
icon: new Image.asset('assets/images/new-design/calender-secondary.png'),
tooltip: '',
onPressed: () {
setState(() {});
},
), ),
Texts(DateUtil.yearMonthDay(model.babyInformationModelList[index].dOB)), ),
]), Row(
Row(children: [ children: [
IconButton( Text(
icon: new Image.asset('assets/images/new-design/garbage.png'), TranslationBase.of(context).dob,
tooltip: '', style: TextStyle(
onPressed: () async { fontSize: 11,
//===================== color: selectedColor,
await model.deleteBabyOrders(newChild: deleteBaby); ),
),
Text(DateUtil.yearMonthDay(model.babyInformationModelList[index].dOB),
style: TextStyle(
fontSize: 11,
color: selectedColor,
)),
],
),
mHeight(20),
],
),
),
InkWell(
onTap: () async {
await model.deleteBabyOrders(newChild: deleteBaby);
deleteBaby.babyID = model.babyInformationModelList[index].babyID; deleteBaby.babyID = model.babyInformationModelList[index].babyID;
await model.deleteBabyOrders(newChild: deleteBaby); await model.deleteBabyOrders(newChild: deleteBaby);
if (model.isDeleted) { if (model.isDeleted) {
AppToast.showSuccessToast(message: TranslationBase.of(context).recordDeleted); AppToast.showSuccessToast(message: TranslationBase.of(context).recordDeleted);
Navigator.pop(context, model.isDeleted); Navigator.pop(context, model.isDeleted);
} else { } else {
//TODO handling error //TODO handling error
} }
}, },
child: Container(
decoration: containerRadius(Colors.black.withOpacity(0.2), 2000),
padding: EdgeInsets.only(left: 12, right: 12, top: 8, bottom: 8),
child: Row(
children: [
Image.asset(
'assets/images/new-design/garbage.png',
width: 16,
color: selectedColor,
), ),
Texts(TranslationBase.of(context).deleteView), mWidth(8),
]), Text(
SizedBox( TranslationBase.of(context).deleteView,
height: 12, style: TextStyle(
), fontSize: 11,
], fontWeight: FontWeight.w600,
letterSpacing: -0.33,
color: selectedColor,
),
),
],
),
), ),
), ),
); ],
}, ),
separatorBuilder: (BuildContext context, int index) {
return mHeight(12);
},
itemCount: model.babyInformationModelList.length,
), ),
), );
// Container( },
// height: height * 0.85, separatorBuilder: (BuildContext context, int index) {
// child: SingleChildScrollView( return mHeight(12);
// child: Container( },
// margin: EdgeInsets.only(left: 8, right: 8, top: 16), itemCount: model.babyInformationModelList.length,
// child: GridView.count(
// crossAxisCount: 2,
// childAspectRatio: (itemWidth / (itemHeight + 0)),
// crossAxisSpacing: 10,
// mainAxisSpacing: 10,
// controller: ScrollController(keepScrollOffset: true),
// shrinkWrap: true,
// padding: const EdgeInsets.all(4.0),
// children: [
// ...List.generate(
// model.babyInformationModelList.length,
// (index) => InkWell(
// onTap: () {
// Navigator.push(
// context,
// FadePage(
// page: VaccinationTablePage(model.babyInformationModelList[index]),
// ),
// );
// },
// child: Container(
// margin: EdgeInsets.only(left: 0, right: 0, bottom: 20),
// decoration: BoxDecoration(
// shape: BoxShape.rectangle,
// border: Border.all(color: Colors.white, width: 0.5),
// borderRadius: BorderRadius.all(Radius.circular(5)),
// color: Colors.white,
// ),
// padding: EdgeInsets.all(12),
// //double.infinity,
// child: Column(
// children: [
// Row(children: [
// Texts(TranslationBase.of(context).childName),
// ]),
// Row(children: [
// Texts(model.babyInformationModelList[index].babyName.trim()),
// ]),
// Row(children: [
// IconButton(
// icon: Image.asset(model.babyInformationModelList[index].gender == 1 ? 'assets/images/new-design/male.png' : 'assets/images/new-design/female.png'),
// tooltip: '',
// onPressed: () {
// setState(() {
// // _volume += 10;
// // launch("tel://" +model.FindusHospitalModelList[index].phoneNumber);
// });
// },
// ),
// Texts(model.babyInformationModelList[index].genderDescription),
// IconButton(
// icon: Icon(
// Icons.remove_red_eye,
// color: Colors.red,
// ),
// tooltip: '',
// onPressed: () {
// Navigator.push(
// context,
// FadePage(
// page: VaccinationTablePage(model.babyInformationModelList[index]),
// ),
// );
// },
// )
// ]),
// Row(children: [
// Texts(TranslationBase.of(context).dob),
// ]),
// Row(children: [
// IconButton(
// icon: new Image.asset('assets/images/new-design/calender-secondary.png'),
// tooltip: '',
// onPressed: () {
// setState(() {});
// },
// ),
// Texts(DateUtil.yearMonthDay(model.babyInformationModelList[index].dOB)),
// ]),
// Row(children: [
// IconButton(
// icon: new Image.asset('assets/images/new-design/garbage.png'),
// tooltip: '',
// onPressed: () async {
// //=====================
// await model.deleteBabyOrders(newChild: deleteBaby);
//
// deleteBaby.babyID = model.babyInformationModelList[index].babyID;
//
// await model.deleteBabyOrders(newChild: deleteBaby);
// if (model.isDeleted) {
// AppToast.showSuccessToast(message: TranslationBase.of(context).recordDeleted);
// Navigator.pop(context, model.isDeleted);
// } else {
// //TODO handling error
// }
// },
// ),
// Texts(TranslationBase.of(context).deleteView),
// ]),
// SizedBox(
// height: 12,
// ),
// ],
// ),
// ),
// ),
// )
// ],
// ))),
// ),
],
), ),
bottomSheet: Container( ),
height: height * 0.15, Container(
width: double.infinity, width: double.infinity,
padding: EdgeInsets.all(16), padding: EdgeInsets.all(16),
child: SecondaryButton( color: Colors.white,
textColor: Colors.white, child: SecondaryButton(
color: checkedValue == false textColor: Colors.white,
? Colors.white24 color: checkedValue
: Color.fromRGBO( ? CustomColors.accentColor
63, : Color.fromRGBO(
72, 63,
74, 72,
1, 74,
), 1,
label: TranslationBase.of(context).addNewChild,
//
onTap: () {
Navigator.push(
context,
FadePage(
page: AddNewChildPage(),
), ),
).then((value) { label: TranslationBase.of(context).addNewChild,
if (value) model.getNewUserOrders(); //
}); onTap: () {
}, Navigator.push(
), context,
FadePage(
page: AddNewChildPage(),
),
).then((value) {
if (value) model.getNewUserOrders();
});
},
), ),
)); ),
],
),
),
);
} }
} }

@ -1,16 +1,21 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/vaccination_table_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/vaccination_table_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_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/app_toast.dart'; 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_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';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart'; import 'package:flutter_html/flutter_html.dart';
import 'package:provider/provider.dart';
import 'dialogs/SelectGenderDialog.dart'; import 'dialogs/SelectGenderDialog.dart';
@ -23,6 +28,7 @@ class VaccinationTablePage extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
var size = MediaQuery.of(context).size; var size = MediaQuery.of(context).size;
final double height = (size.height - kToolbarHeight - 60); final double height = (size.height - kToolbarHeight - 60);
ProjectViewModel projectViewModel = Provider.of(context);
var checkedValue; var checkedValue;
return BaseView<VaccinationTableViewModel>( return BaseView<VaccinationTableViewModel>(
@ -31,147 +37,164 @@ class VaccinationTablePage extends StatelessWidget {
isShowAppBar: true, isShowAppBar: true,
baseViewModel: model, baseViewModel: model,
appBarTitle: TranslationBase.of(context).vaccination, appBarTitle: TranslationBase.of(context).vaccination,
showNewAppBar: true,
showNewAppBarTitle: true,
backgroundColor: CustomColors.appBackgroudGrey2Color,
body: Container( body: Container(
height: height * 0.85, height: double.infinity,
child: SingleChildScrollView( child: Column(
child: Container( children: [
margin: EdgeInsets.only(left: 16, right: 16, top: 16), Expanded(
child: Column( child: SingleChildScrollView(
children: [ child: Container(
Row( margin: EdgeInsets.only(left: 16, right: 16, top: 16),
children: [ child: Column(
Expanded( children: [
child: Texts(TranslationBase.of(context).childName), Container(
), decoration: containerRadius(Colors.white, 12),
Expanded(
child: Texts(TranslationBase.of(context).dob),
),
],
),
SizedBox(
height: 10,
),
Row(
children: [
Expanded(
child: Texts(babyInfo.babyName),
),
Expanded(
child: Texts(DateUtil.getFormattedDate(
babyInfo.dOB, "MMM dd,yyyy")),
),
],
),
SizedBox(
height: 10,
),
Divider(
color: Colors.black,
),
Row(
children: [
Text(TranslationBase.of(context).visit),
SizedBox(
width: 25,
),
Expanded(
child: Text(TranslationBase.of(context).description)),
Text(TranslationBase.of(context).dueDate),
],
),
...List.generate(
model.creteVaccinationTableModelList.length,
(index) => Container(
decoration: BoxDecoration(
shape: BoxShape.rectangle,
// border: Border.all(color: Colors.white, width: 0.5),
borderRadius: BorderRadius.all(Radius.circular(5)),
// color: Colors.white,
),
padding: EdgeInsets.all(12), padding: EdgeInsets.all(12),
width: double.infinity,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Text(
babyInfo.babyName,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
letterSpacing: -0.64,
),
),
mHeight(8),
Row( Row(
children: [ children: [
Text(model Text(
.creteVaccinationTableModelList[index] TranslationBase.of(context).gender + " :",
.visit), style: TextStyle(
SizedBox( fontSize: 10,
width: 10, fontWeight: FontWeight.w600,
letterSpacing: -0.4,
color: CustomColors.textColor,
),
), ),
Expanded( Text(
child: Column( babyInfo.gender == 1 ? TranslationBase.of(context).female : TranslationBase.of(context).male,
mainAxisAlignment: style: TextStyle(
MainAxisAlignment.start, fontSize: 12,
crossAxisAlignment: fontWeight: FontWeight.w600,
CrossAxisAlignment.start, letterSpacing: -0.4,
children: [ color: CustomColors.black,
Html(
// data:"<html><head><style type='text/css'>.Test {list-style-image:url('http://10.50.100.198:4444/Images/Bullet_List_Small.png');}</style></head><body><table><tr align='left'><td align='left'>BCG</td></tr><tr align='left'><td align='left'>HEPATITIS B</td></tr></table></body></html>"//model.creteVaccinationTableModelList[index].vaccinesDescription
data: model
.creteVaccinationTableModelList[
index]
.vaccinesDescription,
),
],
), ),
), ),
Text(model
.creteVaccinationTableModelList[index]
.givenAt),
], ],
), ),
Divider( Row(
color: Colors.black, children: [
Text(
TranslationBase.of(context).dateOfBirth + " :",
style: TextStyle(
fontSize: 10,
fontWeight: FontWeight.w600,
letterSpacing: -0.4,
color: CustomColors.textColor,
),
),
Text(
DateUtil.getFormattedDate(babyInfo.dOB, "MMM dd,yyyy"),
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
letterSpacing: -0.4,
color: CustomColors.black,
),
),
],
), ),
], ],
))) ),
], ),
), mHeight(12),
), Container(
), decoration: containerRadius(Colors.white, 12),
), padding: EdgeInsets.all(12),
bottomSheet: Container( child: Table(
height: height * 0.15, columnWidths: {
width: double.infinity, 0: FlexColumnWidth(1.8),
padding: EdgeInsets.all(12), 1: FlexColumnWidth(1.8),
child: SecondaryButton( 2: FlexColumnWidth(1.8),
textColor: Colors.white, },
color: checkedValue == false children: fullData(context, model, projectViewModel),
? Colors.white24 ),
: Color.fromRGBO( ),
63, ],
72,
74,
1,
), ),
label: TranslationBase.of(context).sendEmail,
//
onTap: () {
//SelectGenderDialog();
//===============
showDialog(
context: context,
child: SelectGenderDialog(
okFunction: () async {
await model.getCreateVaccinationTable(babyInfo, true);
if (model.state == ViewState.Idle) {
AppToast.showSuccessToast(
message: TranslationBase.of(context)
.emailSentSuccessfully);
} else {
AppToast.showErrorToast(
message: TranslationBase.of(context)
.EmailSentError);
}
},
), ),
); ),
//========= ),
}), Container(
width: double.infinity,
padding: EdgeInsets.all(12),
color: Colors.white,
child: SecondaryButton(
textColor: Colors.white,
color: CustomColors.accentColor,
label: TranslationBase.of(context).sendEmail,
//
onTap: () {
//SelectGenderDialog();
//===============
showDialog(
context: context,
child: SelectGenderDialog(
okFunction: () async {
await model.getCreateVaccinationTable(babyInfo, true);
if (model.state == ViewState.Idle) {
AppToast.showSuccessToast(message: TranslationBase.of(context).emailSentSuccessfully);
} else {
AppToast.showErrorToast(message: TranslationBase.of(context).EmailSentError);
}
},
),
);
//=========
},
),
),
],
),
), ),
), ),
); );
} }
List<TableRow> fullData(BuildContext context, VaccinationTableViewModel model, ProjectViewModel projectViewModel) {
List<TableRow> tableRow = [];
tableRow.add(
TableRow(
children: [
Utils.tableColumnTitle(TranslationBase.of(context).visit),
Utils.tableColumnTitle(TranslationBase.of(context).description),
Utils.tableColumnTitle(TranslationBase.of(context).dueDate),
],
),
);
model.creteVaccinationTableModelList.forEach(
(diabtec) {
tableRow.add(
TableRow(
children: [
Utils.tableColumnValue(diabtec.visit, isCapitable: false, mProjectViewModel: projectViewModel),
// Utils.tableColumnValue(diabtec.vaccinesDescription, isCapitable: false, mProjectViewModel: projectViewModel),
Html(
// data:"<html><head><style type='text/css'>.Test {list-style-image:url('http://10.50.100.198:4444/Images/Bullet_List_Small.png');}</style></head><body><table><tr align='left'><td align='left'>BCG</td></tr><tr align='left'><td align='left'>HEPATITIS B</td></tr></table></body></html>"//model.creteVaccinationTableModelList[index].vaccinesDescription
data: diabtec.vaccinesDescription,
),
Utils.tableColumnValue(diabtec.givenAt, isCapitable: false, mProjectViewModel: projectViewModel),
],
),
);
},
);
return tableRow;
}
} }

Loading…
Cancel
Save